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

basePath value of the openapi spec at /openapi should reflect the actual path #432

Open
elakito opened this issue Jun 18, 2020 · 2 comments

Comments

@elakito
Copy link
Contributor

elakito commented Jun 18, 2020

Currently, the openapi 2.0 spec returned at /openapi is statically set to /. When the Kafka-Bridge instance is behind a gateway and the gateway is taking requests at path e.g., /app/kafka-bridge and reverse-proxing to the bridge instance at path /, it would be more convenient if the returned openapi spec has basePath being set to /app/kafka-bridge instead of /, when the x-forwarded-prefix header of the request is available to derive the actual request path.

In this case, the client can, for example, issue a topics request at /app/kafka-bridge/topics instead of at /topics, knowing the correct basePath for this particular bridge instance.

This ticket is resulted from this preceding discussion
#375 (comment)

@ppatierno
Copy link
Member

@elakito I have just noticed that basePath is something only supported by OpenAPI 2.0.
With OpenAPI 3.0, the new servers section is used.
Our plan is about getting rid of OpenAPI 2.0 specification soon, providing the 3.0 specification on the /openapi endpoint so I was wondering how much it makes really sense to do the change in the #433

@elakito
Copy link
Contributor Author

elakito commented Jul 9, 2020

@ppatierno if we are getting rid of openapiv2 any time soon, we won't need the v2 specific change. If we switch to return openapi(v3) at /openapi, we could either use a similar approach to overwrite the server's url between '/' or '/prefix-path' or simply use a variable notation '{basePath}' for that property and set its default value to '/' so that the consumer can decide on its value. For the latter case, we would just need a change in the spec file.

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