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

[Bug]: PathNotFound exception if templated path parameter contains "-" character #672

Open
balchugovg opened this issue Sep 20, 2023 · 1 comment
Labels
area/templating Indicates an issue on templating area kind/bug/confirmed kind/bug Indicates an issue

Comments

@balchugovg
Copy link

Actual Behavior

when trying to validate my request, I encountered an error:
..\venv\Lib\site-packages\openapi_core\templating\paths\finders.py:35: PathNotFound

seems to be a problem with the search function from openapi_core.templating.util

Expected Behavior

print(search(path_pattern_fail, name)) # <Result () {'user-id': '1647222638'}>

Steps to Reproduce

from openapi_core.templating.util import search

path_pattern_pass = '/local/sub/{user_id}/duration'
path_pattern_fail = '/local/sub/{user-id}/duration'
name = 'https://dummy_server.com/local/sub/1647222638/duration'

print(search(path_pattern_pass, name))  # <Result () {'user_id': '1647222638'}>
print(search(path_pattern_fail, name))  # None

OpenAPI Core Version

0.18.1

OpenAPI Core Integration

Requests

Affected Area(s)

No response

References

No response

Anything else we need to know?

No response

Would you like to implement a fix?

None

@balchugovg balchugovg added the kind/bug Indicates an issue label Sep 20, 2023
@p1c2u p1c2u added kind/bug/confirmed area/templating Indicates an issue on templating area labels Sep 25, 2023
@p1c2u
Copy link
Collaborator

p1c2u commented Sep 25, 2023

Hi @balchugovg

thanks for the report. I'm aware of the limitation of current template variables search mechanism, unfortunately I have limited knowledge in python Parser area to fix the issue so for now - and ~ special characters are not supported in path parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/templating Indicates an issue on templating area kind/bug/confirmed kind/bug Indicates an issue
Projects
None yet
Development

No branches or pull requests

2 participants