Skip to content

OAS 3 String format validation not working in path #724

@zekth

Description

@zekth

Seems like the string format validation does not seem to work in path

paths:
  /uuid-pattern/{param}:
    get:
      parameters:
        - in: path
          name: param
          required: true
          schema:
            type: string
            pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
            minLength: 36
            maxLength: 36
      responses:
        '200':
          description: success
  /uuid-format/{param}:
    get:
      parameters:
        - in: path
          name: param
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: success

In the previous example /uuid-pattern/foobar returns properly an error, which can be casted as multierror with 2 errors but the uuid-format/foobar passes the validation.

Seems like the format is handled in the codebase:

func NewUUIDSchema() *Schema {
return &Schema{
Type: TypeString,
Format: "uuid",
}
}

Is there a miss somewhere?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions