-
Notifications
You must be signed in to change notification settings - Fork 520
1.4.0 增加全局参数配置 #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.4.0 增加全局参数配置 #16
Conversation
README.md
Outdated
- swagger.docket.<name>.name=参数名 | ||
- swagger.docket.<name>.modelRef=指定参数类型 | ||
- swagger.docket.<name>.parameterType=指定参数存放位置,可选header,query,path,body.form | ||
- swagger.docket.<name>.required=true=指定参数是否必传,true,false | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swagger.docket..required=指定参数是否必传,true,false
.modelRef(new ModelRef(swaggerProperties.getModelRef())) | ||
.parameterType(swaggerProperties.getParameterType()) | ||
.required(Boolean.parseBoolean(swaggerProperties.getRequired())) | ||
.build())) | ||
.groupName(groupName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
只有一个参数?最好支持多个参数的配置。
README.md
Outdated
- swagger.docket.<name>.name=参数名 | ||
- swagger.docket.<name>.modelRef=指定参数类型 | ||
- swagger.docket.<name>.parameterType=指定参数存放位置,可选header,query,path,body.form | ||
- swagger.docket.<name>.required=true=指定参数是否必传,true,false | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参数的设计由于全局操作参数也算是一个小类,建议以swagger.global-operation-params.xxx的方式构建,这样更加清晰,不然都跟docket的info信息混淆。
|
||
@Data | ||
@NoArgsConstructor | ||
@ConfigurationProperties("swagger.globalOperationParameters") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ConfigurationProperties("swagger.globalOperationParameters") 这个不加应该也可以
excludePath.add(PathSelectors.ant(path)); | ||
} | ||
|
||
Docket docket = new Docket(DocumentationType.SWAGGER_2) | ||
.host(swaggerProperties.getHost()) | ||
.apiInfo(apiInfo) | ||
.globalOperationParameters(buildGlobalOperationParametersFromSwaggerProperties(swaggerProperties)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有docket都一样配置?
建议除了全局配置之外,每个docket应该也可以配置覆盖全局配置。
- swagger.docket.<name>.name=参数名 | ||
- swagger.docket.<name>.modelRef=指定参数类型 | ||
- swagger.docket.<name>.parameterType=指定参数存放位置,可选header,query,path,body.form | ||
- swagger.docket.<name>.required=true=指定参数是否必传,true,false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swagger.docket..required=指定参数是否必传,true,false
去掉多余的内容
@@ -129,6 +144,10 @@ swagger.exclude-path=/ops/**, /error | |||
- swagger.docket.<name>.base-package=swagger扫描的基础包,默认:全扫描 | |||
- swagger.docket.<name>.base-path=需要处理的基础URL规则,默认:/** | |||
- swagger.docket.<name>.exclude-path=需要排除的URL规则,默认:空 | |||
- swagger.docket.<name>.name=参数名 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
每个docket的似乎还没支持?
README.md
Outdated
- swagger.globalOperationParameters[0].description=描述信息 | ||
- swagger.globalOperationParameters[0].modelRef=指定参数类型 | ||
- swagger.globalOperationParameters[0].parameterType=指定参数存放位置,可选header,query,path,body.form | ||
- swagger.globalOperationParameters[0].required=指定参数是否必传,true,false | ||
``` | ||
|
||
> host属性从1.3.0.RELEASE开始支持 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加 globalOperationParameters支持的说明,从1.4.0.RELEASE开始
No description provided.