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

OpenAPI 3 relative server urls are marked as invalid. #59

Open
tdextrous opened this issue Jul 20, 2020 · 1 comment
Open

OpenAPI 3 relative server urls are marked as invalid. #59

tdextrous opened this issue Jul 20, 2020 · 1 comment

Comments

@tdextrous
Copy link

When using relative server urls in OpenAPI 3.0 like shown:

"servers": [
  {
    "url": "/api/foo"
  }
]

An error is thrown:

TypeError [ERR_INVALID_URL]: Invalid URL: /api/foo

Stack trace points to the error occurring here. It seems that all values in the url field are assumed to be complete urls. Is there some way we can check for a relative url before passing to the URL constructor?

@spasquali-ww
Copy link

spasquali-ww commented Sep 27, 2020

Using "api-schema-builder": "^2.0.3"

This also fails as INVALID_URL

servers:
  - url: '{protocol}://api.example.com'
    variables:
      protocol:
        enum:
          - http
          - https
        default: https

May be related to swagger-api/swagger-parser#1329

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

No branches or pull requests

2 participants