http-swagger icon indicating copy to clipboard operation
http-swagger copied to clipboard

Make doc.json filename configurable.

Open jeffreydwalter opened this issue 4 years ago • 3 comments

If I do:

r.Get("/swagger/*", swagger.Handler(swagger.URL("http://localhost/swagger/doc.json")))

returns the swagger json at http://localhost/swagger/doc.json.

I would like to make the json available at http://localhost/swagger/swagger.json. If I do:

r.Get("/swagger/*", swagger.Handler(swagger.URL("http://localhost/swagger/swagger.json")))

I get a 404.

Is there a way to do that currently? If not, would you accept a PR to enable it?

jeffreydwalter avatar Oct 02 '21 02:10 jeffreydwalter

Hi @jeffreydwalter, We don't have this kind of customization available. If this is really important to you please feel free and contribute with a PR.

Thanks.

ubogdan avatar Oct 02 '21 10:10 ubogdan

Using swag init produces swagger.json, why would that not be the default? Am I missing something here?

nickkieffer avatar Feb 09 '22 18:02 nickkieffer

The HTTP handler uses the documentation that is embedded in the docs.go file.

ubogdan avatar Apr 16 '22 06:04 ubogdan