fix(jsonschema): preserve recursive scalar unions #4
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
go
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nemith/nvueschema!4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/fix-recursive-scalar-unions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What changed
anyOf/oneOfvariants before determining whether a schema is a scalar union.(integer | "none") | "auto".Root cause
PR #3 preserved scalar unions nested inside a single-branch wrapper, but NVUE BGP peer timers have two outer branches and one of those branches is itself a scalar union. The outer schema therefore fell through to
FlattenComposite, which selected the first inner string branch and discarded the integer type. This made valid integer timer values fail validation while quoted numeric strings incorrectly passed.Impact
Generated JSON Schema now preserves all three alternatives and their numeric bounds. Integer BGP peer-group timers validate correctly; quoted numeric strings are rejected.
Validation
go test ./...@ -31,22 +31,31 @@ func sortedProperties(s *Config) []propertyEntry {// scalarUnionVariants returns the anyOf or oneOf variants for a scalar union,Duplicate check here smells. robably need to return nil or not?