Split API spec into multiple YAML files?

Not applicable

I want to split the API specification into multiple files so that there are different files for models and endpoints. I searched the forum and the last discussion was from 2015.

We are using Apigee edge cloud and setting up our dev workflow.

  • Is it possible to split API spec and use relative referencing?
  • If not, what approach do you take to organize large projects with multiple APIs and endpoints?
0 2 964
2 REPLIES 2

Not applicable

I have done in the past by leveraging JSON Refs with two libraries:

In essence what you need is to write a representation of OpenAPI Spec in JSON format with references to either local or remote (by URL) resource. What you'll end up having is a single JSON Spec, which you can be used directly with any OpenAPI Spec tool or module as they support JSON representation as well. If you want to convert the JSON OpenAPI Spec into YAML, no problem, there are a bunch of libraries that handle this for you programmatically e.g. yamljs.

You might also wonder how to handle other tasks to handle deployment. Take a look at DevJam Lab 3 - Build and Deploy using Maven, Grunt and Jenkins tutorial written by @Srinandan Sridhar.

Hope it helps! Let us know if you have any questions.

Thanks. I'll check these out.