fork of hey-api/openapi-ts because I need some additional things
1{
2 "openapi": "3.0.3",
3 "info": {
4 "title": "Discriminator object schema with self mapping",
5 "version": "1.0.0",
6 "description": "Ensures a concrete schema with a discriminator mapping to itself gets a literal discriminator value instead of falling back to string."
7 },
8 "paths": {
9 "/blog-posts": {
10 "get": {
11 "summary": "Get blog posts",
12 "responses": {
13 "200": {
14 "description": "List of blog posts",
15 "content": {
16 "application/json": {
17 "schema": {
18 "type": "array",
19 "items": {
20 "oneOf": [
21 { "$ref": "#/components/schemas/BlogPostDto" },
22 { "$ref": "#/components/schemas/BlogPostWithImageDto" }
23 ]
24 }
25 }
26 }
27 }
28 }
29 }
30 }
31 }
32 },
33 "components": {
34 "schemas": {
35 "BlogPostDto": {
36 "type": "object",
37 "required": ["$type", "id", "title"],
38 "properties": {
39 "$type": {
40 "type": "string"
41 },
42 "id": {
43 "type": "integer"
44 },
45 "title": {
46 "type": "string"
47 }
48 },
49 "discriminator": {
50 "propertyName": "$type",
51 "mapping": {
52 "BlogPost": "#/components/schemas/BlogPostDto",
53 "BlogPostWithImage": "#/components/schemas/BlogPostWithImageDto"
54 }
55 }
56 },
57 "BlogPostWithImageDto": {
58 "allOf": [
59 { "$ref": "#/components/schemas/BlogPostDto" },
60 {
61 "type": "object",
62 "required": ["imageUrl"],
63 "properties": {
64 "imageUrl": {
65 "type": "string"
66 }
67 }
68 }
69 ]
70 }
71 }
72 }
73}