Add validation for format: uuid for in query param

Issue #85 resolved
Viktar Patotski created an issue

let's say we have following request swagger config:

- name: myParam
          in: query
          type: string
          format: uuid

when sending "?myParam=Not_an_UUID" it passes the validation, but it should not. It works fine for "in: path" params.

Comments (6)

  1. James Navin

    I'm actually surprised it works in path params - the validator currently only supports UUIDs in JSON schema definitions (e.g. params that $ref a schema definition).

    Adding support now - thanks for raising it!

  2. Viktar Patotski reporter

    @jfnavin Thanks a lot for taking care of it, however I think that message is not correct. With version 1.3.3 when sending "?myParam= NOT_AN_UUID" I receive following message: Parameter 'NOT_AN_UUID' is not a valid UUID.

    But I think that more meaning full will be:

    Value 'NOT_AN_UUID' for parameter 'myParam' is not a valid UUID.

    Should I report another bug or we can reopen this one?

  3. James Navin

    Raise a new ticket pls. I'll try to get to it soon (looking at the code it will require an API change in the FormatValidator to pass in the parameter object, so it will be a bit more substantial than just changing the msg).

  4. Log in to comment