Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
bnasslahsen committed Mar 27, 2024
1 parent 806187f commit cde2afa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.core.jackson.TypeNameResolver;
Expand Down Expand Up @@ -71,7 +70,6 @@
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springdoc.core.providers.JavadocProvider;
import org.springdoc.core.providers.ObjectMapperProvider;
import org.springdoc.core.utils.PropertyResolverUtils;

import org.springframework.beans.BeansException;
Expand Down Expand Up @@ -246,11 +244,8 @@ public OpenAPI build(Locale locale) {
}
else {
try {
ObjectMapper objectMapper = ObjectMapperProvider.createJson(springDocConfigProperties);

This comment has been minimized.

Copy link
@DennisBecker

DennisBecker Sep 18, 2024

This change breaks using java.time.Instant which results in not rendering requestBody objects. The usual used ObjectMapper in springdoc has many modules loaded but not within this class

ObjectMapper objectMapper = new ObjectMapper();
calculatedOpenAPI = objectMapper.readValue(objectMapper.writeValueAsString(openAPI), OpenAPI.class);
objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
Map extensionsClone = objectMapper.readValue(objectMapper.writeValueAsString(openAPI.getExtensions()), Map.class);
calculatedOpenAPI.extensions(extensionsClone);
}
catch (JsonProcessingException e) {
LOGGER.warn("Json Processing Exception occurred: {}", e.getMessage());
Expand Down Expand Up @@ -614,9 +609,9 @@ private Info resolveProperties(Info info, Locale locale) {

if(propertyResolverUtils.isResolveExtensionsProperties()){
Map<String, Object> extensionsResolved = propertyResolverUtils.resolveExtensions(locale, info.getExtensions());
info.setExtensions(extensionsResolved);
info.setExtensions(extensionsResolved);
}

return info;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@
"components": {
"schemas": {
"FeedResponse": {
"type": "object",
"properties": {
"_links": {
"type": "object",
"properties": {
"next": {
"$ref": "#/components/schemas/Link"
Expand Down Expand Up @@ -139,4 +137,4 @@
}
}
}
}
}

0 comments on commit cde2afa

Please sign in to comment.