From 1f33ed4844b5608bba5dd9dae4833c43f76fb8bd Mon Sep 17 00:00:00 2001 From: "Badr.NassLahsen" Date: Sun, 12 Jan 2025 22:34:23 +0100 Subject: [PATCH] code review --- CHANGELOG.md | 5 +++++ .../org/springdoc/core/converters/HateoasLinksConverter.java | 4 +--- .../org/springdoc/core/utils/SpringDocDataRestUtils.java | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7f90579..7a099d201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.8.3] - 2025-01-12 + +### Added +- #2851 - Refine condition, for ignoring types when using PolymorphicModelConverter + ## [2.8.2] - 2025-01-12 ### Added diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/HateoasLinksConverter.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/HateoasLinksConverter.java index 929115c4e..7fbfa420b 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/HateoasLinksConverter.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/HateoasLinksConverter.java @@ -69,8 +69,7 @@ public Schema resolve( Iterator chain ) { JavaType javaType = springDocObjectMapper.jsonMapper().constructType(type.getType()); - if (javaType != null) { - if (RepresentationModel.class.isAssignableFrom(javaType.getRawClass())) { + if (javaType != null && RepresentationModel.class.isAssignableFrom(javaType.getRawClass())) { Schema schema = chain.next().resolve(type, context, chain); String schemaName = schema.get$ref().substring(Components.COMPONENTS_SCHEMAS_REF.length()); Schema original = context.getDefinedModels().get(schemaName); @@ -84,7 +83,6 @@ public Schema resolve( arraySchema.set$ref(AnnotationsUtils.COMPONENTS_REF + "Links"); } return schema; - } } return chain.hasNext() ? chain.next().resolve(type, context, chain) : null; } diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/utils/SpringDocDataRestUtils.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/utils/SpringDocDataRestUtils.java index 636ccc229..281fd4eda 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/utils/SpringDocDataRestUtils.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/utils/SpringDocDataRestUtils.java @@ -249,8 +249,7 @@ private void updateRequestBodySchemaProperties(String key, Schema referencedSche if (entry.getValue().getItems()!=null) referencedSchema.addProperty(propId, new ArraySchema().items(new StringSchema())); else - referencedSchema.addProperty(propId, new StringSchema()); { - } + referencedSchema.addProperty(propId, new StringSchema()); } } }