Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mvnrhd opened this issue Jan 18, 2021 · 0 comments
Open

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

mvnrhd opened this issue Jan 18, 2021 · 0 comments
Labels

Comments

@mvnrhd
Copy link

mvnrhd commented Jan 18, 2021

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
                }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants