springfox / springfox-demos

Springfox demo applications
http://springfox.io
Apache License 2.0
737 stars 353 forks source link

@SwaggerDefinition does not work #12

Open hiteshbargujar opened 9 years ago

hiteshbargujar commented 9 years ago

I am integrating swagger annotation and ui for my service (spring boot App). I want to override some of the Swagger Properties like Contact Email, API Version, BaseURL.

I see we have @SwaggerDefinition Annotation present, but the changes do not show up on the UI or the json spec.

If we have support for this, please provide a demo for the same.

dilipkrish commented 8 years ago

@hiteshbargujar This is not supported and most likely will not be supported. Follow this issue for updates

ssrini commented 8 years ago

What would be the correct way to add these values the. For eg. Base url, license etc.

dilipkrish commented 8 years ago

Using the Docket#apiInfo()

ssrini commented 8 years ago

Thanks. This sample https://github.com/springfox/springfox-demos/blob/master/boot-swagger/src/main/java/springfoxdemo/boot/swagger/Application.java and the working example here: http://fizzylogic.nl/2015/07/29/quickly-generate-api-docs-for-your-spring-boot-application-using-springfox/ helped.

Modified the SwaggerConfiguration class and all is good.

pagrus7 commented 8 years ago

The referenced issue is now closed, yet still it doesn't look like @SwaggerDefinition works. Is it something that springfox is supposed to support now?

dilipkrish commented 8 years ago

@pagrus7 see this comment. It doesn't make sense to support that annotation. The docket lets you do everything it provides.

zulfyadhie commented 6 years ago

Docket#apiInfo() is deprecated now, what is the alternative way to override swagger properties (Title, description, Contact email etc) ?

benfonty commented 6 years ago

Hello, I think the support of @SwaggerDefinition would be a good thing as it would separate the definitions of the api from the tool used to generate the documentation of the api. Besides, I cannot figure how to generate externalDocs with springfox, although there is an annotation @ExternalDocs in @SwaggerDefinition.

dilipkrish commented 6 years ago

@zulfyadhie Docket#apiInfo as such is not deprecated. The ApiInfo contstructor is deprecated in favor of a richer contact object model.

https://github.com/springfox/springfox/blob/5db8be228f111c03e78bf58229ffe0f0b8cb9212/springfox-core/src/main/java/springfox/documentation/service/ApiInfo.java#L59-L76

@benfonty That is easily supported via all the available extensibility mechanisms. At the moment that is not priority since it there is ability via plugins to extend all of the things it provides.

Secondly, for OpenAPI 3.0 support these annotations will no longer work (package/breaking change in the swagger libraries). So investing in providing this feature is not priority.