Fix kotlin-spring required property validation
KO
8d ago+2185+2185+0123456789012345678901234567890123456789-10-10-01234567890123456789
Required kotlin-spring properties now generate as nullable fields with @field:NotNull so Bean Validation can surface missing values instead of Jackson failing at constructor time. Includes regression coverage for the required-nullable 4-state test case.
Summary by cubic
Fixes kotlin-spring required property handling to avoid early Jackson failures while keeping the default model contract. By default, required fields stay non‑nullable and do not get @field:NotNull; enabling nullableRequiredForBeanValidation makes them nullable and adds @field:NotNull so Bean Validation catches missing values.
-
Bug Fixes
- With
useBeanValidation, required properties keep@JsonProperty(required = true)and remain non‑nullable without@NotNullby default. - Added
nullableRequiredForBeanValidation(default false) to emit?and@field:NotNullfor required fields; updated docs and tests for the four required/nullable scenarios, including the opt‑in path.
- With
-
New Features
- Added a Spring Boot 3 Petstore compilation sample and config (
kotlin-springboot-3-nullable-required) to exercisenullableRequiredForBeanValidationwithuseBeanValidation=true, verifying nullable types plus@field:NotNullcompile correctly.
- Added a Spring Boot 3 Petstore compilation sample and config (