Skip to content

Commit f8781ee

Browse files
mromaszewiczclaude
andcommitted
test(v3): cover a nested member's own properties where v2 keeps a map
#2571 made v2 keep the properties an allOf member declares next to its own allOf, but only where the merge already has properties: elsewhere v2 generates a map or a bare union, and adding a field would change that type. Three shapes cover those cases under both versions: - next to typed additionalProperties: v2 `map[string]string`, v3 a struct with B and AdditionalProperties; - next to an empty object: v2 `map[string]any`, v3 a struct with B; - next to a oneOf: v2 a bare union, v3 the union with a B field. Every cell round-trips its samples: v2's map and union keep b as data, v3 gives it a field. The v2 cells are new; no existing cell changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 887d678 commit f8781ee

38 files changed

Lines changed: 20165 additions & 0 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
versions: [v2, v3]
2+
description: >-
3+
allOf over a $ref to a schema that declares a property next to an allOf of
4+
an empty object. v2 generates a map, and keeps it one rather than add the
5+
property (#2571); v3 generates the property.
6+
subject:
7+
allOf:
8+
- $ref: '#/components/schemas/Mid'
9+
- type: object
10+
components:
11+
Mid:
12+
type: object
13+
properties:
14+
b: {type: string}
15+
allOf:
16+
- type: object
17+
samples:
18+
- '{"b": "x"}'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
versions: [v2, v3]
2+
description: >-
3+
allOf over a $ref to a schema that declares a property next to an allOf
4+
with typed additionalProperties. v2 generates a map, and keeps it one
5+
rather than add the property (#2571); v3 keeps both.
6+
subject:
7+
allOf:
8+
- $ref: '#/components/schemas/Mid'
9+
- description: A map with a property.
10+
components:
11+
Mid:
12+
type: object
13+
properties:
14+
b: {type: string}
15+
allOf:
16+
- additionalProperties: {type: string}
17+
samples:
18+
- '{"b": "x", "k": "v"}'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
versions: [v2, v3]
2+
description: >-
3+
allOf over a $ref to a schema that declares a property next to an allOf of a
4+
oneOf. v2 generates a bare union, and keeps it one rather than add the
5+
property (#2571); v3 adds the property to the union.
6+
subject:
7+
allOf:
8+
- $ref: '#/components/schemas/Mid'
9+
- description: A union with a property.
10+
components:
11+
Mid:
12+
type: object
13+
properties:
14+
b: {type: string}
15+
allOf:
16+
- oneOf:
17+
- type: object
18+
required: [x]
19+
properties:
20+
x: {type: string}
21+
- type: object
22+
required: [y]
23+
properties:
24+
y: {type: integer}
25+
samples:
26+
- '{"b": "x", "x": "s"}'
27+
- '{"y": 3}'

0 commit comments

Comments
 (0)