Repository navigation
[core] Normalize bare null properties and array items in OAS 3.1 specs (#24520) - #25087
SubhamAshok wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Isn't the issue that Swashbuckle is heavily misusing Tailoring the normalization to odd behavior from Swashbuckle to me seems like a bad design choice (if anything, you would want some rule |
|
Thanks for the reviews @Mattias-Sehlstedt and @cubic-dev-ai! @Mattias-Sehlstedt While Swashbuckle emits this for dynamic/untyped fields, I have also audited the code and pushed commit
All unit tests and Checkstyle pass cleanly. |
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Thanks @cubic-dev-ai, great catch. Pushed commit
|
@SubhamAshok Looks right — that addresses the concern I raised. The key fix is that A few things I checked while reading it:
Unifying properties, array items, and map values through one helper keeps Tip: get faster answers by chatting with cubic’s review copilot in the review UI |
In OpenAPI 3.1 specifications, object properties and array items with a bare type: "null" or a $ref to a null-typed schema resolve to a fictional Null or ModelNull model in generators lacking a null type mapping. While map values were previously normalized to an any-type nullable schema, properties and array items were left untouched. Normalize bare null object properties and array item schemas to an any-type nullable schema under NORMALIZE_31SPEC, preserving schema metadata. Fixes OpenAPITools#24520
0c63bc0 to
7dc39e5
Compare
…for cpp-boost-beast - Add NORMALIZE_BARE_NULL_SCHEMAS normalizer rule (defaulted to true) under NORMALIZE_31SPEC. - Allow generators with native null support to opt out via normalizer configuration or custom normalizer overrides. - Override normalizeBareNullSchemaIfNeeded in CppBoostBeastOpenAPINormalizer and configure cpp-boost-beast client and server to preserve OAS 3.1 type: "null" as std::nullptr_t. - Add OpenAPINormalizerTest coverage for NORMALIZE_BARE_NULL_SCHEMAS=false.
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
…izer when rule enabled - Allow CppBoostBeastOpenAPINormalizer to delegate to super.normalizeBareNullSchemaIfNeeded when NORMALIZE_BARE_NULL_SCHEMAS is enabled - Default NORMALIZE_BARE_NULL_SCHEMAS to false in CppBoostBeastModelCodegen and CppBoostBeastOpenAPINormalizer - Add tests in CompositionNormalizationTest verifying default preservation and opt-in normalization
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
…onTest - Move ModelUtils import below meta package imports - Wrap parseSpec lines to stay within 100 character line limit
PR checklist
mvn teston affected modules.mvn checkstyle:check.Description of the change
In OpenAPI 3.1 specifications, object properties and array items with a bare
type: "null"or a$refto a null-typed schema resolve to an ungenerated model (Nullin TypeScript,ModelNullin C# and other generators).While map values (
additionalProperties) were previously normalized to an any-type nullable schema in PR #23967, object properties and array items were left untouched.This change:
normalizePropertiesto an any-type nullable schema underNORMALIZE_31SPEC(copying metadata) after schema normalization runs.normalizeSchemaunderNORMALIZE_31SPEC(copying metadata).OpenAPINormalizerTestand end-to-end verification inTypeScriptAxiosClientCodegenTest.Summary by cubic
Fixes OAS 3.1 object properties and array items with a bare
type: "null"or a$refto a null-typed schema resolving to ungeneratedNull/ModelNullmodels.Bug Fixes
NORMALIZE_BARE_NULL_SCHEMASrule (on by default underNORMALIZE_31SPEC) converts bare null schemas to an any-type nullable schema, preserving metadata across$refchains and single-memberallOfwrappers.cpp-boost-beastopts out by default so OAS 3.1type: "null"still maps tostd::nullptr_t; it can opt in via normalizer configuration.nullable: falseis handled safely.cpp-boost-beastnormalizer tests verifying noNullmodels are emitted, and updates affected OAS 3.1 samples.Written for commit 8c07249. Summary will update on new commits.