Schema does not define the required property

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:

"post": {
  "description": "Creates a new pet in the store",
  "operationId": "addPet",
  "parameters": [
    {
      "name": "pet",
      "in": "body",
      "description": "pet to add to the system",
      "required": true,
      "schema": {  
        "type": "object",
        "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.

"post": {
  "description": "Creates a new pet in the store",
  "operationId": "addPet",
  "parameters": [
    {
      "name": "pet",
      "in": "body",
      "description": "pet to add to the system",
      "required": true,
      "schema": {  
        "type": "object",
        "required": [
          "name"
          ],
        "properties": {
          "name": {
             "type": "string"
           },
          "breed": {
            "type": "string"
           },
          "age": {
            "type": "integer"
          }
         }
       }
     }
   ]
}

Get API Security news directly in your Inbox.

By clicking Subscribe you agree to our Data Policy