diff --git a/pom.xml b/pom.xml index d4daa2c..5bc3090 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.3.8 + 3.4.2 @@ -86,7 +86,7 @@ org.springdoc springdoc-openapi-starter-webmvc-ui - 2.6.0 + 2.8.5 diff --git a/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullableCustomizer.java b/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullableCustomizer.java index 26a2b53..48574c5 100644 --- a/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullableCustomizer.java +++ b/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullableCustomizer.java @@ -18,9 +18,12 @@ public void customise(OpenAPI openApi) { if (((Schema) schema).getProperties() != null) { var requiredProperties = new ArrayList(); ((Schema) schema).getProperties().forEach((propertyName, property) -> { - if (property.getNullable() == null || !property.getNullable()) { + if (property.getTitle() == null || !property.getTitle().equals("NULLABLE")) { requiredProperties.add(propertyName); } + if (property.getTitle() != null && property.getTitle().equals("NULLABLE")) { + property.setTitle(null); + } }); schema.setRequired(requiredProperties); } diff --git a/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullablePropertyCustomizer.java b/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullablePropertyCustomizer.java index a8fdf57..47b0cbf 100644 --- a/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullablePropertyCustomizer.java +++ b/src/main/java/it/aboutbits/springboot/toolbox/swagger/customization/default_not_null/NullablePropertyCustomizer.java @@ -31,7 +31,7 @@ public Schema customize(Schema property, AnnotatedType annotatedType) { if (annotatedType.getCtxAnnotations() != null && Arrays.stream(annotatedType.getCtxAnnotations()) .anyMatch(a -> "Nullable".equals(a.annotationType().getSimpleName()))) { - property.setNullable(true); + property.setTitle("NULLABLE"); } return property;