Suppose I have Openapi specification file (api-docs.yml). I need to create a copy of it with:
- different
servers
block - filtered
paths
by tag (with removing unnecessary schemas)
Do any solutions exist to make such things, or it’s only possible to write your own parser?
I’m using Java so Java-based solutions (maven plugins etc.) are preferred.
Advertisement
Answer
Do any solutions exist to make such things, or it’s only possible to write your own parser?
There are OpenAPI parsers for various programming languages. In Java, you can use Swagger Parser – use version 2.x for OpenAPI 3.0.x or v. 1.x for OpenAPI 2.0 (swagger: '2.0'
).
I think openapi-filter can filter content by tags, among other things.
You can also try using a YAML parser/processor such as yq.