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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
/**
* The type Abstract open api resource.
* @author bnasslahsen
* @author kevinraddatz
*/
public abstract class AbstractOpenApiResource extends SpecFilter {

Expand Down Expand Up @@ -1033,9 +1034,9 @@ protected String writeYamlValue(OpenAPI openAPI) throws JsonProcessingException
YAMLFactory factory = (YAMLFactory) objectMapper.getFactory();
factory.configure(Feature.USE_NATIVE_TYPE_ID, false);
if (!springDocConfigProperties.isWriterWithDefaultPrettyPrinter())
result = objectMapper.writeValueAsString(openAPI);
result = objectMapper.writerFor(OpenAPI.class).writeValueAsString(openAPI);
else
result = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(openAPI);
result = objectMapper.writerWithDefaultPrettyPrinter().forType(OpenAPI.class).writeValueAsString(openAPI);
return result;
}

Expand Down Expand Up @@ -1096,9 +1097,9 @@ protected String writeJsonValue(OpenAPI openAPI) throws JsonProcessingException
if (springDocConfigProperties.isWriterWithOrderByKeys())
sortOutput(objectMapper);
if (!springDocConfigProperties.isWriterWithDefaultPrettyPrinter())
result = objectMapper.writeValueAsString(openAPI);
result = objectMapper.writerFor(OpenAPI.class).writeValueAsString(openAPI);
else
result = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(openAPI);
result = objectMapper.writerWithDefaultPrettyPrinter().forType(OpenAPI.class).writeValueAsString(openAPI);
return result;
}

Expand Down