Using swagger-codegen with multiple swagger files

swaggerswagger-codegen

Our project uses multiple swagger files for a single API, yet it appears swagger-codegen only accepts one. How do we generate code with swagger-codegen in this case?

Best Answer

You can use relative schema file. e.g.

$ref: 'Pet.yaml'

Ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#relative-schema-file-example

If the swagger files are not linked/related to each other, then you will need to combine the swagger files into a single file and use tags to classify the operations. e.g.

Related Topic