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

hideHostname also hides basePath #677

Closed
harold-padilla opened this issue Oct 19, 2018 · 4 comments
Closed

hideHostname also hides basePath #677

harold-padilla opened this issue Oct 19, 2018 · 4 comments

Comments

@harold-padilla
Copy link

As per the description hideHostname: if set, the protocol and hostname is not shown in the operation definition. It seems like hideHostname should only hide the schemes and the host as the description says. The Swagger spec. defines the basePath as a different element detached from the host (source: https://swagger.io/docs/specification/2-0/api-host-and-base-path/).

The basePath is an integral element of an endpoint and I believe it should be included even if hideHostname is enabled.

I reproduced this using the redoc in React and also the standalone version. See: redoc.html.txt.

@courtneyaschwartz
Copy link

@RomanHotsiy Sorry, do you remember why this was closed?

Facing the same problem. We're trying out the Pro version, but it has this issue, too.

@courtneyaschwartz
Copy link

courtneyaschwartz commented Jul 9, 2019

Seems this might be triggered by something in a Swagger/OpenAPI file. Older files we generated do not trigger this. Wasn't caused by our file. It is definitely linked to the hide-hostname option.

Sample API URL: https://example.com:4443/api/v1/endpoint
hide-hostname enabled...
Expected result: /api/v1/endpoint
Observed result: /endpoint

Maybe worth adding to ReDoc readme.md that if the OpenAPI file is missing the host and basePath properties, ReDoc doesn't leave it blank (like hide-hostname effect). Instead it injects a guess based on the current server hostname + path. (This will be wrong if you host your docs + API on different servers/in different URL structures. It might look like the effects of hide-hostname hence the confusion.)

@RomanHotsiy
Copy link
Member

I will investigate the issue with hide-hostname.

Maybe worth adding to ReDoc readme.md that if the OpenAPI file is missing the host and basePath properties, ReDoc doesn't leave it blank

It's in the OpenAPI Spec:

image

@courtneyaschwartz
Copy link

Missed that... Thanks.
Not an intuitive thing on the spec's part. (Most companies don't host docs on the same site as their API gateway. Organizational + UX + architecture + other reasons. They'd be better served by simply omitting, not guessing.) So might be worth 1 line in ReDoc readme's options list.

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

3 participants