Repository navigation
test: OAS 3.1 scalar const: null is kept as NullNode (#2395) - #2413
Open
khayashi4337 wants to merge 1 commit into
Open
khayashi4337 wants to merge 1 commit into
khayashi4337 wants to merge 1 commit into
Conversation
Locks in that a scalar-level "const: null" stays distinguishable from a missing const (getConst() returns a NullNode), that object-level const values keep embedded nulls, and that "const": null survives a serialize/parse round-trip. Companion fix in swagger-core adds a constSetFlag mechanism (like exampleSetFlag/defaultSetFlag) so the same distinction is preserved for schemas deserialized through swagger-core's own mappers. Refs swagger-api#2395 Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Regression test for #2395 (
const: nullon a scalar schema in OpenAPI 3.1).With
OpenAPIV3Parser,getConst()forconst: nullis already a JacksonNullNode, not Javanull. So on this path, "const: null" and "noconst" can already be told apart.NullNode.toString()printsnull, which makes it easy to mistake for Javanull. The test pins this down:const: nullgives aNullNode;constgivesnull;nullinside an objectconstis kept.Where
const: nullis really lost is the swagger-core Jackson path (Yaml31/Json31mappers): there it becomes Javanulland is dropped when written back. That is fixed in swagger-api/swagger-core#5369. This PR doesn't depend on it, and passes against the released swagger-core 2.2.53.Fixes: #2395 (parser side: verified, no code change needed)
Type of Change
Checklist
Screenshots / Additional Context
Adds
OAI31DeserializationTest#testScalarConstNullOAS31and3.1.0/issue-2395.yaml(the spec from the issue). With the core change above installed locally, the wholeswagger-parser-v3test suite passes (697 tests).Parts of this change were drafted with AI coding assistants (Devin, Claude Code) and reviewed and verified by me.