Last active
February 3, 2023 00:15
-
-
Save klinki/069b02de5c4b3b5713f86f878f95165a to your computer and use it in GitHub Desktop.
OpenApi TS Inheritance Generator Bug 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi": "3.0.1", | |
"info": { | |
"title": "OpenApiBug", | |
"version": "1.0" | |
}, | |
"paths": { | |
"/vehicles": { | |
"get": { | |
"tags": [ | |
"OpenApiBug" | |
], | |
"operationId": "GetVehicles", | |
"responses": { | |
"200": { | |
"description": "Success", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "array", | |
"items": { | |
"oneOf": [ | |
{ | |
"$ref": "#/components/schemas/Car" | |
}, | |
{ | |
"$ref": "#/components/schemas/Boat" | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/garages": { | |
"get": { | |
"tags": [ | |
"OpenApiBug" | |
], | |
"operationId": "GetGarages", | |
"responses": { | |
"200": { | |
"description": "Success", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Garage" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/buldings": { | |
"get": { | |
"tags": [ | |
"OpenApiBug" | |
], | |
"operationId": "GetBuildings", | |
"responses": { | |
"200": { | |
"description": "Success", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "array", | |
"items": { | |
"oneOf": [ | |
{ | |
"$ref": "#/components/schemas/Garage" | |
}, | |
{ | |
"$ref": "#/components/schemas/DrivingSchool" | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/drivers": { | |
"get": { | |
"tags": [ | |
"OpenApiBug" | |
], | |
"operationId": "GetDrivers", | |
"responses": { | |
"200": { | |
"description": "Success", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Driver" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"components": { | |
"schemas": { | |
"Boat": { | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/components/schemas/Vehicle" | |
} | |
], | |
"properties": { | |
"speedKnotsPerHour": { | |
"type": "number", | |
"format": "double" | |
}, | |
"draft": { | |
"type": "number", | |
"format": "double" | |
}, | |
"type": { | |
"type": "string", | |
"nullable": true, | |
"readOnly": true | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"Building": { | |
"required": [ | |
"type" | |
], | |
"type": "object", | |
"properties": { | |
"type": { | |
"minLength": 1, | |
"type": "string", | |
"readOnly": true | |
} | |
}, | |
"additionalProperties": false, | |
"discriminator": { | |
"propertyName": "type", | |
"mapping": { | |
"garage": "#/components/schemas/Garage", | |
"drivingSchool": "#/components/schemas/DrivingSchool" | |
} | |
} | |
}, | |
"Car": { | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/components/schemas/Vehicle" | |
} | |
], | |
"properties": { | |
"speedKilometersPerHour": { | |
"type": "number", | |
"format": "double" | |
}, | |
"type": { | |
"type": "string", | |
"nullable": true, | |
"readOnly": true | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"Driver": { | |
"type": "object", | |
"properties": { | |
"vehicle": { | |
"oneOf": [ | |
{ | |
"$ref": "#/components/schemas/Car" | |
}, | |
{ | |
"$ref": "#/components/schemas/Boat" | |
} | |
], | |
"nullable": true | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"DrivingSchool": { | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/components/schemas/Building" | |
} | |
], | |
"properties": { | |
"content": { | |
"$ref": "#/components/schemas/Driver" | |
}, | |
"type": { | |
"type": "string", | |
"nullable": true, | |
"readOnly": true | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"Garage": { | |
"type": "object", | |
"allOf": [ | |
{ | |
"$ref": "#/components/schemas/Building" | |
} | |
], | |
"properties": { | |
"content": { | |
"oneOf": [ | |
{ | |
"$ref": "#/components/schemas/Car" | |
}, | |
{ | |
"$ref": "#/components/schemas/Boat" | |
} | |
], | |
"nullable": true | |
}, | |
"type": { | |
"type": "string", | |
"nullable": true, | |
"readOnly": true | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"Vehicle": { | |
"required": [ | |
"type" | |
], | |
"type": "object", | |
"properties": { | |
"type": { | |
"minLength": 1, | |
"type": "string", | |
"readOnly": true | |
}, | |
"id": { | |
"type": "integer", | |
"format": "int32" | |
} | |
}, | |
"additionalProperties": false, | |
"discriminator": { | |
"propertyName": "type", | |
"mapping": { | |
"car": "#/components/schemas/Car", | |
"boat": "#/components/schemas/Boat" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment