victorio
victorio

Reputation: 6636

Multiple API documentation in one Swagger file

Is it possible to have multiple (somehow separated) REST API documentations but only in one swagger yaml file?

Or can the swagger yaml contain only one API documentation?

Because I have 2 REST API developed by me, and I want to have a common swagger ui instead of two, which I could manage with a gateway like Tyk.

Upvotes: 5

Views: 13436

Answers (1)

Nikola Andreev
Nikola Andreev

Reputation: 634

You can do it with swagger.io tags

For example in spring (springfox-swagger) you need just to put the same tag on multiple API classes and it will merge them in one group in the swagger UI.

@Api(value = "First API", tags = {"first-api"})  
public class FirstApi { ... }

@Api(tags = {"first-api"})  
public class SecondApi { ... }

In the swagger UI you will see only one API (first-api) with all the methods inside from both classes.

Upvotes: 1

Related Questions