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

Validator doesn't work with custom server url #95

Open
sjiekak opened this issue Jun 2, 2020 · 0 comments
Open

Validator doesn't work with custom server url #95

sjiekak opened this issue Jun 2, 2020 · 0 comments

Comments

@sjiekak
Copy link

sjiekak commented Jun 2, 2020

We are running a pyramid app with the following open api yaml definition :

openapi: 3.0.1
info:
  title: Sample API
  contact:
    name: API Support
    email: some.private@email.com
  version: 1.0.0
  x-audience: external-public
  description: |
    # Minimum 

servers:
  - url: https://client.public.api.com/
    description: Production Server
paths:
  /test:
    get:
      summary: "test path"
      operationId: my.app.function
      responses:
        200:
          description: will always return ok

Requests to the endpoint /test will fail with Server not found for http://0.0.0.0:8080/test unless the default server is added to the servers object:

servers:
  - url: https://some.private.api.com/
    description: Production Server
  - url: /
    description: Validation URL

it seems the url validator try to resolve the url in the servers field.

https://github.com/p1c2u/openapi-spec-validator/blob/master/openapi_spec_validator/handlers.py#L25

The validator should use the default server url as a fallback if the provided url can't be resolved.
I would like to avoid displaying the Validation URL to the api user.

note : first version incorrectly assumed a query was made on the url.

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

1 participant