springdoc

Default response class in springdoc

99封情书 提交于 2020-08-23 04:03:22
问题 I am trying to add a default error model to all endpoints in my API, for some error codes. I found a partial solution by reading the following issues: Springfox -> Springdoc: How to expose additional models https://github.com/springdoc/springdoc-openapi/issues/381 This is the bean I am creating for that customisation: @Bean public OpenApiCustomiser customOpenApiCustomiser() { return openApi -> { openApi.getPaths().values().forEach(pathItem -> pathItem.readOperations().forEach(operation -> {

how to pass Spring Pageable to FeignClient

旧巷老猫 提交于 2020-08-10 03:38:33
问题 as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client I have some problems sending a Pageable object in a POST request containing a @requestbody element. First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core. Example: @PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto

how to pass Spring Pageable to FeignClient

十年热恋 提交于 2020-08-10 03:38:15
问题 as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client I have some problems sending a Pageable object in a POST request containing a @requestbody element. First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core. Example: @PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto

Enable Authorize button in springdoc-openapi-ui for Bearer Token Authentication (JWT)

ぃ、小莉子 提交于 2020-07-18 12:53:23
问题 How to enable "Authorize" button in springdoc-openapi-ui (OpenAPI 3.0 /swagger-ui.html ) for Bearer Token Authentication, for example JWT. What annotations have to be added to Spring @Controller and @Configuration classes? 回答1: Define a global security scheme for OpenAPI 3.0 using annotation @io.swagger.v3.oas.annotations.security.SecurityScheme in a @Configuration bean: @Configuration @OpenAPIDefinition(info = @Info(title = "My API", version = "v1")) @SecurityScheme( name = "bearerAuth",

Spring docs - Open API 3 - How to set default values to body?

前提是你 提交于 2020-05-23 07:41:52
问题 I am using Spring Boot + Spring Data Mongo + Spring REST + Spring HATEOAS to implement REST endpoints. Since we're passing more than 5 Query Parameters (proprietary setting of an Org, supposed to be not passed), so I though to create a EmployeeDto Class and pass that class at Controller @GetMapping(value = "/employees", produces = {MediaType.APPLICATION_JSON }) public ResponseEntity<PagedModel<EmployeeModel>> findEmployees( EmployeeDto dto, @Parameter(hidden=true) String sort, @Parameter

Springfox -> Springdoc: How to expose additional models

末鹿安然 提交于 2020-05-17 07:38:26
问题 I need to expose some models which don't used directly in REST API methods. With springfox I used Docket's additionalModels method to programmatically add models to specification: docket.additionalModels( typeResolver.resolve(XModel1.class), typeResolver.resolve(XModel2.class) ) How to do it with springdoc? Ok, I've created fake operation with fake parameter which includes all required models. But it seems not a cool solution. 回答1: With OpenApiCustomiser , you have access to the OpenAPI

Global Parameter set using Open API configurations?

笑着哭i 提交于 2020-05-13 14:37:27
问题 I am using Spring Boot REST OpenAPI 3 specification. In this example, I am looking to globally set the headers ( Custom-Header-Version=v1 ) which I want to pass while making a request to each endpoint(s). Now issue is that I've 100 of REST endpoint and for each endpoint I need to keep adding @Parameter(in = ParameterIn.HEADER ..... , this configuration, instead I was looking to set it globally. Is there any way if we can do it in OpenAPI? Is there any way to remove SmartBear logo from Spring

Global Parameter set using Open API configurations?

痞子三分冷 提交于 2020-05-13 14:37:06
问题 I am using Spring Boot REST OpenAPI 3 specification. In this example, I am looking to globally set the headers ( Custom-Header-Version=v1 ) which I want to pass while making a request to each endpoint(s). Now issue is that I've 100 of REST endpoint and for each endpoint I need to keep adding @Parameter(in = ParameterIn.HEADER ..... , this configuration, instead I was looking to set it globally. Is there any way if we can do it in OpenAPI? Is there any way to remove SmartBear logo from Spring

Open API 3 - How to read Spring Boot Pagination Properties?

时间秒杀一切 提交于 2020-03-21 11:01:24
问题 I am using Spring Boot + Spring Rest Pagination + Open API 3. @Operation(summary = "Find Contacts by name", description = "Name search by %name% format", tags = { "contact" }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Contact.class)))) }) @Parameter(in = ParameterIn.QUERY, description = "Zero-based page index (0..N)", name = "page" , content = @Content(schema =

How to Globally ignore API of Spring Boot from Open API 3 specification?

一曲冷凌霜 提交于 2020-02-14 02:26:46
问题 I went through the documentation: https://springdoc.github.io/springdoc-openapi-demos/faq.html#how-can-i-ignore-some-field-of-model- already, but documents are not very clear, I have Spring Boot REST HATEOAS implementation project and using Open API 3 specification instead of Swagger . I've Pagination implemented for each endpoints, but some how my industry standards expecting content as a plural contents. But since this is part of Pageable API I am not able to override it, instead looking to