fork of hey-api/openapi-ts because I need some additional things
1{
2 "openapi": "3.0.3",
3 "info": {
4 "title": "Discriminator allOf inline schema mapping",
5 "version": "1.0.0",
6 "description": "Reproduces a bug where a schema extending a parent whose allOf contains both a $ref (with a discriminator that doesn't map the child) and an inline schema (with a discriminator that does map the child) gets the wrong discriminator value. The inline discriminator mapping should win, not the $ref discriminator fallback."
7 },
8 "paths": {
9 "/foos": {
10 "get": {
11 "responses": {
12 "200": {
13 "description": "OK",
14 "content": {
15 "application/json": {
16 "schema": {
17 "oneOf": [
18 { "$ref": "#/components/schemas/Bar" },
19 { "$ref": "#/components/schemas/Baz" },
20 { "$ref": "#/components/schemas/Qux" }
21 ]
22 }
23 }
24 }
25 }
26 }
27 }
28 }
29 },
30 "components": {
31 "schemas": {
32 "Foo": {
33 "required": ["$type"],
34 "type": "object",
35 "properties": {
36 "$type": { "type": "string" },
37 "foo": { "type": "string" }
38 },
39 "discriminator": {
40 "propertyName": "$type",
41 "mapping": {
42 "FooBar": "#/components/schemas/Bar",
43 "FooBaz": "#/components/schemas/Baz"
44 }
45 }
46 },
47 "Bar": {
48 "allOf": [
49 { "$ref": "#/components/schemas/Foo" },
50 {
51 "required": ["$type"],
52 "type": "object",
53 "properties": {
54 "$type": { "type": "string" },
55 "bar": { "type": "string" }
56 },
57 "discriminator": {
58 "propertyName": "$type",
59 "mapping": {
60 "BarQux": "#/components/schemas/Qux"
61 }
62 }
63 }
64 ]
65 },
66 "Baz": {
67 "allOf": [
68 { "$ref": "#/components/schemas/Foo" },
69 {
70 "type": "object",
71 "properties": {
72 "baz": { "type": "string" }
73 }
74 }
75 ]
76 },
77 "Qux": {
78 "allOf": [
79 { "$ref": "#/components/schemas/Bar" },
80 {
81 "type": "object",
82 "properties": {
83 "qux": { "type": "string" }
84 }
85 }
86 ]
87 }
88 }
89 }
90}