Slackbot
04/13/2023, 5:01 PMNick Williams
04/13/2023, 5:02 PM"Parent": {
"description": "Parent schema",
"type": "object",
"required": ["id", "activities"],
"properties": {
"id": {
"type": "integer",
"example": 3,
"enum": [3, 4, 5, 6, 7, 8, 9, 16],
"nullable": false
},
"activities": {
"type": "array",
"nullable": false,
"minimum": 1,
"items": {
"type": "string",
"example": "6AA2A3B9-66BD-447C-90C8-A350F60D592B"
}
}
}
},
"Child": {
"description": "",
"allOf": [{
"$ref": "#/components/schemas/Parent"
}],
"type": "object",
"properties": {
"id": {
"type": "integer",
"enum": [3]
},
"activities": {
"type": "array",
"items": {
"type": "string",
"enum": [
"value",
"another value"
]
}
}
}
}
Example of keyword & circular references:
"properties": {
"project_type": {
"type": "object",
"nullable": true,
"oneOf": [{
"$ref": "#/components/schemas/Category"
}]
}
}
....
"schemas": {
"Category": {
"type": "object",
"required": ["short_name"],
"properties": {
"short_name": {
"type": "string",
"nullable": false,
"example": "test"
},
"child": {
"nullable": true,
"allOf": [{
"$ref": "#/components/schemas/Category"
}]
}
}
}
}Timothy Jones
04/13/2023, 5:05 PM