Forum Discussion
First, thank you for the response.
I've been able to add swagger, but up to a point. I've annotated the Java code and have added the dist folder to the project. I am able to get the json/yaml output and have also been able to display the Swagger UI, but the URL to the actual endpoint is wrong. I've tried various options but can't seem to get the Swagger UI to point to the correct URL for GET requests. I think it's a configuration issue but can't figure it out.
Is this what you mean? The URL you want to query against is not available in the drop down in Swagger UI?
If so, you need to add the proper URL to the available servers on your document. I'm not sure how to achieve this using a Swagger annotation tool, but it should be possible by editing the Swagger/OpenAPI document directly.
What you need to do is edit your "servers" tag to look like so:
Every value you add as a url to your servers tag will be added as an option to the dropdown list when the document is rendered in SwaggerUI. That way, when you "Try It Out" on one of your operations, the API call will be sent to the address you specified.
- gcorsar4 years agoOccasional Contributor
That might be a solution but it doesn't provide runtime flexibility. I noticed that in the index.html I can use variables to get the protocol/host/port but I don't see that possibility in the configuration file. Maybe I'm missing something though.
Related Content
- 4 years ago
Recent Discussions
- 3 days ago
- 4 days ago
- 14 days ago
- 31 days ago