Skip to content

Typesave serialization of openapi spec #978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2020

Conversation

raddatzk
Copy link
Contributor

@raddatzk raddatzk commented Dec 9, 2020

I was trying to integrate spring cloud config into our project and used the openAPI() bean for testing.

@Bean
@RefreshScope
public OpenAPI openAPI() {
    return new OpenAPI()
        .info(new Info()
                    .title("title)
                    .description("description")
                    .version("1.0.0")
         );
}

By default spring uses the proxy method TARGET_CLASS to generate a refreshScope bean which adds multiple properties which will be serialized by the objectMapper. Serialization of those properties results in an infinite loop and thus in a StackOverflowError.

With these changes the openAPI object will be serialized for the OpenAPI class, ignoring the properties added by spring.

Copy link
Collaborator

@bnasslahsen bnasslahsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @kevinraddatz for your contribution;

@bnasslahsen bnasslahsen merged commit 80f265a into springdoc:master Dec 11, 2020
@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants