Skip to content

Instantly share code, notes, and snippets.

@MarcMil
Created July 24, 2020 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcMil/4a78e766e755be073018111a67abae0f to your computer and use it in GitHub Desktop.
Save MarcMil/4a78e766e755be073018111a67abae0f to your computer and use it in GitHub Desktop.
{
"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" : [ "type" ],
"type" : "object",
"description" : "Cute",
"allOf" : [ {
"$ref" : "#/components/schemas/Animal"
}, {
"type" : "object",
"properties" : { }
} ]
},
"Dog" : {
"required" : [ "type" ],
"type" : "object",
"description" : "Cute",
"allOf" : [ {
"$ref" : "#/components/schemas/Animal"
}, {
"type" : "object",
"properties" : { }
} ]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment