springdoc

SpringDoc/Swagger behind an nginx proxy

只愿长相守 提交于 2021-02-11 12:59:01
问题 We are running a service behind an nginx proxy so that: http://service-post:8080/swagger-ui.html is routed to public address https://host.com/services/post/swagger-ui.html Or to define from the other way: When nginx receives request on https://host.com/services/post/swagger-ui.html , it strips the /services/post/ prefix and passes the request to the post service on /swagger-ui.html path. Before setting up anything (with default SpringDoc configuration) I can correctly see the swagger docs on

Getting “inject() must be called from an injection context” after upgrading to Angular 11

半世苍凉 提交于 2021-02-10 18:01:25
问题 After upgrading to Angular 11, I am not able to ng serve my web application anymore. I am generating the client using Spring Doc and the latest OpenAPI generator gradle-plutin (5.0.0). The problem appears to be related to my (generated) REST-client. Opening https://localhost:4200 will write the following into the console: main.ts:12 Error: inject() must be called from an injection context at injectInjectorOnly (core.js:4901) [angular] at Module.ɵɵinject (core.js:4911) [angular] at Object

springdoc-openapi apply default global SecurityScheme possible?

谁都会走 提交于 2021-02-06 10:11:54
问题 I have the following SecurityScheme definition using springdoc-openapi for java SpringBoot RESTful app: @Bean public OpenAPI customOpenAPI() { return new OpenAPI() .components(new Components().addSecuritySchemes("bearer-jwt", new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT") .in(SecurityScheme.In.HEADER).name("Authorization"))) .info(new Info().title("App API").version("snapshot")); } Is it possible to apply it globally to all paths, without having to go

@Value not providing values from application properties Spring Boot

末鹿安然 提交于 2021-01-29 18:27:31
问题 I'm using Springdoc 1.4 with Spring-Boot 2.3 and in the OperationCustomizer class, I need to read value from the application properties file. But everytime the field is always initialized to null . The specifications are as follows application.properties application.security.authorization=true OperationCustomizer class @Component public class GlobalHeaderAdder implements OperationCustomizer { @Value("${application.security.authorization:true}") Boolean authFilterEnabled; // <---- Initialized

How to hide endpoints from OpenAPI documentation with Springdoc

倖福魔咒の 提交于 2021-01-28 14:02:43
问题 Springdoc automatically generates a API documentation for all handler methods. Even if there are no OpenAPI annotations. How can I hide endpoints from the API documentation? 回答1: The @io.swagger.v3.oas.annotations.Hidden annotation can be used at the method or class level of a controller to hide one or all endpoints. (See: https://springdoc.org/faq.html#how-can-i-hide-an-operation-or-a-controller-from-documentation) Example: @Hidden // Hide all endpoints @RestController @RequestMapping(path =

How to hide endpoints from OpenAPI documentation with Springdoc

瘦欲@ 提交于 2021-01-28 13:56:45
问题 Springdoc automatically generates a API documentation for all handler methods. Even if there are no OpenAPI annotations. How can I hide endpoints from the API documentation? 回答1: The @io.swagger.v3.oas.annotations.Hidden annotation can be used at the method or class level of a controller to hide one or all endpoints. (See: https://springdoc.org/faq.html#how-can-i-hide-an-operation-or-a-controller-from-documentation) Example: @Hidden // Hide all endpoints @RestController @RequestMapping(path =

How do I write a custom sorter to sort my springdoc swagger tags by name in the UI?

孤街浪徒 提交于 2021-01-28 11:47:47
问题 I am using springdoc-openapi with the latest version (1.3.0). Now I would like sort my tags in the UI by "name" property. I know about the "springdoc.swagger-ui.tagsSorter" configuration and that I can use a custom sorter function. But I cannot find examples how the function should look like. I tried the following which does not seem to work: springdoc.swagger-ui.tagsSorter=(a, b) => a.get("name").localeCompare(b.get("name")) 回答1: By default, you can sort tags alphabetically: https:/

How to Integrate Open API 3 with Spring project (not Spring Boot) using springdoc-openapi

杀马特。学长 韩版系。学妹 提交于 2021-01-22 13:23:31
问题 My Existing Project is on Spring Framework not Spring Boot. I want to integrate Open API 3 with it. I want to integrate using springdoc-openapi not using Jersey. 回答1: Even your application is using spring without (spring-boot), it should work. You need to add beans and dependencies auto-configuration that are natively provided in spring-boot. You mainly, need to add the springdoc-openapi module and scan for the springdoc auto-configuration classes that spring-boot automatically loads for you.

How to Integrate Open API 3 with Spring project (not Spring Boot) using springdoc-openapi

天涯浪子 提交于 2021-01-22 13:22:11
问题 My Existing Project is on Spring Framework not Spring Boot. I want to integrate Open API 3 with it. I want to integrate using springdoc-openapi not using Jersey. 回答1: Even your application is using spring without (spring-boot), it should work. You need to add beans and dependencies auto-configuration that are natively provided in spring-boot. You mainly, need to add the springdoc-openapi module and scan for the springdoc auto-configuration classes that spring-boot automatically loads for you.

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