fix: fixes handling of empty objects during marshaller sync that was impacting docs upgrading with nullable only schemas #47
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.
Fix: Handle empty objects during marshaller sync for nullable schema upgrades
Problem
OpenAPI 3.0 to 3.1 document upgrades were panicking when processing schemas with
nullable: trueproperties. The panic occurred in the marshaller'ssyncArraySlicefunction when it encounterednilnodes during array synchronization.Root Cause
When nullable only schemas are upgraded from 3.0 to 3.1, they get converted to
oneOfstructures containing:{}{"type": ["null"]}The issue was that completely empty schemas (after upgrade processing) were being synced to
nilnodes instead of valid YAML mapping nodes, causing the array sync process to panic when processing theoneOfarray.Solution
Fixed the
syncChangesfunction inmarshaller/syncer.goto ensure that even empty structs produce valid YAML mapping nodes:Changes
syncChangesTesting
Impact