Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

server url and routes autogeneration #194

Open
mattiaverga opened this issue Dec 12, 2022 · 1 comment
Open

server url and routes autogeneration #194

mattiaverga opened this issue Dec 12, 2022 · 1 comment

Comments

@mattiaverga
Copy link

I can't found an example that covers my case, so it may be me doing something wrong.

I've put this in pyramid config:

config.include("pyramid_openapi3")
config.pyramid_openapi3_spec_directory(
    os.path.join(os.path.dirname(__file__), 'openapi', 'openapi.yaml'), route='/api/v2/spec')
config.pyramid_openapi3_add_explorer(route='/api/v2')

config.pyramid_openapi3_register_routes()

and in openapi.yaml file I have:

servers:
  - url: /api

paths:
  /v2/users/:
    x-pyramid-route-name: users_api_v2

I get a 404 Page Not Found for /api/v2/users/, while /v2/users/ works (but doesn't validate against the server, obviously).
To make things work I have to set the server as just / and move api to the path. Is that how it is supposed to work, or route autogeneration doesn't work right?

@zupo
Copy link
Collaborator

zupo commented Dec 12, 2022

The test does not set servers, so it is entirely possible that there is a bug. Can you try changing this test to set servers and see if it fails?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants