@@ -12503,6 +12503,83 @@ paths:
1250312503 - $ref : " components.yaml#/components/schemas/smartUnionEmptyStringObjectB"
1250412504 required :
1250512505 - json
12506+ /smartunion/nestedunion :
12507+ post :
12508+ operationId : smartUnionNestedUnion
12509+ summary : Nested union should only count winning inner option's unrecognized
12510+ description : |
12511+ Test case: nested union count propagation
12512+ Outer union:
12513+ - Option A: { data: InnerUnion } where InnerUnion has 3 options with open enums
12514+ - Option B: { data: { kind: OpenEnum, name: OpenEnum } } has 2 open enum fields
12515+ Inner union (inside Option A):
12516+ - { kind: OpenEnum["cat"], name: string } - 2 fields
12517+ - { kind: OpenEnum["dog"] } - 1 field
12518+ - { kind: OpenEnum["bird"] } - 1 field
12519+ Payload: { data: { kind: "unknown", name: "also_unknown" } }
12520+
12521+ Expected: Option A should win because:
12522+ - Inner union picks the cat variant (has name field), counts 1 unrecognized (kind="unknown")
12523+ - Option B would count 2 unrecognized (both kind and name are unknown enum values)
12524+ - With correct counting: A=1 < B=2, so A wins
12525+ - With buggy counting: A=3 (accumulated from all inner options) > B=2, so B would wrongly win
12526+ servers :
12527+ - url : http://localhost:35456
12528+ tags :
12529+ - unions
12530+ requestBody :
12531+ content :
12532+ application/json :
12533+ schema :
12534+ oneOf :
12535+ - type : object
12536+ title : smartUnionNestedOuterA
12537+ properties :
12538+ data :
12539+ oneOf :
12540+ - $ref : " components.yaml#/components/schemas/smartUnionNestedInnerCat"
12541+ - $ref : " components.yaml#/components/schemas/smartUnionNestedInnerDog"
12542+ - $ref : " components.yaml#/components/schemas/smartUnionNestedInnerBird"
12543+ required :
12544+ - data
12545+ - type : object
12546+ title : smartUnionNestedOuterBWrapper
12547+ properties :
12548+ data :
12549+ $ref : " components.yaml#/components/schemas/smartUnionNestedOuterB"
12550+ required :
12551+ - data
12552+ required : true
12553+ responses :
12554+ " 200 " :
12555+ description : OK
12556+ content :
12557+ application/json :
12558+ schema :
12559+ title : res
12560+ type : object
12561+ properties :
12562+ json :
12563+ oneOf :
12564+ - type : object
12565+ title : smartUnionNestedOuterA
12566+ properties :
12567+ data :
12568+ oneOf :
12569+ - $ref : " components.yaml#/components/schemas/smartUnionNestedInnerCat"
12570+ - $ref : " components.yaml#/components/schemas/smartUnionNestedInnerDog"
12571+ - $ref : " components.yaml#/components/schemas/smartUnionNestedInnerBird"
12572+ required :
12573+ - data
12574+ - type : object
12575+ title : smartUnionNestedOuterBWrapper
12576+ properties :
12577+ data :
12578+ $ref : " components.yaml#/components/schemas/smartUnionNestedOuterB"
12579+ required :
12580+ - data
12581+ required :
12582+ - json
1250612583
1250712584 /method/delete :
1250812585 delete :
0 commit comments