You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.adoc
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,9 @@
13
13
14
14
== Unreleased changes (barbacane-dev fork)
15
15
16
+
=== Tests / docs
17
+
* tighten the multi-type `type` + subschemas regression fixture and code comment, per upstream review feedback on https://github.com/oxidecomputer/typify/pull/1001[oxidecomputer/typify#1001]: drop the `SingleTypeOneOfArrayBranch` case (whose contradictory schema caused codegen to emit an unreachable enum variant), trim verbose `$comment` rationales, and shorten the match-arm doc comment in `convert.rs`
18
+
16
19
https://github.com/barbacane-dev/typify/compare/v1.0.0\...HEAD[Full list of commits]
"$comment": "Regression coverage for issue #954: schemas with a multi-type `type: [...]` array on the same object as `oneOf` / `anyOf` / `allOf` / `not` previously discarded the `type` constraint (TODO at convert.rs wildcarded `instance_type`). Single-type + subschema cases must still pass through the earlier arm unchanged.",
3
+
"$comment": "Coverage for issue #954: multi-type `type: [...]` alongside oneOf/anyOf/allOf/not.",
4
4
"definitions": {
5
5
"TypeArrayOneOfItems": {
6
-
"$comment": "Canonical issue #954 shape. Each oneOf branch only constrains `items`, so the type union must be folded into every branch rather than dropped.",
"$comment": "Same shape as TypeArrayOneOfItems but using anyOf. anyOf travels through try_merge_with_each_subschema on a sibling path from oneOf; it should fold the type union the same way.",
16
14
"type": [ "string", "number", "array" ],
17
15
"anyOf": [
18
16
{ "items": { "type": "string" } },
19
17
{ "items": { "type": "number" } }
20
18
]
21
19
},
22
20
"TypeArrayAllOfRefinement": {
23
-
"$comment": "allOf is folded pairwise into the parent rather than producing branches. The type union must survive and the array-only constraints should apply when the Array variant is selected.",
24
21
"type": [ "string", "array" ],
25
22
"allOf": [
26
23
{ "items": { "type": "string" } },
27
24
{ "minItems": 1 }
28
25
]
29
26
},
30
27
"TypeArrayNotExclusion": {
31
-
"$comment": "not: object is redundant when the outer type union excludes object, but merging must not drop the type union when the not branch is applied.",
32
28
"type": [ "string", "number", "array" ],
33
29
"not": { "type": "object" }
34
30
},
35
-
"SingleTypeOneOfArrayBranch": {
36
-
"$comment": "Regression guard (rust-collisions pattern). Outer singleton type + oneOf where one branch has a conflicting explicit type. This must continue to pass through the earlier arm (no merge), otherwise the array branch becomes unsatisfiable and is silently dropped.",
37
-
"type": "object",
38
-
"oneOf": [
39
-
{
40
-
"type": "object",
41
-
"properties": { "kind": { "type": "string" } },
42
-
"required": [ "kind" ]
43
-
},
44
-
{
45
-
"type": "array",
46
-
"items": { "type": "string" },
47
-
"minItems": 2,
48
-
"maxItems": 2
49
-
}
50
-
]
51
-
},
52
31
"TypeArrayOneOfExplicitArrayBranches": {
53
-
"$comment": "Case 7: each oneOf branch pins `type: array`, so the intersection with the outer type union must prune the non-array primitives. Only array variants should be emitted.",
32
+
"$comment": "Each oneOf branch pins `type: array`; the non-array variants from the outer union should be pruned.",
"$comment": "Some oneOf branches conflict with the outer type union and should be dropped during merge; the surviving branch must carry the outer type union. The two eliminated branches use object/number which the outer `[string, array]` disallows.",
40
+
"$comment": "Two oneOf branches conflict with the outer type union and should be dropped during merge.",
"$comment": "Case 9: every branch conflicts with the outer type union, so `try_merge_with_each_subschema` returns empty and the schema resolves to never. Must emit an empty enum cleanly rather than panic.",
49
+
"$comment": "Every branch conflicts with the outer type union; must resolve cleanly rather than panic.",
"$comment": "Case 10: oneOf and allOf on the same object, both alongside a multi-type `type` array. Exercises the full merge path (allOf folded first, then oneOf fanned out) with the Vec instance_type flowing through the merge arm.",
57
+
"$comment": "oneOf and allOf on the same object, plus a multi-type `type` array.",
#[doc = " \"$comment\": \"Regression guard (rust-collisions pattern). Outer singleton type + oneOf where one branch has a conflicting explicit type. This must continue to pass through the earlier arm (no merge), otherwise the array branch becomes unsatisfiable and is silently dropped.\","]
#[doc = " \"$comment\": \"allOf is folded pairwise into the parent rather than producing branches. The type union must survive and the array-only constraints should apply when the Array variant is selected.\","]
78
34
#[doc = " \"allOf\": ["]
79
35
#[doc = " {"]
80
36
#[doc = " \"items\": {"]
@@ -109,7 +65,6 @@ impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for TypeArrayA
109
65
#[doc = r""]
110
66
#[doc = r" ```json"]
111
67
#[doc = "{"]
112
-
#[doc = " \"$comment\": \"Same shape as TypeArrayOneOfItems but using anyOf. anyOf travels through try_merge_with_each_subschema on a sibling path from oneOf; it should fold the type union the same way.\","]
113
68
#[doc = " \"anyOf\": ["]
114
69
#[doc = " {"]
115
70
#[doc = " \"items\": {"]
@@ -154,7 +109,6 @@ impl ::std::convert::From<TypeArrayAnyOfItemsVariant1> for TypeArrayAnyOfItems {
154
109
#[doc = "{"]
155
110
#[doc = " \"allOf\": ["]
156
111
#[doc = " {"]
157
-
#[doc = " \"$comment\": \"Same shape as TypeArrayOneOfItems but using anyOf. anyOf travels through try_merge_with_each_subschema on a sibling path from oneOf; it should fold the type union the same way.\","]
158
112
#[doc = " \"type\": ["]
159
113
#[doc = " \"string\","]
160
114
#[doc = " \"number\","]
@@ -202,7 +156,6 @@ impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for TypeArrayA
202
156
#[doc = "{"]
203
157
#[doc = " \"allOf\": ["]
204
158
#[doc = " {"]
205
-
#[doc = " \"$comment\": \"Same shape as TypeArrayOneOfItems but using anyOf. anyOf travels through try_merge_with_each_subschema on a sibling path from oneOf; it should fold the type union the same way.\","]
206
159
#[doc = " \"type\": ["]
207
160
#[doc = " \"string\","]
208
161
#[doc = " \"number\","]
@@ -248,7 +201,7 @@ impl ::std::convert::From<::std::vec::Vec<f64>> for TypeArrayAnyOfItemsVariant1
248
201
#[doc = r""]
249
202
#[doc = r" ```json"]
250
203
#[doc = "{"]
251
-
#[doc = " \"$comment\": \"Case 9: every branch conflicts with the outer type union, so `try_merge_with_each_subschema` returns empty and the schema resolves to never. Must emit an empty enum cleanly rather than panic.\","]
204
+
#[doc = " \"$comment\": \"Every branch conflicts with the outer type union; must resolve cleanly rather than panic.\","]
#[doc = " \"$comment\": \"not: object is redundant when the outer type union excludes object, but merging must not drop the type union when the not branch is applied.\","]
296
248
#[doc = " \"not\": {"]
297
249
#[doc = " \"type\": \"object\""]
298
250
#[doc = " },"]
@@ -327,7 +279,7 @@ impl ::std::convert::From<::std::vec::Vec<::serde_json::Value>> for TypeArrayNot
327
279
#[doc = r""]
328
280
#[doc = r" ```json"]
329
281
#[doc = "{"]
330
-
#[doc = " \"$comment\": \"Case 10: oneOf and allOf on the same object, both alongside a multi-type `type` array. Exercises the full merge path (allOf folded first, then oneOf fanned out) with the Vec instance_type flowing through the merge arm.\","]
282
+
#[doc = " \"$comment\": \"oneOf and allOf on the same object, plus a multi-type `type` array.\","]
331
283
#[doc = " \"allOf\": ["]
332
284
#[doc = " {"]
333
285
#[doc = " \"minLength\": 1"]
@@ -604,7 +556,7 @@ impl<'de> ::serde::Deserialize<'de> for TypeArrayOneOfAndAllOfVariant1String {
604
556
#[doc = r""]
605
557
#[doc = r" ```json"]
606
558
#[doc = "{"]
607
-
#[doc = " \"$comment\": \"Case 7: each oneOf branch pins `type: array`, so the intersection with the outer type union must prune the non-array primitives. Only array variants should be emitted.\","]
559
+
#[doc = " \"$comment\": \"Each oneOf branch pins `type: array`; the non-array variants from the outer union should be pruned.\","]
608
560
#[doc = " \"oneOf\": ["]
609
561
#[doc = " {"]
610
562
#[doc = " \"items\": {"]
@@ -650,7 +602,6 @@ impl ::std::convert::From<::std::vec::Vec<f64>> for TypeArrayOneOfExplicitArrayB
650
602
#[doc = r""]
651
603
#[doc = r" ```json"]
652
604
#[doc = "{"]
653
-
#[doc = " \"$comment\": \"Canonical issue #954 shape. Each oneOf branch only constrains `items`, so the type union must be folded into every branch rather than dropped.\","]
654
605
#[doc = " \"oneOf\": ["]
655
606
#[doc = " {"]
656
607
#[doc = " \"items\": {"]
@@ -707,7 +658,6 @@ impl ::std::convert::From<TypeArrayOneOfItemsVariant2> for TypeArrayOneOfItems {
707
658
#[doc = "{"]
708
659
#[doc = " \"allOf\": ["]
709
660
#[doc = " {"]
710
-
#[doc = " \"$comment\": \"Canonical issue #954 shape. Each oneOf branch only constrains `items`, so the type union must be folded into every branch rather than dropped.\","]
711
661
#[doc = " \"type\": ["]
712
662
#[doc = " \"string\","]
713
663
#[doc = " \"number\","]
@@ -769,7 +719,6 @@ impl ::std::convert::From<::std::vec::Vec<::std::string::String>> for TypeArrayO
769
719
#[doc = "{"]
770
720
#[doc = " \"allOf\": ["]
771
721
#[doc = " {"]
772
-
#[doc = " \"$comment\": \"Canonical issue #954 shape. Each oneOf branch only constrains `items`, so the type union must be folded into every branch rather than dropped.\","]
773
722
#[doc = " \"type\": ["]
774
723
#[doc = " \"string\","]
775
724
#[doc = " \"number\","]
@@ -831,7 +780,6 @@ impl ::std::convert::From<::std::vec::Vec<f64>> for TypeArrayOneOfItemsVariant1
831
780
#[doc = "{"]
832
781
#[doc = " \"allOf\": ["]
833
782
#[doc = " {"]
834
-
#[doc = " \"$comment\": \"Canonical issue #954 shape. Each oneOf branch only constrains `items`, so the type union must be folded into every branch rather than dropped.\","]
835
783
#[doc = " \"type\": ["]
836
784
#[doc = " \"string\","]
837
785
#[doc = " \"number\","]
@@ -891,7 +839,7 @@ impl ::std::convert::From<::std::vec::Vec<bool>> for TypeArrayOneOfItemsVariant2
891
839
#[doc = r""]
892
840
#[doc = r" ```json"]
893
841
#[doc = "{"]
894
-
#[doc = " \"$comment\": \"Some oneOf branches conflict with the outer type union and should be dropped during merge; the surviving branch must carry the outer type union. The two eliminated branches use object/number which the outer `[string, array]` disallows.\","]
842
+
#[doc = " \"$comment\": \"Two oneOf branches conflict with the outer type union and should be dropped during merge.\","]
0 commit comments