amseager
amseager

Reputation: 6391

Is it possible to generate Openapi spec file from the another spec with slight modifications?

Suppose I have Openapi specification file (api-docs.yml). I need to create a copy of it with:

  1. different servers block
  2. 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.

Upvotes: 2

Views: 452

Answers (1)

Helen
Helen

Reputation: 97737

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.

Upvotes: 1

Related Questions