Skip to content

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

Merged
merged 7 commits into from
Sep 7, 2017
Merged

1.4.0 增加全局参数配置 #16

merged 7 commits into from
Sep 7, 2017

Conversation

renlulu
Copy link
Collaborator

@renlulu renlulu commented Aug 31, 2017

No description provided.

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
```
Copy link
Member

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)
Copy link
Member

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
```
Copy link
Member

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")
Copy link
Member

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))
Copy link
Member

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
Copy link
Member

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=参数名
Copy link
Member

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开始支持
Copy link
Member

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开始

@dyc87112 dyc87112 merged commit f76eef3 into 1.4.0 Sep 7, 2017
@dyc87112 dyc87112 added this to the 1.4.0 milestone Sep 7, 2017
@dyc87112
Copy link
Member

dyc87112 commented Sep 7, 2017

#6

@dyc87112 dyc87112 mentioned this pull request Sep 7, 2017
@dyc87112 dyc87112 deleted the 1.4.0-xiaohou branch September 7, 2017 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants