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 v2 or v3.

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",
        "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",
        "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