Local Swagger Design and refs to folders for importing

11 views
Skip to first unread message

Timothy Lavelle

unread,
May 22, 2018, 9:22:41 AM5/22/18
to Swagger
Hi,

I'm working on designing quite a few APIs and my current Swagger file in the online editor is quite large. I'd like to bring it all to my local dev environment and structure my $ref into logical folder structures for the components I share globally and across different paths. I use MS Code as my editor and am wondering if I can design locally and compile the final yaml file for viewing in my local SwaggerUI editor. 

Example of my local folder structure:
[root]
- [components]
-- [requestBodies]
--- myFile1.yaml
--- myFile2.yaml
-- [responses]
--- 200.yaml
--- 400.yaml
--- 500.yaml
-- [schemas]
--- [content]
---- contentItem.yaml
--- [cta]
---- ctaItem.yaml
--- [media]
---- mediaItem.yaml
--- [shared]
---- animationAttr.yaml
-- meta_data.yaml
-- [securitySchemas]
--- auth.yaml
- [models]
-- apiServers.yaml
-- contact.yaml
- index.yaml


The above is a sample of what my folder structure looks like and the index.yaml file is the main file I want to compile everything into and the file I want the SwaggerUI editor to import so I can see the live documentation. 

Has anyone else done anything similar and if so, what tools did you use to get this all working?

Thanks!

Timothy Lavelle

unread,
May 22, 2018, 9:34:37 PM5/22/18
to Swagger
Just as a FYI for others who might be trying to do the same thing, after following this link I was able to get exactly what I wanted done. 

Skip to the end where it has a link to the Github to run a CLI command to merge all the files into a single yaml
Reply all
Reply to author
Forward
0 new messages