Behaviour of pattern (regex) with url encoding #2045
Labels
clarification
requests to clarify, but not change, part of the spec
param serialization
Issues related to parameter and/or header serialization
Milestone
Q: Is
pattern
regex checking applied before or after urlencoding (rfc3986)?The OpenAPI spec allows
pattern
for properties which uses JSON Schema validation. When applying the JSON Schema logic to a JSON data structure this validation works fine. The spec also provides ability forallowReserved
to permit rfc3986 2.2 reserved characters. This logic becomes confusing however when the parameter is in the query and needs to be url encoded.My question is: does
pattern
need to list all possible raw user inputs (ie: unreserved & percent-encoded characters)? eg: is[0-4]
considered the same as([0-4]|%30|%31|%32|%33|%34)
Example: Take the following spec which provides
/search?name=My Name
:Here the spec expects a whitespace delimited full name. As the parameter is a GET query parameter '
' (space) will be encoded as
%20
, thus GET/search?name=My%20Name
. ECMA regular expression fails to matchMy%20Name
, but matchesMy Name
after urldecoding.Can someone please clarify the behaviour. How should the documentation be updated to articulate this behaviour?
The text was updated successfully, but these errors were encountered: