swagger-2.0

How to provide authentication in Swagger API on Spring Boot application

牧云@^-^@ 提交于 2021-01-27 13:10:56
问题 I have integrated Swagger to generate API documentation for Spring REST application using Spring Boot. It works well, I could see the generated API documentation when I hit the URL : http://localhost:8080/test/swagger-ui.html My question is how can I restrict the access to the API? Basic authentication based on hardcoded username and password should be good enough for at least to start with. I used maven to add "swagger2" dependency. Here is the pom.xml: <dependency> <groupId>io.springfox<

Swagger enum values not getting displayed in drop down?

三世轮回 提交于 2021-01-01 08:14:17
问题 This is my controller method where the enum is accepted @GetMapping("/{sortBy}/{page}/{size}") public ResponseDto<ReviewsResponseDto, Void> searchAllReviews( @PathVariable(value = "sortBy") ReviewsSortBy sortBy, @PathVariable Integer page, @PathVariable Integer size) This is my enum ReviewsSortBy @Getter @ToString public enum ReviewsSortBy { DEFAULT, FEATURED, RECENT; } Now the problem is that swagger doesnt display the possible values of enum in dropdown, instead it just displays

Swagger enum values not getting displayed in drop down?

↘锁芯ラ 提交于 2021-01-01 08:13:38
问题 This is my controller method where the enum is accepted @GetMapping("/{sortBy}/{page}/{size}") public ResponseDto<ReviewsResponseDto, Void> searchAllReviews( @PathVariable(value = "sortBy") ReviewsSortBy sortBy, @PathVariable Integer page, @PathVariable Integer size) This is my enum ReviewsSortBy @Getter @ToString public enum ReviewsSortBy { DEFAULT, FEATURED, RECENT; } Now the problem is that swagger doesnt display the possible values of enum in dropdown, instead it just displays

Swagger enum values not getting displayed in drop down?

我的梦境 提交于 2021-01-01 08:12:32
问题 This is my controller method where the enum is accepted @GetMapping("/{sortBy}/{page}/{size}") public ResponseDto<ReviewsResponseDto, Void> searchAllReviews( @PathVariable(value = "sortBy") ReviewsSortBy sortBy, @PathVariable Integer page, @PathVariable Integer size) This is my enum ReviewsSortBy @Getter @ToString public enum ReviewsSortBy { DEFAULT, FEATURED, RECENT; } Now the problem is that swagger doesnt display the possible values of enum in dropdown, instead it just displays

Swagger enum values not getting displayed in drop down?

一个人想着一个人 提交于 2021-01-01 08:11:15
问题 This is my controller method where the enum is accepted @GetMapping("/{sortBy}/{page}/{size}") public ResponseDto<ReviewsResponseDto, Void> searchAllReviews( @PathVariable(value = "sortBy") ReviewsSortBy sortBy, @PathVariable Integer page, @PathVariable Integer size) This is my enum ReviewsSortBy @Getter @ToString public enum ReviewsSortBy { DEFAULT, FEATURED, RECENT; } Now the problem is that swagger doesnt display the possible values of enum in dropdown, instead it just displays

Add lombok (or any) annotation to swagger generated class

不羁的心 提交于 2020-12-29 13:15:34
问题 I scavenged the internet but didn't find anything to solve this problem. Is it possible to add the lombok annotations in a swagger class UPON generation? I have this swagger schema: Product: type: "object" required: - idSeller - model - name - description - price properties: id: type: string idSeller: type: string model: type: string name: type: string description: type: string price: type: number format: currency minimum: 0.01 Which generated this code: @Validated @javax.annotation.Generated

Migrating from springfox swagger2 to springdoc openapi

雨燕双飞 提交于 2020-12-29 05:41:52
问题 https://www.dariawan.com/tutorials/spring/documenting-spring-boot-rest-api-springdoc-openapi-3/ Trying to follow these How do I deal with annotations like @ApiModel(value = "Response container") @ApiModelProperty(value = "Iventory response", required = true) 回答1: Migrating from SpringFox Remove springfox and swagger 2 dependencies. Add springdoc-openapi-ui dependency instead. <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>@springdoc

Migrating from springfox swagger2 to springdoc openapi

走远了吗. 提交于 2020-12-29 05:41:35
问题 https://www.dariawan.com/tutorials/spring/documenting-spring-boot-rest-api-springdoc-openapi-3/ Trying to follow these How do I deal with annotations like @ApiModel(value = "Response container") @ApiModelProperty(value = "Iventory response", required = true) 回答1: Migrating from SpringFox Remove springfox and swagger 2 dependencies. Add springdoc-openapi-ui dependency instead. <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>@springdoc