Skip to content

$ref not supported in api (path) params #191

Description

@mvnrhd

When referencing a component via $ref as a param type, the resolved datatype on the parameter (accessed via allParams) is number and isEnum is false.
Now with this resulting model there's no possibility to correctly resolve the enum name.
Consider the following schema:

...
'/user/{type}':
    get:
      tags:
        - GetUsers
      summary: GetUsersByType
      operationId: GetUsersByType
      parameters:
        - name: type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UserType'
      responses:
        '200':
          ...
components:
  schemas:
    UserType:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
      type: integer
      format: int32
      x-enum-varnames:
        - TypeA
        - TypeB
        - TypeC
        - TypeD
        - TypeE
        - TypeF

This is the result:

"allParams": [
                {
                  "isHeaderParam": false,
                  "isQueryParam": false,
                  "isPathParam": true,
                  "isBodyParam": false,
                  "isFormParam": false,
                  "paramName": "type",
                  "baseName": "type",
                  "required": true,
                  "optional": false,
                  "dataType": "number",
                  "%dataType%": "number",
                  "format": "int32",
                  "enum": [
                    0,
                    1,
                    2,
                    3,
                    4,
                    5
                  ],
                  "example": "0",
                  "isBoolean": false,
                  "isPrimitiveType": false,
                  "dataFormat": "int32",
                  "isDate": false,
                  "isDateTime": false,
                  "description": "",
                  "isFile": false,
                  "isEnum": false,
                  "vendorExtensions": {},
                  "-first": true,
                  "-last": false,
                  "hasMore": true
                }
]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions