Fix #3201, #3213 and #3202: validation mapping, path variable schema handling, and Boot 4 NPE#3218
Fix #3201, #3213 and #3202: validation mapping, path variable schema handling, and Boot 4 NPE#3218Neo1228 wants to merge 1 commit intospringdoc:mainfrom
Conversation
7f4834a to
d633484
Compare
|
As raised in #3201 with comment #3201 (comment) I would suggest that this reside within swagger-core. They are already responsible for the POJO validation interpretation, and since they have support for grouping it would be more suitable if all validation annotations had the same support for it. |
Moved validation interpretation to swagger-core as suggested. Added support for Positive/Negative/PositiveOrZero/NegativeOrZero in both grouped and no-group validation paths, with tests for schema mapping and non-loosening behavior when combined with stronger bounds. |
Summary
This PR addresses three related stability gaps in schema/parameter generation:
@Positive,@PositiveOrZero,@Negative,@NegativeOrZeroon schema properties.@PathVariable + @Schemain both OpenAPI 3.0 and 3.1 outputs.Changes
#3201
SchemaPropertyValidationConverter:springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SchemaPropertyValidationConverter.javaspringdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.javaspringdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app245/HelloController.javaspringdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app245/SpringDocApp245Test.javaspringdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app245.json#3213
@PathVariable + @Schema:springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app248/...springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v31/app248/...springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app248.jsonspringdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app248.json#3202
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/KotlinDeprecatedPropertyCustomizer.ktspringdoc-openapi-starter-common/src/test/java/org/springdoc/core/customizers/KotlinDeprecatedPropertyCustomizerTest.javaVerification
Ran and passed:
mvn -pl springdoc-openapi-starter-common "-Dtest=org.springdoc.core.customizers.KotlinDeprecatedPropertyCustomizerTest" testmvn -pl springdoc-openapi-starter-webmvc-api "-Dtest=test.org.springdoc.api.v30.app245.SpringDocApp245Test,test.org.springdoc.api.v31.app245.SpringDocApp245Test,test.org.springdoc.api.v31.app244.SpringDocApp244Test,test.org.springdoc.api.v30.app248.SpringDocApp248Test,test.org.springdoc.api.v31.app248.SpringDocApp248Test" test