Open DALDEI opened 8 years ago
Look at resolve.js. You basically point to the root file of your Swagger structure (index.yaml
in my case) and after passing it to JsonRefs you get the resolved file in the callback. I'm using console.log to print it out, but you can do whatever you want with it.
Yes, you need Node.js and yes should install the dependencies using npm i
.
Ideally, it would be nice for you to show us how to then serve the resolved file at an endpoint so a Swagger-UI can pick it up.
+1
I found your blog and this site searching for splitting up swagger docs and its very informative. Until I tried it - then it became obvious to me that its not obvious. For exmaple I'm using swagger2markup https://swagger2markup.readme.io/docs/gradle-plugin and it doesn't recognize the structure or refs at all. Looking at the .json and .js files present is a 'clue' that they are used for something ... what exactly ? Guessing by other swagger tools I've seen (such as swagger-ui and swagger-editor) I'm guessing this requires node.js -- so I tried 'npm install' which does something ... but not sure what besides downloading 375 files.
From this I'm guessing this technique is only for use within swagger-editor and swagger-ui ?
A few lines on how one is expected to 'run' or 'use' this example would be useful