Skip to content

Path param of type array[integer] always fails on length 1 #83

@dan-kez

Description

@dan-kez

Swagger YAML Def:

/Permission:
    x-swagger-router-controller: permission
    get:
      tags: ['Permissions']
      description: Get either all permissions or a permission with a specific id
      operationId: getPermissions
      parameters:
        - $ref: "#/parameters/NodeIDs"
      responses:
        "200":
          description: Success
          schema:
            type: array
            items:
              $ref: "#/definitions/Permission"
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"
 
parameters:
   NodeIDs:
    name: ids
    in: query
    description: A list of node ids (integers).
    type: array
    items:
      type: integer

Example command: curl -k https://0.0.0.0:3000/Permission?ids=123

Error:

{"message":"Validation errors","errors":[{"code":"INVALID_REQUEST_PARAMETER","errors":[{"code":"INVALID_TYPE","params":["array","integer"],"message":"Expected type array but found type integer","path":[],"description":"A list of node ids (integers)."}],"in":"query","message":"Invalid parameter (ids): Value failed JSON Schema validation","name":"ids","path":["paths","/Permission","get","parameters","1"]}]}

However the following works: curl -k https://0.0.0.0:3000/Permission?ids=1231,1231

The following behavior does not hold true when the yaml def changes to the following:

parameters:
   NodeIDs:
    name: ids
    in: query
    description: A list of node ids (integers).
    type: array
    items:
      type: string

However, I receive an error when I try to put an integer 1231 into a string.

I'd really love for a resolution to this.

Best,
Dan

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