Skip to content

Is it possible to reference query parameter to enum defined in definitions ? #564

Closed
@unoexperto

Description

@unoexperto

Is it possible to reference query parameter to enum defined in definitions ? For example consider following example:

paths:
  /users/test:
    get:
      summary: Test endpoint
      parameters:
        - name: osType
          in: query
          description: Client's OS type.
          required: true
          type: string
          enum:
          - ios
          - android

then I define this

definitions:
  OsTypes:
    type: string
    enum:
    - ios
    - android

Can I reference it from endpoint to avoid defining allowed values of the enum in every endpoint that uses it ?

I tried

schema:
  $ref: '#/definitions/OsTypes'

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions