What happened
Parameter schemas generated from intersected CUE definitions use OpenAPI allOf. When dereferenced object branches are flattened with a first-wins property merge, later constraints on the same field are silently discarded.
For example:
#lower: { x: int & >=1 }
#upper: { x: int & <=10 }
#combined: #lower & #upper
The flattened generated schema retains the lower bound but loses the upper bound, so x = 11 is accepted even though CUE rejects it. The same loss can affect nested references and map value schemas.
Expected behavior
The generated schema should remain self-contained while preserving the full intersection. Both the complete schema and flattened parameter-assignment consumer should reject values that violate any branch.
Reproduction
- Generate OpenAPI for
#combined.
- Validate
x = 0, x = 5, and x = 11 against the generated schema.
- Repeat after
FlattenSchema and string-to-integer conversion.
Only x = 5 should pass.
What happened
Parameter schemas generated from intersected CUE definitions use OpenAPI
allOf. When dereferenced object branches are flattened with a first-wins property merge, later constraints on the same field are silently discarded.For example:
The flattened generated schema retains the lower bound but loses the upper bound, so
x = 11is accepted even though CUE rejects it. The same loss can affect nested references and map value schemas.Expected behavior
The generated schema should remain self-contained while preserving the full intersection. Both the complete schema and flattened parameter-assignment consumer should reject values that violate any branch.
Reproduction
#combined.x = 0,x = 5, andx = 11against the generated schema.FlattenSchemaand string-to-integer conversion.Only
x = 5should pass.