Skip to content

Incorrect validation occuring due to property using "enum" as a property name #490

Open
@briangleeson

Description

@briangleeson

Version: [email protected]

The validator comes back with a warning for the content of some of our example responses:

 Message :   Enum value "option1" must be "single_select".                                                                                                
 Path    :   paths./tekton_pipelines/{pipeline_id}/properties.post.requestBody.content.application/json.examples.single_select_env_properties.value.enum.0
 Line    :   1119                                                                                                                                         

This is arising in 9 places in our API yaml. The full yaml file can be seen here

This is one example:

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PropertyPrototype'
            examples:
              single_select_env_properties:
                value:
                  name: "enums"
                  type: "single_select"
                  enum: ["option1","option2","option3"]
                  value: "option1"

Schema for the enum:

enum:
          description: Options for `single_select` property type
          type: array
          minItems: 0
          maxItems: 1024
          items:
            $ref: '#/components/schemas/GeneralString'

It seems like the fact we are using the term enum for one of the properties in our API schema is confusing the validator

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingspectralWaiting for fix to be released in Spectral

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions