Schema does not define a required property

Issue ID: semantic-schema-property-required

Description

One or more properties that you have defined as required are not defined in the schema.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition. The schema requires the property name, but it has not been defined:

{
    "name": "Pet",
    "in": "body",
    "description": "pet to add to the system",
    "required": true,
    "schema": {  
        "type": "object",
        "additionalProperties": "false",
        "required": [
            "name"
        ],
        "properties": {
            "breed": {
                "type": "string"
            },
            "age": {
                "type": "integer"
            }
        }
    }
}

Remediation

Make sure that all properties you have defined as required are also defined in the schema.

{
    "name": "pet",
    "in": "body",
    "description": "pet to add to the system",
    "required": true,
    "schema": {  
        "type": "object",
        "additionalProperties": "false",
        "required": [
            "name"
        ],
        "properties": {
            "name": {
                "type": "string"
            },
            "breed": {
                "type": "string"
            },
            "age": {
                "type": "integer"
            }
        }
    }
}