Skip to content

Incorrect django request validation for re_path urls #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mnowakowska opened this issue Jan 18, 2021 · 0 comments · Fixed by #337
Closed

Incorrect django request validation for re_path urls #278

mnowakowska opened this issue Jan 18, 2021 · 0 comments · Fixed by #337

Comments

@mnowakowska
Copy link

When I'm trying to validate a django request against the defined schema I'm getting a validation error.

E           openapi_core.templating.paths.exceptions.PathNotFound: Path not found for https://brown.org/^my/url/$

../.pyenv/versions/3.9.0/envs/venv3.9.0/lib/python3.9/site-packages/openapi_core/templating/paths/finders.py:24:PathNotFound

My django url definition: re_path(r'^my/url/$', view())
My openapi schema url: /my/url/

I've debbugged a bit this issue and:
value of this line should be: 'my/url/'
but currently is '^my/url/$'

The value of request.resolver_match.route in my case is '^my/url/$'

I think the PATH_PARAMETER_PATTERN regex should be adjusted to escape also special characters like ^ and $ from request.resolver_match.route value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant