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

possibility to remove host in configuration #255

Open
spinettaro opened this issue Aug 3, 2020 · 1 comment
Open

possibility to remove host in configuration #255

spinettaro opened this issue Aug 3, 2020 · 1 comment

Comments

@spinettaro
Copy link

spinettaro commented Aug 3, 2020

Hi all,

is there a way to remove the host from final swagger file?
I read other issues and I know that is possible to set it to empty string or null, but it is not good for OPEN API specification and consequentially validation - https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md .

I have to achieve this If host is not specified, it is assumed to be the same host where the API documentation is being served. .
and the only way to achieve that and be valid for API specification I have to remove completely the host key.

Any suggestions?

@AndriiKlymchuk
Copy link

@spinettaro, I also faced this problem. The solution is to remove ednpoint from phoenix_swagger config.

config :myapp, :phoenix_swagger,
  swagger_files: %{
    "priv/static/swagger.json" => [
      router: MyApp.Router,
      endpoint: MyApp.Endpoint # <--- remove this line
    ]
  },
  json_library: Jason

If endpoint is not set and host is not specified in swagger_info/0 callback, then host key is omitted in swagger.json

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

2 participants