Skip to content

Typesave serialization of openapi spec#978

Merged
bnasslahsen merged 1 commit intospringdoc:masterfrom
raddatzk:master
Dec 11, 2020
Merged

Typesave serialization of openapi spec#978
bnasslahsen merged 1 commit intospringdoc:masterfrom
raddatzk:master

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