{
    "openapi": "3.0.0",
    "info": {
        "title": "one-of Models",
        "version": "1.0.0",
        "description": "Spec containing model composition using one-of. Checkout the model definition under the RESPONSE section"
    },
    "paths": {
        "/one-of/employee": {
            "get": {
                "tags": ["One Of Schema Model"],
                "summary": "Schema defined using one-of",
                "operationId": "empDetails",
                "responses": {
                    "200": {
                        "description": "Checkout the model tab to view object schemas defined using one-of",
                        "content" : {
                            "application/json" : {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/employee"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "employee": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "id": { "type": "string", "description": "Employee ID" },
                    "employee": {
                        "description": "Employee Details (Worker or Manager)",
                        "oneOf": [
                            { "$ref": "#/components/schemas/manager" },
                            { "$ref": "#/components/schemas/worker" },
                            {
                                "type": "object",
                                "description": "This has no title",
                                "properties": {
                                    "personnel number": { "type": "string" }
                                }
                            },
                            {
                                "type": "array",
                                "title": "An array title",
                                "description": "An array with a title",
                                "items": { "type": "string", "title": "an array item" }
                            },
                            {
                                "type": "array",
                                "description": "An array without a title",
                                "items": { "type": "string", "title": "an array item" }
                            },
                            { "type": "string", "description": "Primitive with a title", "title": "ID number" },
                            { "type": "int", "description": "Primitive without a title" },
                            { "type": "null", "description": "Null with a title", "title": "Null with a title" },
                            { "type": "null", "description": "Null without a title" }
                        ]
                    },
                    "anotherArray": { "type": "array", "items": { "type": "string", "title": "A string item" } },
                    "objectWithArrayProp": {
                        "type": "object",
                        "title": "object with array",
                        "properties": {
                            "nestedArray": { "type": "array", "title": "A nested array", "items": { "type": "string", "title": "A nested string item" } }
                        }
                    }
                }
            },
            "manager": {
                "title": "Manager",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "name": { "type": "string", "description": "Name of employee" },
                    "directReports": { "type": "integer", "description": "Count of direct reports" }
                }
            },
            "worker": {
                "title": "Worker",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "name": { "type": "string", "description": "Name of employee" },
                    "managerName": { "type": "string", "description": "Name of manager" }
                }
            }
        }
    },
    "tags": [
        { "name": "Employee Details", "description": "Employee Details" }
    ]
}
