Skip to content

Parameter validation for the uuid format should not be case sensitive #4099

@linelson

Description

@linelson
Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.4.4 (also looks like it impacts the current version)
How did you install Swagger-UI? Built using npm run build, copied dist folder
Which browser & version? Chrome 63.0.3239.132
Which operating system? Windows 10

Demonstration API definition

Here's a sample parameter (modified from the petstore example swagger spec) with this issue:

                "parameters": [
                    {
                        "name": "petId",
                        "in": "path",
                        "description": "ID of pet to return",
                        "required": true,
                        "type": "string",
                        "format": "uuid"
                    }

Note that the parameter petId is of type string and and format uuid.
When a value of 78aea7e5-97c3-4e77-92ea-d40d6a3a4439 is entered in the swagger ui for parameter petId, the swagger ui works as expected. However, for 78AEA7E5-97C3-4E77-92EA-D40D6A3A4439, the same guid converted to upper case, the following occurs:

Expected Behavior

The value 78AEA7E5-97C3-4E77-92EA-D40D6A3A4439 is a valid uuid and so the swagger ui should accept it as the value for the petId parameter without producing an error.

Current Behavior

The following error is produced: "Value must be a Guid"

Possible Solution

In utils.js in the method validateGuid(val), set val = val.toLowerCase() before applying the case-sensitive regular expression (or modify the regex to be case insensitive).

Context

Users should be able to provide a valid guid as a value for a parameter with uuid format without first converting the guid to lower case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions