Skip to content
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

Error: namespace versioning path resolution failed for {url}. path will be ignored. #168

Closed
ruscooler opened this issue Oct 16, 2020 · 1 comment · Fixed by #169
Closed

Comments

@ruscooler
Copy link

While generating scheme, the following error appears in the logs:
Error #0: namespace versioning path resolution failed for /v1/accounts/{parent_lookup_account_transactions}/transactions/{id}/. path will be ignored.

I use drf-extensions for Nested Routes.
URL Pattern for url "/v1/accounts/{parent_lookup_account_transactions}/transactions/{id}/."
is
^accounts/(?P<parent_lookup_account_transactions>[^/.]+)/transactions/(?P<pk>[^/.]+)/$

I noticed, detype_pattern function transform my URLPattern to another one, but if I have more than one path parameter, it will return me unexpected result:

URL Pattern "^accounts/(?P<parent_lookup_account_transactions>[^/.]+)/transactions/(?P<pk>[^/.]+)/$" transforn to
"^accounts/(?P<parent_lookup_account_transactions>[^/.]+)/$"

I suppose it's a mistake in regular expression

@ruscooler ruscooler changed the title Error: namespace versioning path resolution failed for {url}. path will be ignored., Error: namespace versioning path resolution failed for {url}. path will be ignored. Oct 16, 2020
@tfranzel
Copy link
Owner

hey @ruscooler, that is indeed a bug in the regex. lazy is the way to go 😄 thanks for fixing it.

your proposed change is a significant improvement, although i just noticed that there are still ways to break it. like trying to match a literal paranthesis \) (regexr) in the pattern. however i'm assuming that this is a lot less frequent than having 2 or more variables.

i will merge it as is but if you want to come up with an even better regex i'm all for it.

tfranzel added a commit that referenced this issue Apr 30, 2021
replace still incorrect regex with parsing state machine.
regex are not cut out for parenthesis counting.
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.

2 participants