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

Suggest to remove default swagger basePath value #63

Open
heesienooi opened this issue Jan 14, 2021 · 0 comments
Open

Suggest to remove default swagger basePath value #63

heesienooi opened this issue Jan 14, 2021 · 0 comments

Comments

@heesienooi
Copy link

Can I suggest to leave the default basePath value to be an empty string instead of '/'? Currently, the servers URL from the response swagger JSON is always having a trailing slash because of the default value and it doesn't have a way to remove it.

This creates a small problem when importing the JSON file into Postman. Postman can read the swagger JSON and automatically generate all API endpoints. However, the issue here is all the endpoints are having double slash due to the server URL having a trailing slash. To illustrate http://localhost:3000//login.

If we have a way to unset the default basePath or keep the basePath as empty. It would solve the issue.

Default swagger option basePath value:

Example of my swagger JSON from fastify-oas:

{
  "openapi": "3.0.0",
  "info": {
    "title": "API documentation",
    "description": "Test",
    "version": "1.0.0"
  },
  "components": {},
  "servers": [
    {
      "url": "http://localhost:3000/"
    }
  ],
  "paths": {
    ...

(I'm hoping to have a way to remove the trailing slash from the server 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