Skip to content

Fix #3201, #3213 and #3202: validation mapping, path variable schema handling, and Boot 4 NPE#3218

Closed
Neo1228 wants to merge 1 commit intospringdoc:mainfrom
Neo1228:fix/3201-3213-3202
Closed

Fix #3201, #3213 and #3202: validation mapping, path variable schema handling, and Boot 4 NPE#3218
Neo1228 wants to merge 1 commit intospringdoc:mainfrom
Neo1228:fix/3201-3213-3202

Conversation

@Neo1228
Copy link

@Neo1228 Neo1228 commented Feb 14, 2026

Summary

This PR addresses three related stability gaps in schema/parameter generation:

  1. Jakarta @Positive validation is not present in Swagger #3201: Add Jakarta Validation mapping for @Positive, @PositiveOrZero, @Negative, @NegativeOrZero on schema properties.
  2. @PathVariable with Spring Type Conversion loses @Schema definition with 2.8.15 #3213: Add regression coverage for @PathVariable + @Schema in both OpenAPI 3.0 and 3.1 outputs.
  3. Cannot invoke "io.swagger.v3.oas.models.media.Schema.getName()" because "subtypeModel" is null #3202: Prevent NPE propagation in Kotlin deprecated property customization path (Boot 4-related subtype resolution edge case).

Changes

#3201

  • Added SchemaPropertyValidationConverter:
    • springdoc-openapi-starter-common/src/main/java/org/springdoc/core/converters/SchemaPropertyValidationConverter.java
  • Registered converter in Spring configuration:
    • springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocConfiguration.java
  • Added regression test fixtures:
    • springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app245/HelloController.java
    • springdoc-openapi-starter-webmvc-api/src/test/java/test/org/springdoc/api/v30/app245/SpringDocApp245Test.java
    • springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app245.json

#3213

  • Added reproducer/regression tests for @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/...
  • Added expected results:
    • springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.0.1/app248.json
    • springdoc-openapi-starter-webmvc-api/src/test/resources/results/3.1.0/app248.json

#3202

  • Added defensive handling in Kotlin customizer to avoid NPE propagation from downstream resolver:
    • springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers/KotlinDeprecatedPropertyCustomizer.kt
  • Added unit test:
    • springdoc-openapi-starter-common/src/test/java/org/springdoc/core/customizers/KotlinDeprecatedPropertyCustomizerTest.java

Verification

Ran and passed:

  • mvn -pl springdoc-openapi-starter-common "-Dtest=org.springdoc.core.customizers.KotlinDeprecatedPropertyCustomizerTest" test
  • mvn -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

@Mattias-Sehlstedt
Copy link
Contributor

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.

@Neo1228
Copy link
Author

Neo1228 commented Feb 14, 2026

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.

@Neo1228 Neo1228 closed this Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants