All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.swagger.annotations.Api Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2016 SmartBear Software
 * 

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* http://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.swagger.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Marks a class as a Swagger resource. *

* By default, Swagger-Core will only include and introspect only classes that are annotated * with {@code @Api} and will ignore other resources (JAX-RS endpoints, Servlets and * so on). */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface Api { /** * Implicitly sets a tag for the operations, legacy support (read description). *

* In swagger-core 1.3.X, this was used as the 'path' that is to host the API Declaration of the * resource. This is no longer relevant in swagger-core 1.5.X. *

* If {@link #tags()} is not used, this value will be used to set the tag for the operations described by this * resource. Otherwise, the value will be ignored. *

* The leading / (if exists) will be removed. * * @return tag name for operations under this resource, unless {@link #tags()} is defined. */ String value() default ""; /** * A list of tags for API documentation control. * Tags can be used for logical grouping of operations by resources or any other qualifier. *

* A non-empty value will override the value provided in {@link #value()}. * * @return a string array of tag values * @since 1.5.2-M1 */ String[] tags() default ""; /** * Not used in 1.5.X, kept for legacy support. * * @return a longer description about this API, no longer used. */ @Deprecated String description() default ""; /** * Not used in 1.5.X, kept for legacy support. * * @return the basePath for this operation, no longer used. */ @Deprecated String basePath() default ""; /** * Not used in 1.5.X, kept for legacy support. * * @return the position of this API in the resource listing, no longer used. */ @Deprecated int position() default 0; /** * Corresponds to the `produces` field of the operations under this resource. *

* Takes in comma-separated values of content types. * For example, "application/json, application/xml" would suggest the operations * generate JSON and XML output. *

* For JAX-RS resources, this would automatically take the value of the {@code @Produces} * annotation if such exists. It can also be used to override the {@code @Produces} values * for the Swagger documentation. * * @return the supported media types supported by the server, or an empty string if not set. */ String produces() default ""; /** * Corresponds to the `consumes` field of the operations under this resource. *

* Takes in comma-separated values of content types. * For example, "application/json, application/xml" would suggest the operations * accept JSON and XML input. *

* For JAX-RS resources, this would automatically take the value of the {@code @Consumes} * annotation if such exists. It can also be used to override the {@code @Consumes} values * for the Swagger documentation. * * @return the consumes value, or empty string if not set */ String consumes() default ""; /** * Sets specific protocols (schemes) for the operations under this resource. *

* Comma-separated values of the available protocols. Possible values: http, https, ws, wss. * * @return the protocols supported by the operations under the resource. */ String protocols() default ""; /** * Corresponds to the `security` field of the Operation Object. *

* Takes in a list of the authorizations (security requirements) for the operations under this resource. * This may be overridden by specific operations. * * @return an array of authorizations required by the server, or a single, empty authorization value if not set. * @see Authorization */ Authorization[] authorizations() default @Authorization(value = ""); /** * Hides the operations under this resource. * * @return true if the api should be hidden from the swagger documentation */ boolean hidden() default false; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy