cancel
Showing results for 
Search instead for 
Did you mean: 

Can I split my swagger (openapi 3.0.3) spec over multiple YAML files?

Nixol
Occasional Contributor

Can I split my swagger (openapi 3.0.3) spec over multiple YAML files?

I currently have an API  spec in YAML which is becoming too large.  I am just wondering if it is possible to split the specification into smaller YAML files and still achieve the same result.  Can this be done?

2 REPLIES 2
GraceKarina
Staff

Re: Can I split my swagger (openapi 3.0.3) spec over multiple YAML files?

Hi, Yes you can split your main yaml file into others by using the $ref field in the objects that apply.

Nixol
Occasional Contributor

Re: Can I split my swagger (openapi 3.0.3) spec over multiple YAML files?

Thanks @GraceKarina .  When trying to use the $ref, I got this error message: 

Could not resolve reference: Tried to resolve a relative URL, without having a basePath. path: '/Users/xxxxxxx/Downloads/abcdef.yaml' basePath: 'undefined'.

The file I am trying to reference is in the folder "/Users/xxxxxxxx/Downloads/", Is there anything I am doing wrong?  Is there any example I  can see?

New Here?
Join us and watch the welcome video:
Announcements