Skip to content

fix: normalize OAS 3.1 schemas with type:[object,"null"] to set nullable:true correctly#24140

Open
Picazsoo wants to merge 19 commits into
OpenAPITools:masterfrom
Picazsoo:bugfix/fix-nullable-open-api-3.1
Open

fix: normalize OAS 3.1 schemas with type:[object,"null"] to set nullable:true correctly#24140
Picazsoo wants to merge 19 commits into
OpenAPITools:masterfrom
Picazsoo:bugfix/fix-nullable-open-api-3.1

Conversation

@Picazsoo

@Picazsoo Picazsoo commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

In OAS 3.1, nullability is expressed as a type array, e.g. type: [object, "null"]. The existing NORMALIZE_31SPEC normalization path failed to handle schemas that used this syntax and also had properties - it would not set nullable: true.

The downstream effect: a $ref to such a schema in Kotlin-Spring would incorrectly receive @field:JsonSetter(nulls = Nulls.FAIL), which is wrong for nullable fields. This is how this bug was identified in #24139. Hence this fixes #24139.

I had pretty big issues with failing CircleCI on node2. I discussed with github copilot how to fix the issues and the current approach using setup-cpp was flagged as outdated and unnecessary. I implemented the suggested fix and it fixed the issues right away. I am tagging the C++ comittee to take a look at these unrelated changes as my experience with C/C++ is extremely limited - @ravinikam, @stkrwork, @etherealjoy, @MartinDelille, @muttleyxd, @aminya

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request. - tagging @wing328 as there is no specific CORE or Normalizer technical committee (maybe it would be a good idea to have one?)

Summary by cubic

Sets nullable:true for OAS 3.1 schemas whose type arrays include "null" while preserving properties, and makes Kotlin Spring skip @JsonSetter(nulls = Nulls.FAIL) on nullable $ref.
Stabilizes C++ CI by installing build tools via apt, adding "." to cmake, forcing clang via CMAKE_C_COMPILER/CMAKE_CXX_COMPILER, and removing unnecessary ninja-build.

Written for commit b7807bd. Summary will update on new commits.

Review in cubic

Picazsoo added 4 commits June 26, 2026 17:57
…set nullable:true correctly and preserve properties"

This reverts commit cb5aa49.
… set nullable:true correctly and preserve properties"

This reverts commit b0d188d.
Picazsoo and others added 15 commits June 27, 2026 14:55
…g "null" set nullable:true correctly and preserve properties""

This reverts commit 74eb333.
… set nullable:true correctly and preserve properties"

This reverts commit b0d188d.
…set nullable:true correctly and preserve properties"

This reverts commit cb5aa49.
…et nullable:true correctly"

This reverts commit 29c6207.
…set nullable:true correctly"

This reverts commit f741e48.
… set nullable:true correctly and preserve properties"

This reverts commit cf56cf5.
…g "null" set nullable:true correctly and preserve properties""

This reverts commit 500d93a.
…ng "null" set nullable:true correctly and preserve properties""

This reverts commit 7f0b9a6.
…failures

setup-cpp internally adds ppa:ubuntu-toolchain-r/test, which fetches an
external GPG key. This occasionally times out in CI, causing the node2 job
to fail with 'Failed to install the llvm' even though the code is fine.

Replace the wget/setup-cpp/source chain with a single apt-get install of
clang, cmake, and ninja-build from Ubuntu's own repositories.  No PPAs, no
external GPG key fetches, no transient network failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tsdk pom.xml

CMake warns 'No source or binary directory provided' when called without
a positional source-dir argument or -S/-B flags. The warning notes this
will become a fatal error in future CMake releases.

Add '.' as the first cmake argument to explicitly set the source directory
to the current directory, which matches the implicit behaviour and silences
the warning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CI node2 job installs clang via apt, but cmake was defaulting to GCC
because no compiler was explicitly specified. Add CMAKE_C_COMPILER=clang
and CMAKE_CXX_COMPILER=clang++ to match the original intent of the setup,
which previously used setup-cpp --compiler llvm.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The cpp-restsdk pom.xml uses cmake + make (Unix Makefiles generator).
Ninja is never invoked, so ninja-build serves no purpose here.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Picazsoo Picazsoo marked this pull request as ready for review June 28, 2026 10:57

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

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.

[BUG][Kotlin-Spring] JsonSetter(nulls = Nulls.FAIL) generated for nullable properties

1 participant