Reputation: 667
I'm developing a new API using Slim Framework (v3). I'm trying to integrate this API with Swagger UI, but when I click "Try it" button, Swagger generates the following link.
Example link:
http://localhost/api/public/contact?param1=1¶m2=2param3=3
It's correct if I don't use Slim, but a link for Slim API is like:
http://localhost/api/contact/1/2/3
What I want is that Swagger use a link to Slim API, how can I do to achieve that? I can't find a way to "translate" the link format.
I'm using Swagger-php for comments (annotations).
I hope you can help me. Thanks.
Upvotes: 1
Views: 3244
Reputation: 6824
You have a couple different options.
First Swagger-ui won't show that link unless it's defined somewhere (i.e the basePath
attribute) or left undefined. It sounds like there's something missing there.
Next, you can always override the basePath
in your API like such:
window.swaggerUi.api.setBasePath('/api');
Which should take away the /api/public
section.
It's a little difficult to debug without seeing your JSON or YAML swagger definition but those two techniques should get you over the hump.
Upvotes: 1