Code Monkey home page Code Monkey logo

springdoc-openapi-demos's Introduction

Octocat Build Status Quality Gate Known Vulnerabilities Stack Exchange questions

IMPORTANT: springdoc-openapi v1.8.0 is the latest Open Source release supporting Spring Boot 2.x and 1.x.

An extended support for springdoc-openapi v1 project is now available for organizations that need support beyond 2023.

For more details, feel free to reach out: [email protected]

springdoc-openapi is on Open Collective. If you ❤️ this project consider becoming a sponsor.

This project is sponsored by

  

Table of Contents

Introduction

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 library automatically generates documentation in JSON/YAML and HTML formatted pages. The generated documentation can be complemented using swagger-api annotations.

This library supports:

  • OpenAPI 3
  • Spring-boot v3 (Java 17 & Jakarta EE 9)
  • JSR-303, specifically for @NotNull, @Min, @Max, and @Size.
  • Swagger-ui
  • OAuth 2
  • GraalVM native images

The following video introduces the Library:

For spring-boot v3 support, make sure you use springdoc-openapi v2

This is a community-based project, not maintained by the Spring Framework Contributors (Pivotal)

Getting Started

Library for springdoc-openapi integration with spring-boot and swagger-ui

  • Automatically deploys swagger-ui to a Spring Boot 3.x application
  • Documentation will be available in HTML format, using the official swagger-ui jars.
  • The Swagger UI page should then be available at http://server: port/context-path/swagger-ui.html and the OpenAPI description will be available at the following url for json format: http://server:port/context-path/v3/api-docs
    • server: The server name or IP
    • port: The server port
    • context-path: The context path of the application
  • Documentation can be available in yaml format as well, on the following path: /v3/api-docs.yaml
  • Add the springdoc-openapi-ui library to the list of your project dependencies (No additional configuration is needed):
   <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>last-release-version</version>
   </dependency>
  • This step is optional: For custom path of the swagger documentation in HTML format, add a custom springdoc property, in your spring-boot configuration file:
# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html

Spring-boot with OpenAPI Demo applications.

Branching

Integration of the library in a Spring Boot 3.x project without the swagger-ui:

  • Documentation will be available at the following url for json format: http://server: port/context-path/v3/api-docs
    • server: The server name or IP
    • port: The server port
    • context-path: The context path of the application
  • Documentation will be available in yaml format as well, on the following path : /v3/api-docs.yaml
  • Add the library to the list of your project dependencies. (No additional configuration is needed)
   <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
      <version>last-release-version</version>
   </dependency>
  • This step is optional: For custom path of the OpenAPI documentation in Json format, add a custom springdoc property, in your spring-boot configuration file:
# /api-docs endpoint custom path
springdoc.api-docs.path=/api-docs
  • This step is optional: If you want to disable springdoc-openapi endpoints, add a custom springdoc property, in your spring-boot configuration file:
# disable api-docs
springdoc.api-docs.enabled=false

Error Handling for REST using @ControllerAdvice

To generate documentation automatically, make sure all the methods declare the HTTP Code responses using the annotation: @ResponseStatus.

Adding API Information and Security documentation

The library uses spring-boot application auto-configured packages to scan for the following annotations in spring beans: OpenAPIDefinition and Info. These annotations declare, API Information: Title, version, licence, security, servers, tags, security and externalDocs. For better performance of documentation generation, declare @OpenAPIDefinition and @SecurityScheme annotations within a Spring managed bean.

spring-webflux support with Annotated Controllers

  • Documentation can be available in yaml format as well, on the following path : /v3/api-docs.yaml
  • Add the library to the list of your project dependencies (No additional configuration is needed)
   <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
      <version>last-release-version</version>
   </dependency>
  • This step is optional: For custom path of the swagger documentation in HTML format, add a custom springdoc property, in your spring-boot configuration file:
# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html

The springdoc-openapi libraries are hosted on maven central repository. The artifacts can be viewed accessed at the following locations:

Releases:

Snapshots:

Acknowledgements

Contributors

springdoc-openapi is relevant and updated regularly due to the valuable contributions from its contributors.

Thanks you all for your support!

Additional Support

  • Spring Team - Thanks for their support by sharing all relevant resources around Spring projects.
  • JetBrains - Thanks a lot for supporting springdoc-openapi project.

JenBrains logo

springdoc-openapi-demos's People

Contributors

aanno avatar ajeans avatar bnasslahsen avatar chebetos avatar kfirfer avatar phxism163 avatar rubix982 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

springdoc-openapi-demos's Issues

gateway-service

gateway-service

@Bean
	@Lazy(false)
	public List<GroupedOpenApi> apis(SwaggerUiConfigParameters swaggerUiConfigParameters, RouteDefinitionLocator locator) {
		List<GroupedOpenApi> groups = new ArrayList<>();
		List<RouteDefinition> definitions = locator.getRouteDefinitions().collectList().block();
		for (RouteDefinition definition : definitions) {
			System.out.println("id: " + definition.getId()+ "  "+definition.getUri().toString());
		}
		definitions.stream().filter(routeDefinition -> routeDefinition.getId().matches(".*-service")).forEach(routeDefinition -> {
			String name = routeDefinition.getId().replaceAll("-service", "");
			swaggerUiConfigParameters.addGroup(name);
			GroupedOpenApi.builder().pathsToMatch("/" + name + "/**").group(name).build();
		});
		return groups;
	}

groups why not add GroupedOpenApi ?

Demo springdoc-openapi-oauth2 doesn't work

Describe the bug
demo of https://github.com/springdoc/springdoc-openapi-demos/tree/master/springdoc-openapi-oauth2 doesn't works for me.

To Reproduce

Note: when I added "*" to redirect urls in keycloak config, then keycloak login screen was opened. I was able to fill credentials [email protected] / 123. But then I was redirected to wrong url: http://localhost:8081/oauth2-redirect.html?state=RnJpIEF1ZyAxMyAyMDIxIDE0OjE0OjM4IEdNVCswMjAwIChDZW50cmFsIEV1cm9wZWFuIFN1bW1lciBUaW1lKQ%3D%3D&session_state=3808135b-c54b-4ca2-862e-5e2bf2f53a11&code=0ae8e608-e5ae-4eb2-b627-ea0f6da9d7f1.3808135b-c54b-4ca2-862e-5e2bf2f53a11.b88ce206-63d6-43b6-87c9-ea09d8c02f32

which produced 404

Expected behavior

Screenshots
image

Using simple index.html under static does not work

Hi All,

I have following problem.

After this I added

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.1.44</version>
</dependency>

Is there anything I should configure?

BTW. Trying the same thing with SpringFox 2.9.2 works without any problems. I could get the swagger-ui and also the index.html. But I need to configure following:

@Configuration
@EnableSwagger2
public class SpringFoxConfig {
	@Bean
	public Docket api() {
		return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
				.paths(PathSelectors.any()).build();
	}
}

Thanks a lot.

Question about custom headers

Do you have an example of customer header where it shows the schema of the custom header? It is showing it as a header but does not show that schema at all even though it has the @Schema annotation.

Readme demos are not available

Describe the bug
It appears that the demos linked in the front page of this repo are not available (as of today, December 28th). When you click on them you get this message 404 Not Found: Requested route ('springdoc-openapi-test-app2-rested-ardvark.eu-de.mybluemix.net') does not exist.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to the repo page
  2. Scroll down to demo section
  3. Click any of the demos

See the attached video

  • What version of spring-boot you are using?
    • N/A
  • What modules and versions of springdoc-openapi are you using?
    • N/A
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    • N/A
  • Provide with a sample code (HelloController) or Test that reproduces the problem
    • N/A

Expected behavior

  • A clear and concise description of what you expected to happen.
    • I don't know what the demo does, but I expected the demo to appear instead of an error.
  • What is the expected result using OpenAPI Description (yml or json)?
    • N/A

Screenshots
I'll do you one better. Here's a video:

WFRhBTnL8i.mp4

Additional context
Add any other context about the problem here.
I'm new around here. Thanks for all the effort so far with this project.

org.sprindoc.demo.app3 BeanUtils.copyProperties method does copy all properties

When I start org.sprindoc.demo.app3 and post tweet. It gets TweetDTO, and returns Tweet model where id and text are null.

For example, tweetDto is:

{
  "id": "2",
  "text": "ASDSAS",
  "createdAt": "2020-01-20T10:13:08.650Z"
}. 

It will return, tweet model:

{
  "id": null,
  "text": null,
  "createdAt": "2020-01-20T10:26:13.589+0000"
}

open api demos links do not working

All links in page accessible from https://github.com/springdoc/springdoc-openapi-demos/tree/master does not working:
Demo Spring Boot 2 Web MVC with OpenAPI 3.
Demo Spring Boot 2 WebFlux with OpenAPI 3.
Demo Spring Boot 1 Web MVC with OpenAPI 3.
Demo Spring Boot 2 WebFlux with Functional endpoints OpenAPI 3.

With more details, all links return an error like this "404 Not Found: Requested route ('springdoc-openapi-test-app2-rested-ardvark.eu-de.mybluemix.net') does not exist".

GAP issue/bug : How to add openapi annotation to RouterFunctions.route() / webflux ?

I have the below webflux implementation.

How/Where to add openapi annotation for this?

@Configuration
public class RxRouteConfig {


    @Bean
    public RouterFunction<ServerResponse> routerFunction(RxService rxService, Service service) {
        return RouterFunctions.route(
                RequestPredicates.GET("/webflux/customer/all"), rxService::getAllCustomers) //.and(accept(MediaType.APPLICATION_JSON))
                .andRoute(GET("/webflux/customer/{id}"), rxService::findCustomerById)
                .andRoute(POST("/webflux/customers/similar").and(contentType(MediaType.APPLICATION_JSON)), rxService::findCustomerLike)
                .andRoute(GET("/webflux/customer/{id}/events"), rxService::getEvents)
                ;
    }
}

Broken dependencies

Hi

I've cloned this repository today, in order to test the OAuth demo

Unfortunately, this demo is not working anymore.

The clone have been performed after the latest v3.1.5 release of springdoc-openapi-demos

I've failed starting the authorization server due to a broken dependency between KeyCloak and Liquibase :

  • KeyCloak version 11.0.2 is specified by the project's pom, but it's requiring a getInstance method in the liquibase ServiceLocator class (or interface).
  • Unfortunately this getInstance method is not available anymore in Liquibase >= 4.x
  • It's a Liquibase v4.3.x that the default spring dependencies BOM is pointing to now.

I've tried to specify a Liquibase v3.10.3, the one prior to the problematic 4.x, but doing so lead to other KeyCloak configuration "missing provider" troubles, and I'm not familiar at all with KeyCloak, so I can't solve those troubles by myself in a decent amount of time 😝

Thanks in advance if you find time to update dependencies !

Example code for Customizing swagger static resources

Would you mind adding a sample working for customizing the swagger static resources. The sample given in the spring doc does not seem to work on the css file. It is restricting itself to the main JS file. Thanks.

CORS policy for springdoc-openapi-microservices

Hi,

When testing the springdoc-openapi-microservices, I get an error when I want to test any endpoint with the "Try it out" button:
Access to fetch at 'http://10.64.141.162:8091/' from origin 'http://localhost:8060' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Is it supposed to be working? (if yes, then I guess it's my way to run this locally which is wrong...)
Please excuse me if it's not the correct place to ask this question.

How we set global header using spingboot 3.0.1

I tried like but its still not appearing on swagger

@Bean
    public OpenAPI myOpenAPI() {
        final String securitySchemeName = "Bearer Token";
        return new OpenAPI()
                .components(new Components()
                        .addSecuritySchemes(securitySchemeName, new SecurityScheme()
                                .type(SecurityScheme.Type.HTTP)
                                .scheme("bearer")
                                .bearerFormat("JWT"))
                        .addHeaders("Version", new Header()
                                .description("version header")
                                .required(true)
                                .schema(new StringSchema())))
                .addSecurityItem(new SecurityRequirement().addList(securitySchemeName))
                .addSecurityItem(new SecurityRequirement().addList("Version"))
                ;
    }

Swagger UI Not working with Azure function

I have tried running spring-cloud-function-webmvc app. and hit the /swagger-ui URL. I can see swagger UI comming up,
But when i put Azure function plugin in pom. The swagger UI stops comming you.
I have attached modified version of this working project with Azure function here.

spring-cloud-function-webmvc.zip

now when i start this project, it scans the end point correctly. Below is the startup logs:
image

But hitting the Swagger url gives the following error :
URL: http://localhost:8080/api/swagger-ui.html

image

Is swagger UI not yet supported with Azure function?

Let me know if further info is required.

secure microservice

Hello,

Here it is for 1 year (with cuts because not always the time), I try to set up a microservice project with spring boot.

I use webflux, gateway, eureka, admin config, ...

But I still haven't understood how to secure certain route (gateway -> microservice A -> api / company (forbid access), but allow (gateway -> api / planete (allow access)) for example.

I don't know how to go about securing my microservice architecture. I want to do something simple but scalable over time.

My goal is to limit the rest authorization of my microservices and to manage the users who connect to thymeleaf.

Could you help me ? (to know that I learned spring boot on my own) but I am stuck on the security part ... (I am French and I use a translator)

thank you

SwaggerUrl abnormal parameter setting

hello,I have a question
This is what I built SwaggerUrl object,I mean i will got this url
image

but like this, I ended up with this, After carefully comparing the documentation with your source code, I can't find out why this is the case, Could you give me an answer, please ? thanks
image

A path parameter declaration inside of an operation leads to wrong api-doc

Hi,

we use in our project spring boot 3.0.2 and springdoc-openapi (springdoc-openapi-starter-webmvc-ui) 2.0.2.

Since the springdoc-openapi 2.0.1 there is a following issue.
This declaration

 @Operation(summary = "test update book",
            parameters = {
                    @Parameter(name = "id", description = "Id of a book", in = ParameterIn.PATH, example = "1" )
            }
    )
@PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public BookDto updateBook(
@PathVariable long id,
@RequestBody BookEditDto bookEditDto) {
return new BookDto();
}

Leads to this api-doc result:

"parameters":[
	{
		"name": "id",
		"in": "path",
		"description": "Id of a book",
		"required": true,
		"example": 1
	},
	{
		"name": "arg0",
		"in": "path",
		"required": true,
		"schema": {
			"type": "integer",
			"format": "int64"
		}
	}
]

If a @Parameter declaration will be moved to the method definition like this

@Operation( summary = "test update book  )
@PutMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public BookDto updateBook(
@Parameter(name = "id", description = "Id of a book", in = ParameterIn.PATH, example = "1" )
@PathVariable long id,
@RequestBody BookEditDto bookEditDto) {
return new BookDto();
}

Then the api-doc result is correct:

"parameters":[
	{
		"name": "id",
		"in": "path",
		"description": "Id of a book",
		"required": true,
		"schema": {
			"type": "integer",
			"format": "int64"
		},
		"example": 1
	}
]

The question is: why the @Parameter declaration inside of @Operation does not work properly anymore?

Thank you in advance!

Kind regards,
Dimitri Giwerzew

2.x samples

Is your feature request related to a problem? Please describe.
I have dificulties to migrate my projects to 2.0.0-M6 (security issues)

Describe the solution you'd like
I'd like to have spring-boot 3 samples (with web security config and openpi-ui) I could get inspiration from

openapi3 integration with webflux functional way is not working

I am trying to integrate openapi3 with reactive webflux functional endpoints. but i am always getting the error message "invalid version" from andother route configuration.andOther(route(RequestPredicates.all(), errorHandler::invalidVersion)). If i remove that validation swagger is working but the version validation is failing.below is my custom router.

route()
        .add((RouterFunction<ServerResponse>) routerFunctionMappings
            .stream()
            .map(routemapping -> Tuples.of(routemapping.getVersion(),
                routeForVersion(routemapping.getRouteMapping())))
            .reduce(Tuples.of("test", route()), (tupel2RouteFunction1, tupel2RouteFunction2) ->
                Tuples.of("test", tupel2RouteFunction1
                    .getT2()
                    .path(
                        tupel2RouteFunction2.getT1(),
                        () -> (RouterFunction<ServerResponse>) tupel2RouteFunction2
                            .getT2()
                            .build()
                            .andOther(
                                route(RequestPredicates.all(), handler::validate)))))
            .getT2()
            .build()
            .andOther(route(RequestPredicates.all(), errorHandler::invalidVersion)))
        .build()
        .filter(filterFunction());

Please help me how to resolve this to make both validation and swagger works.

How to serve API spec from multiple services

Hi Team,

We have a API Gateway and we want to serve the documentation for multiple microservices behind it.
We are using Spring Boot 2.2.x.
We tried the springdoc.swagger-ui.urls[0].url but the missing CORS headers block us.
Is there any other way to do that.
May you please point us some other way/example how to achieve that.

All the best

will azure adapter be supported?

I am working on azure functions with spring boot 3 and Java 17 and I am trying to get a proper OpenAPI documentation created.

I played around with the config you demonstrate in https://github.com/springdoc/springdoc-openapi-demos/tree/master/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc and adapted it with spring docs v2, in general it is working .
But when I try to use it with
com.microsoft.azure:azure-functions-maven-plugin it is not working, as it clashes with the web dependency spring-cloud-starter-function-web after deployment to azure. The setup is similar to https://github.com/Azure-Samples/hello-spring-function-azure/blob/master/pom.xml

Will there be a support for functions without the function-web or function-webflux dependency?

thank you for your effort!
BR
Alex

When a header is in the request mapping and in the parameters, throws an error

Having this code:

	@GetMapping(path = "/persons", headers = {"lastName"})
	public List<Person> findByLastNameByHeader(@RequestHeader("lastName") @NotBlank @Size(max = 10) String lastName) {

This error is thrown:

2021-06-09 20:37:09.383 ERROR 33320 --- [nio-8080-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Duplicate key class Parameter {
    name: lastName
    in: query
    description: null
    required: true
    deprecated: null
    allowEmptyValue: null
    style: null
    explode: null
    allowReserved: null
    schema: class StringSchema {
        class Schema {
            type: string
            format: null
            $ref: null
            description: null
            title: null
            multipleOf: null
            maximum: null
            exclusiveMaximum: null
            minimum: null
            exclusiveMinimum: null
            maxLength: 10
            minLength: 0
            pattern: null
            maxItems: null
            minItems: null
            uniqueItems: null
            maxProperties: null
            minProperties: null
            required: null
            not: null
            properties: null
            additionalProperties: null
            nullable: null
            readOnly: null
            writeOnly: null
            example: null
            externalDocs: null
            deprecated: null
            discriminator: null
            xml: null
        }
    }
    examples: null
    example: null
    content: null
    $ref: null
}] with root cause

java.lang.IllegalStateException: Duplicate key class Parameter {
    name: lastName
    in: query
    description: null
    required: true
    deprecated: null
    allowEmptyValue: null
    style: null
    explode: null
    allowReserved: null
    schema: class StringSchema {
        class Schema {
            type: string
            format: null
            $ref: null
            description: null
            title: null
            multipleOf: null
            maximum: null
            exclusiveMaximum: null
            minimum: null
            exclusiveMinimum: null
            maxLength: 10
            minLength: 0
            pattern: null
            maxItems: null
            minItems: null
            uniqueItems: null
            maxProperties: null
            minProperties: null
            required: null
            not: null
            properties: null
            additionalProperties: null
            nullable: null
            readOnly: null
            writeOnly: null
            example: null
            externalDocs: null
            deprecated: null
            discriminator: null
            xml: null
        }
    }
    examples: null
    example: null
    content: null
    $ref: null
}
	at org.springdoc.core.AbstractRequestService.lambda$getParameterLinkedHashMap$5(AbstractRequestService.java:297) ~[springdoc-openapi-common-1.5.9.jar:1.5.9]
	at java.base/java.util.HashMap.merge(HashMap.java:1297) ~[na:na]
	at java.base/java.util.stream.Collectors.lambda$toMap$68(Collectors.java:1658) ~[na:na]
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[na:na]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
	at org.springdoc.core.AbstractRequestService.getParameterLinkedHashMap(AbstractRequestService.java:293) ~[springdoc-openapi-common-1.5.9.jar:1.5.9]
	at org.springdoc.core.AbstractRequestService.build(AbstractRequestService.java:277) ~[springdoc-openapi-common-1.5.9.jar:1.5.9]
	at org.springdoc.api.AbstractOpenApiResource.calculatePath(AbstractOpenApiResource.java:389) ~[springdoc-openapi-common-1.5.9.jar:1.5.9]
	at org.springdoc.api.AbstractOpenApiResource.calculatePath(AbstractOpenApiResource.java:524) ~[springdoc-openapi-common-1.5.9.jar:1.5.9]
	at org.springdoc.webmvc.api.OpenApiResource.calculatePath(OpenApiResource.java:261) ~[springdoc-openapi-webmvc-core-1.5.9.jar:1.5.9]
	at org.springdoc.webmvc.api.OpenApiResource.getPaths(OpenApiResource.java:213) ~[springdoc-openapi-webmvc-core-1.5.9.jar:1.5.9]
	at org.springdoc.api.AbstractOpenApiResource.getOpenApi(AbstractOpenApiResource.java:287) ~[springdoc-openapi-common-1.5.9.jar:1.5.9]
	at org.springdoc.webmvc.api.OpenApiResource.openapiJson(OpenApiResource.java:176) ~[springdoc-openapi-webmvc-core-1.5.9.jar:1.5.9]
	at org.springdoc.webmvc.api.OpenApiWebMvcResource.openapiJson(OpenApiWebMvcResource.java:116) ~[springdoc-openapi-webmvc-core-1.5.9.jar:1.5.9]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.7.jar:5.3.7]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.46.jar:4.0.FR]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.7.jar:5.3.7]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.46.jar:4.0.FR]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.7.jar:5.3.7]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.7.jar:5.3.7]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.7.jar:5.3.7]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.7.jar:5.3.7]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.7.jar:5.3.7]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.7.jar:5.3.7]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
	at java.base/java.lang.Thread.run(Thread.java:834) ~[na:an]

springdoc-openapi giving 404 with spring 6

I am trying to migrate from springfox to openapi because springfox swagger2 is not working with Jakarta. I am using spring 6 and followed this https://springdoc.org/v2/ to migrate. Below are the dependencies added. It is giving me 404 with swagger-ui.html.

org.springdoc springdoc-openapi-starter-webmvc-ui 2.0.4 org.springdoc springdoc-openapi-starter-webmvc-api 2.0.4 org.springdoc springdoc-openapi-starter-webflux-ui 2.0.4

How to use serializers?

Hi!

Is there any way to make this library to apply a serialization for any field of DTO?

Consider I have a DTO:

@lombok.Data
class MoneyDto {

   BigDecimal amount;
   Currency currency;

}

How to make this library to serialize currency as String?
I can set up an ObjectMapper to do it. But it will not be reflected in generated Swagger Docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.