Add validation for format: uuid for in query param
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)
-
-
- changed status to open
-
Available in v1.3.3
Also added support for email, ipv4, ipv6 and uri formats.
-
- changed status to resolved
-
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?
-
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). - Log in to comment
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!