com.cpj.swagger.annotation.Param Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cpj-swagger Show documentation
Show all versions of cpj-swagger Show documentation
cpj-swagger通过与swagger ui一起快速为您的web项目产生接口文档,并且支持在线测试接口。cpj-swagger可以很方便的与struts2、spring mvc、servlet集成使用
The newest version!
/*
* Copyright 2011-2017 CPJIT Group.
*
*
* 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 com.cpj.swagger.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 接口的请求参数。
*
* @author yonghaun
* @since 1.0.0
*/
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface Param {
/**
* 输入参数类型,可取如下值:
*
* - query - 参数拼接到url中
* - body - 参数直接放入请求体中
* - path - restful风格的参数传递
* - header - 参数放在请求头中
* - formData - 参数通过form表单提交
*
*
* Note:
*
* - 当前请求方式为POST的时候,默认值为formData
* - 请求方式为非POST的时候,默认值为query
*
*/
String in() default "";
/** 参数名 */
String name() default "";
/**
* 数据类型,与{@link #format()}一起指定请求参数的数据类型。
* {@link #type()} 和 {@link #format()}的可选值如下:
通用名
type
format
备注
integer
integer
int32
signed 32 bits
long
integer
int64
signed 64 bits
float
number
float
double
number
double
string
string
byte
string
byte
base64 encoded characters
binary
string
binary
any sequence of octets
boolean
boolean
date
string
date
As defined by full-date
- RFC3339
dateTime
string
date-time
As defined by date-time
- RFC3339
password
string
password
Used to hint UIs the input needs to be obscured.
* @deprecated 在版本1.2.2中被废弃,建议使用{@link Param#dataType()}替代。
* @see #format()
* @see DataType
**/
@Deprecated
String type() default "";
/**
* 数据格式,与{@link #type()}一起指定请求参数的数据类型。
* @deprecated 在版本1.2.2中被废弃,建议使用{@link Param#dataType()}替代。
* @see #type()
* @see DataType
* */
@Deprecated
String format() default "";
/**
* 请求参数的数据类型和格式。
* @since 1.2.2
*/
DataType dataType() default DataType.UNKNOWN;
/** 参数说明 */
String description() default "";
/** 是否必须,默认是false */
boolean required() default false;
/**
* 可选值
* @see Item
* */
String items() default "";
/**
* 包装对象
* @see APISchema
* */
String schema() default "";
}