com.paas.swagger.annotations.ApiOperation Maven / Gradle / Ivy
package com.paas.swagger.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @ClassName ApiOperation
* @Date 2021/2/6 14:57
* @Auther wangyongyong
* @Version 1.0
* @Description api 操作定义
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
//@Retention(RetentionPolicy.SOURCE) //正式发布启用该配置
public @interface ApiOperation
{
/**
* Corresponds to the `summary` field of the operation.
*
* Provides a brief description of this operation. Should be 120 characters or less
* for proper visibility in Swagger-UI.
*/
String value();
/**
* Corresponds to the 'notes' field of the operation.
*
* A verbose description of the operation.
*/
String notes() default "";
/**
* A list of tags for API documentation control.
*
* Tags can be used for logical grouping of operations by resources or any other qualifier.
* for this operation.
*/
String[] tags() default "";
/**
* Corresponds to the `method` field as the HTTP method used.
*
* If not stated, in JAX-RS applications, the following JAX-RS annotations would be scanned
* and used: {@code @GET}, {@code @HEAD}, {@code @POST}, {@code @PUT}, {@code @DELETE} and {@code @OPTIONS}.
* Note that even though not part of the JAX-RS specification, if you create and use the {@code @PATCH} annotation,
* it will also be parsed and used. If the httpMethod property is set, it will override the JAX-RS annotation.
*
* For Servlets, you must specify the HTTP method manually.
*
* Acceptable values are "GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS" and "PATCH".
*/
String httpMethod() default "";
/**
* Corresponds to the `produces` field of the operation.
*
* Takes in comma-separated values of content types.
* For example, "application/json, application/xml" would suggest this operation
* generates 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.
*/
String produces() default "";
/**
* Corresponds to the `consumes` field of the operation.
*
* Takes in comma-separated values of content types.
* For example, "application/json, application/xml" would suggest this API Resource
* accepts 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.
*/
String consumes() default "";
/**
* Sets specific protocols (schemes) for this operation.
*
* 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 "";
/**
* Hides the operation from the list of operations.
*/
boolean hidden() default false;
/**
* The HTTP status code of the response.
*
* The value should be one of the formal HTTP Status Code Definitions.
*/
int code() default 200;
/**
* Ignores JsonView annotations while resolving operations and types. For backward compatibility
*/
boolean ignoreJsonView() default false;
int position() default 0;
}