[Spring-http-interface] JSpecify: fix api argument with default value - #24740
[Spring-http-interface] JSpecify: fix api argument with default value#24740jpfinne wants to merge 32 commits into
Conversation
merge master
|
@jpfinne is this ready for review? If not, what remains to be done? I'd like to get this fixed ASAP, so if needed I can create a PR myself |
@anthonyvdotbe I've simplified the nullable annotations to easily distinguish between model and api. We are close to the release date... Contact wing328 to accelerate the merge |
There was a problem hiding this comment.
All reported issues were addressed across 17 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
@jpfinne I see the AI bot suggested changes, so I'll let you resolve those first |
@anthonyvdotbe done |
anthonyvdotbe
left a comment
There was a problem hiding this comment.
In general, I'd prefer a more focused PR that just fixes this particular issue and leaves the refactoring for another PR.
fix #24737
For spring-http-interface only: the api arguments with default value are annotated with
@Nullable.Spring will inject the specified default value if null is provided.
Small refactoring of the spring templates:
nullableAnnotation.mustacheis kept for model onlynullableAnnotation_apiArgument.mustacheis introduced for all api arguments (queryParams, pathParams, headerParams)This make it easier to redefine nullableAnnotation_apiArgument for spring-http-interface to handle the default parameters.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
@cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08) @KannaKim (2026/07)
Summary by cubic
Marks
spring-http-interfaceAPI parameters with a default value as@Nullableand fixes JSpecify handling to avoid duplicate@Nullable. Previously, defaulted@RequestParam/@RequestHeaderwere not nullable; now they are forspring-http-interfaceonly. No runtime change—Spring still injects the default when null is provided.nullableAnnotation_apiArgument.mustacheplus aspring-http-interfaceoverride, and switches body, query, header, cookie, and path templates to use it.nullableAnnotation.mustacheto pick JSpecify cleanly and updatesnullableAnnotation_jspecify.mustacheto prevent double@Nullableand handle default vs non-default cases.spring-http-interfaceand regenerates samples.Migration
org.jspecify:jspecifyis on the classpath.Written for commit 4e821b1. Summary will update on new commits.