Skip to content

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

Closed
@balchugovg

Description

@balchugovg

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions