Skip to content

Incorrect django request validation for re_path urls #278

Closed
@mnowakowska

Description

@mnowakowska

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy