pipermerriam / flex

Swagger schema validator
MIT License
150 stars 76 forks source link

parentheses ( ) not regex escaped #204

Open leon-vg opened 6 years ago

leon-vg commented 6 years ago

I logged an issue in the Robot-Framework RESTinstance library, regarding an issue with parentheses ( ) in a swagger endpoint. https://github.com/asyrjasalo/RESTinstance/issues/34

The issue is, in short, that an endpoint with parentheses cannot be found, while this is incorrect.

I tracked down the problem to the following file in this library: https://github.com/pipermerriam/flex/blob/master/flex/paths.py#L19

The problem seems to be resolved when I change the following code:

REGEX_REPLACEMENTS = (
    ('\.', '\.'),
    ('\{', '\{'),
    ('\}', '\}'),
)

to this:

REGEX_REPLACEMENTS = (
    ('\.', '\.'),
    ('\{', '\{'),
    ('\}', '\}'),
    ('\(', '\('),
    ('\)', '\)'),
)

I am not a python developer, otherwise I would have submitted a PR. I hope a more experienced developer can check if this change is appropriate and realize this change.