Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
|
thanks for the PR cc @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) |
Sekator778
left a comment
There was a problem hiding this comment.
Reproduced #25463 on master, and this fixes Spring. The same bundled spec still gives @QueryValue(value="ids", defaultValue="null") in java-micronaut-server and java-micronaut-client. The same null check in AbstractJavaCodegen.toDefaultParameterValue fixed both in my run; would you move it there?
|
Thanks for reproducing this in both Micronaut generators. You were right: |
Fixes #25463
Problem
The source contract has an optional array query parameter with no default. The
openapi-yamlbundling pass emitsdefault: null; generating from that bundled contract can producedefaultValue = "null", changing the behavior of an omitted query parameter.Root cause
The bundled document represents the null default as a Jackson
NullNode.AbstractJavaCodegen.toDefaultParameterValuetreated that node as a value and stringified it. Spring and Micronaut Java generators use this shared conversion path.Solution
Null Jackson nodes are now treated as no parameter default in
AbstractJavaCodegen. A schema-local default takes precedence over the referenced schema default, preserving explicit$refsibling defaults such as the literal string"null".Regression coverage
The OpenAPI 3.1 fixture and Spring
spring-http-interfacetest cover null and absent defaults, explicit scalar and array defaults, literal string"null", and referenced schemas with and without a sibling override. The shared Java base conversion addresses the same behavior in Micronaut server and client.Compatibility
The behavior change applies to generators extending
AbstractJavaCodegen; non-Java generators and templates are unaffected.