Schema discriminator property must be a string

Description

You have defined a discriminator that is not a string. Discriminators must always be of the type string.

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 type of the discriminator age is integer:

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

Remediation

Make sure that all discriminator values are strings.

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

Copyright 42Crunch 2021