Skip to content

Instantly share code, notes, and snippets.

@cogwirrel
Created April 13, 2023 07:02
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 cogwirrel/6f6355e04b831bfbbbe57337b3429b9c to your computer and use it in GitHub Desktop.
Save cogwirrel/6f6355e04b831bfbbbe57337b3429b9c to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.2",
"info": {
"title": "MyApi",
"version": "1.0",
"description": "A sample api"
},
"paths": {
"/example": {
"get": {
"operationId": "ExampleOperation",
"responses": {
"200": {
"description": "ExampleOperation 200 response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExampleOperationResponseContent"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Bar": {
"type": "object",
"properties": {
"barArg": {
"type": "string"
}
}
},
"ExampleOperationResponseContent": {
"type": "object",
"properties": {
"fooOrBar": {
"$ref": "#/components/schemas/FooOrBar"
}
}
},
"Foo": {
"type": "object",
"properties": {
"fooArg": {
"type": "string"
}
}
},
"FooOrBar": {
"oneOf": [
{
"type": "object",
"title": "foo",
"properties": {
"foo": {
"$ref": "#/components/schemas/Foo"
}
},
"required": [
"foo"
]
},
{
"type": "object",
"title": "bar",
"properties": {
"bar": {
"$ref": "#/components/schemas/Bar"
}
},
"required": [
"bar"
]
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment