Springfox: Result of adding tags to docket in swagger configuration

Created on 27 Jul 2016  路  3Comments  路  Source: springfox/springfox

Using 2.5.0.

I can't seem to find any result from adding tags in the docket in a swagger config file.

My understanding from the docs is that several tags are automatically generated, and by adding tags to the configuration I should be adding to that list. So those tags should be added to the swagger.json file, but instead there seems to be no effect.

Am I misunderstanding the documentation, is there another step to make adding those tags actually make a change to the JSON?

Example: in the spring-swagger2markup-demo, adding a .tags line to the docket like so:

``` @Bean
public Docket restApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.tags(new Tag("foo", "bar"))
.securitySchemes(asList(
new OAuth(
"petstore_auth",
asList(new AuthorizationScope("write_pets", "modify pets in your account"),
new AuthorizationScope("read_pets", "read your pets")),
Arrays.asList(new ImplicitGrant(new LoginEndpoint("http://petstore.swagger.io/api/oauth/dialog"), "tokenName"))
),
new ApiKey("api_key", "api_key", "header")
))
.select()
.paths(Predicates.and(ant("/"), Predicates.not(ant("/error")), Predicates.not(ant("/management/")), Predicates.not(ant("/management*"))))
.build();
}


Makes no change on the swagger.json file.

"host":"localhost:8080",
"basePath":"/",
"tags":[
{"name":"Stores","description":"Operations about store"},
{"name":"Users","description":"Operations about user"},
{"name":"Pets","description":"Operations about pets"}]
```

While I would expect an additional tag: {"name":"foo","description":"bar"} to be added.

bug

Most helpful comment

Thanks for catching that! :metal:

All 3 comments

Not sure might be a regression...

Thanks for catching that! :metal:

No problem! Glad to see it resolved!

Was this page helpful?
0 / 5 - 0 ratings