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

support variables in the server config #178

Open
mmerickel opened this issue Oct 25, 2022 · 2 comments
Open

support variables in the server config #178

mmerickel opened this issue Oct 25, 2022 · 2 comments

Comments

@mmerickel
Copy link
Member

mmerickel commented Oct 25, 2022

servers:
  # - url: '/connect/api/v1' <-- required because below is not supported
  - url: '{connectUrl}/api/v1'
    variables:
      connectUrl:
        default: '/connect'
        description: The base URL of the server, including any subpaths to the connect site.
paths:
  /challenges/change-password:
    post:
      # <snip ...>

2022-10-25 14:55:22,889 ERROR [pyramid_openapi3][request=e4deab37-061d-4d3b-8119-ff3a09842061] 2.1 Server not found for http://localhost:5000/connect/api/v1/challenges/change-password

The following doesn't work unless I uncomment the extra server directive which kind of defeats the point of it being variable. Is there a way to turn off the validation entirely or do something to define the server directive more clearly? I think I'd like to be able to pass in a config-time value for the variable that I know when invoking config.pyramid_openapi3_spec(..., server_variables={'connectUrl': '/connect'})

This issue is directly related to #104 and #105 where I simply cannot get the openapi definition to work with an unknown subpath and could use some help. Everything in my document is defined relative to request.application_url but nothing doing the validation is aware of that.

@zupo
Copy link
Collaborator

zupo commented Oct 26, 2022

Validation can be turned off, but sadly only very broadly: https://github.com/Pylons/pyramid_openapi3#endpoints--request--response-validation

Can you provide a minimal example with code & test that shows exactly how you'd like it to work?

@goodwillcoding
Copy link
Member

@mmerickel I am running into the same problem, got mounted rutter apps and no way to pass in the mount point. Did you ever find a way to address this?

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

No branches or pull requests

3 participants