Questions tagged [springdoc]

The springdoc-openapi Java library helps automating the generation of API documentation using Spring Boot projects. springdoc-openapi works by examining an application at runtime to infer API semantics based on Spring configurations, class structure and various annotations.

The springdoc library automatically generates documentation in JSON/YAML and HTML formatted pages. The generated documentation can be complemented using swagger-annotations.

Useful links:

471 questions
14
votes
3 answers

How to hide endpoints from OpenAPI documentation with Springdoc

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?
Matt Ke
  • 3,599
  • 12
  • 30
  • 49
12
votes
3 answers

How to add Header with Authorization for springdoc-openapi endpoint calls

Swagger2 (springfox) worked with: @Bean public Docket getDocket() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) …
akudama
  • 121
  • 1
  • 1
  • 5
11
votes
3 answers

404 error on Swagger UI with Spring (springdoc-openapi configuration)

I am adding swagger UI to my Spring boot application. When I try to access the swagger-ui.html. I get the 404 error. Config class : @Configuration public class SwaggerConfig { @Bean public OpenAPI springShopOpenAPI() { return new…
peligrosa
  • 593
  • 1
  • 4
  • 8
11
votes
4 answers

springdoc-openapi: How to add example of POST request?

Have the following method of Controller: @ApiResponses(value = {@ApiResponse(responseCode = "200")}) @GetMapping(value = API_URI_PREFIX + PRODUCTS_URI, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) …
user471011
  • 7,104
  • 17
  • 69
  • 97
9
votes
4 answers

Springdoc Swagger UI not using swagger-config

need some help with springdoc-openapi-ui! I am using springdoc-openapi-ui to render my API schema. This is the version details of it. Now, i have done some configuration in my spring boot application like below Now, i was expecting that when i hit…
Arpit Agrawal
  • 1,180
  • 1
  • 10
  • 21
9
votes
2 answers

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

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.…
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
8
votes
3 answers

I have installed OpenAPI 3 using springdoc, but the URL is strange. Can I change it to the expected value?

I have installed swagger-ui using the following artifacts in my Java project's pom file: org.springdoc springdoc-openapi-ui 1.5.2
Dave
  • 185
  • 1
  • 3
  • 13
8
votes
1 answer

springdoc-openapi-ui + swagger don't understand @PathVariable required = false flag

I use this library for generation documentation: org.springdoc springdoc-openapi-ui 1.5.0 I have this controller: @RestController public class…
7
votes
2 answers

How to hide certain schemas from 'Schemas' section in Swagger UI (OpenAPI 3, Spring Boot)

I'm using Springdoc to document my REST API made in Spring Boot. I need to hide some models/schemas from Schemas section in Swagger UI which are used only internally in API, so there is no need to display them in Schemas section. This is one of the…
Paweł Raglis
  • 91
  • 2
  • 5
7
votes
1 answer

How to represent List of Strings in Springdoc Swagger v3?

Below is a code that is similar to the situation I have @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK", content = {@Content(schema = @Schema( implementation = // <-- What to specify here? …
Debargha Roy
  • 2,320
  • 1
  • 15
  • 34
7
votes
2 answers

CSRF Support in springdoc-openapi swagger-ui

Is there a way to automatically include a CSRF header to requests made from swagger ui, when using the one bundled with springdoc-openapi? A similar solution appears to be implemented in springfox (GitHub), but I find no information about whether…
starman
  • 356
  • 1
  • 4
  • 11
7
votes
1 answer

How to make OpenAPI specification using generics in Java

I use generics in my controller. For instance, from some end-points I return Response and Response. Well, Swagger generates this part of yaml automatically responses: 200: description: default response …
6
votes
0 answers

How to merge multiple Open Api Spec into one using springdoc

I have a micro service architecture with spring cloud gateway and each micro service has its own Open Api Spec. I need to merge all of them into 1 Open Api Spec ( yaml or json ). I am not talking about a single swagger UI serving multiple links. I…
6
votes
1 answer

Swagger - Authorize request to url with documentation

I am wondering whether there is an option in Swagger to authorize request to url containing external documentation. I have the following configuration, what I am interested in is urls[1]…
michelson
  • 686
  • 9
  • 22
6
votes
2 answers

How can I make all optional OpenAPI parameters nullable using springdoc-openapi?

The springdoc-openapi library automatically marks certain properties as required in the generated OpenAPI documentation. For instance, properties annotated as @NotNull will be included in the list of required properties in the generated YAML…
M. Justin
  • 14,487
  • 7
  • 91
  • 130
1
2
3
31 32