Value of the schema discriminator must be a required property

Description

The discriminator property in the schema in question has not been listed as a required property.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition. Here, the discriminator petType is not included in the required properties:

1Pet:
2  type: object
3  discriminator:
4    propertyName: petType
5  properties:
6    name:
7      type: string
8    petType:
9      type: string
10  required:
11    - name
12

Remediation

Make sure that all discriminators are listed as required properties.

1Pet:
2  type: object
3  discriminator:
4    propertyName: petType
5  properties:
6    name:
7      type: string
8    petType:
9      type: string
10  required:
11    - name
12    - petType
13

Copyright 42Crunch 2021