5

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.

3

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.