Created
July 24, 2020 12:48
-
-
Save MarcMil/707bc45824a8ee69daf93d6af0dc091d to your computer and use it in GitHub Desktop.
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" : "Test API", | |
"description" : "API", | |
"contact" : { | |
"name" : "Foo", | |
"url" : "https://foo.com", | |
"email" : "foo@foo.com" | |
}, | |
"version" : "0.1" | |
}, | |
"paths" : { | |
"/api/TestInheritance" : { | |
"get" : { | |
"summary" : "Does a thing", | |
"description" : "retrieves an animal.", | |
"operationId" : "getAnimal", | |
"responses" : { | |
"200" : { | |
"description" : "OK", | |
"content" : { | |
"application/json" : { | |
"schema" : { | |
"$ref" : "#/components/schemas/Animal" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"components" : { | |
"schemas" : { | |
"Animal" : { | |
"required" : [ "type" ], | |
"type" : "object", | |
"properties" : { | |
"type" : { | |
"type" : "string", | |
"description" : "The type of animal", | |
"example" : "cat" | |
} | |
}, | |
"description" : "foo", | |
"discriminator" : { | |
"propertyName" : "type", | |
"mapping" : { | |
"cat" : "#/components/schemas/Cat", | |
"dog" : "#/components/schemas/Dog" | |
} | |
} | |
}, | |
"Cat" : { | |
"required" : [ "foo", "type" ], | |
"type" : "object", | |
"description" : "Cute", | |
"allOf" : [ { | |
"$ref" : "#/components/schemas/Animal" | |
}, { | |
"type" : "object", | |
"properties" : { | |
"foo" : { | |
"type" : "string", | |
"description" : "The type of animal" | |
} | |
} | |
} ] | |
}, | |
"Dog" : { | |
"required" : [ "foo", "type" ], | |
"type" : "object", | |
"description" : "Cute", | |
"allOf" : [ { | |
"$ref" : "#/components/schemas/Animal" | |
}, { | |
"type" : "object", | |
"properties" : { | |
"foo" : { | |
"type" : "string", | |
"description" : "The type of animal" | |
} | |
} | |
} ] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment