Skip to content

pyramid_openapi3 messes up routes when the server prefix matches #146

Description

@Wim-De-Clercq

openapi.yaml:

servers:
  - url: /v
paths:
  /version:
    get:
      ...

pyramid config:

config.add_route("version", "/version")

(along with this config to deal with the prefix on the server)

[filter:paste_prefix]
use = egg:PasteDeploy#prefix
prefix = /v

This code

def remove_prefixes(path):
path = f"/{path}" if not path.startswith("/") else path
for prefix in prefixes:
if path.startswith(prefix):
prefix_length = len(prefix)
return path[prefix_length:]
return path

Will remove the /v from /version and then complain that route "/version" is missing even though it is clearly present in the code. Are prefixes ever part of the route that they need to be removed?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions