Skip to content

Instantly share code, notes, and snippets.

@rei-ber
Created May 8, 2024 14:28
Show Gist options
  • Save rei-ber/53a9c9bbf57ecd4d49e955f02fe33c46 to your computer and use it in GitHub Desktop.
Save rei-ber/53a9c9bbf57ecd4d49e955f02fe33c46 to your computer and use it in GitHub Desktop.
anyOf openapi spec example (broken for openapi-generator)
{
"components": {
"schemas": {
"Reputation": {
"properties": {
"fieldref": {
"title": "Fieldref",
"type": "string"
},
"mark": {
"title": "Mark",
"type": "string"
},
"ttl": {
"title": "Ttl",
"type": "integer"
}
},
"required": [
"fieldref",
"mark",
"ttl"
],
"title": "Reputation",
"type": "object"
},
"UsecaseData": {
"properties": {
"reputation": {
"anyOf": [
{
"$ref": "#/components/schemas/Reputation"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [],
"title": "UsecaseDataUUID",
"type": "object"
}
}
},
"info": {
"title": "anyof example",
"version": "v1"
},
"openapi": "3.1.0",
"paths": {
"/api/v1/usecases": {
"post": {
"description": "",
"operationId": "post_post_usecase",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"reputation": {
"anyOf": [
{
"$ref": "#/components/schemas/Reputation"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
],
"title": "UsecaseData",
"type": "object"
}
}
}
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"properties": {
"reputation": {
"anyOf": [
{
"$ref": "#/components/schemas/Reputation"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
],
"title": "UsecaseDataUUID",
"type": "object"
}
}
},
"description": ""
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment