You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Usage: add `new SwaggerHttp4s(yaml).routes[F]` to your http4s router. Forexample:
* `Router("/docs" -> new SwaggerHttp4s(yaml).routes[IO])`.
**When using a custom `contextPath` is used, replace `/docs` with that value.
The problem I've encountered with this is when you go to the redirect path, /docs in this case, the url query parameter is an absolute path to /docs/docs.yaml:
At my work, we have our application deployed in a kubernetes infrastructure where the REST-based microservices are put under URI namespaces. For example, locally, I could reach my documentation at http://localhost:8000/docs, but in production it would be https://example.com/my-service/docs. The fixed and absolute path above would mean it would try to load the OpenAPI yaml at https://example.com/docs/docs.yaml, resulting in a 404.
In #318, I've made a suggested change so that the contextPath (normally defaulted to docs) is made relative to the http4s Root, thus addressing my above illustrated problem. Furthermore, it allows for the following routing:
So that your docs can sit at http://localhost:8000/v1/docs. This however means, if you wanted the docs at the root, you'd have to now instead do the following:
Router("/"->newSwaggerHttp4s(yaml).routes[IO]) // routes to /docs
IMO, this makes more sense, especially since it gives more meaning to the parameter name contextPath.
The text was updated successfully, but these errors were encountered:
As per the documented use:
The problem I've encountered with this is when you go to the redirect path,
/docs
in this case, theurl
query parameter is an absolute path to/docs/docs.yaml
:At my work, we have our application deployed in a kubernetes infrastructure where the REST-based microservices are put under URI namespaces. For example, locally, I could reach my documentation at http://localhost:8000/docs, but in production it would be https://example.com/my-service/docs. The fixed and absolute path above would mean it would try to load the OpenAPI yaml at https://example.com/docs/docs.yaml, resulting in a 404.
In #318, I've made a suggested change so that the
contextPath
(normally defaulted todocs
) is made relative to the http4sRoot
, thus addressing my above illustrated problem. Furthermore, it allows for the following routing:So that your docs can sit at http://localhost:8000/v1/docs. This however means, if you wanted the docs at the root, you'd have to now instead do the following:
IMO, this makes more sense, especially since it gives more meaning to the parameter name
contextPath
.The text was updated successfully, but these errors were encountered: