I'm trying to setup a complete edition solution for editing swagger (2.0) API using NodeJs on my local dev machine.
Previously i was using swagger-node to do that but the swagger-editor version used by this tool is pretty old and sometime buggy.
I would like to use the latest 3.0 swagger-editor.
Because of that i cannot use anymore swagger-node, so i have cloned the swagger-editor repo and use it.
It works like a charm, solve all my previous problems, but my worklow is less straightforward than before:
Every time i update the swagger spec in the editor i have to copy paste it to the swagger.yaml used by my local nodejs dev server.
(With swagger-node, the sync between the editor and my local file was done automatically)
Some my question is:
Is there any way to sync swagger-editor with a local file containing my swagger spec ?
Thanks !
Not at the moment, and I'm afraid it's not high on our priority list, especially because you can do it manually.
@ClementVidal I had the exact same problem. I hacked around and created a package. https://www.npmjs.com/package/swagger-editor-live
The code is pretty simple. I'm pretty sure you can just copy and paste and use it in your project or just use the package.
@moon0326 You saved me from insanity of copy pasting. Can you explain more on what you mean by "you can just copy and paste and use it in your project or just use the package"? Currently, in my project, I have a /server where my server is located, and a /api_doc where my swagger.yaml is located. I am able to just cd to my /api_doc, and run swagger-editor-live swagger.yaml. Is there an even better way to use your package?
@kamok no problem :) That's actually how I use it. I see some people install the package as a local package and add a script in their package.json like below then run node run swagger-edit to launch the package as well.
"scripts": {
"swagger-edit": "swagger-editor-live swagger.yaml"
}
I need this feature too.
Closing this as it's out of scope for Swagger-Editor itself.
@moon0326's solution is a good one to use while you're waiting for Swagger-Node to catch up :smile:
Most helpful comment
@ClementVidal I had the exact same problem. I hacked around and created a package. https://www.npmjs.com/package/swagger-editor-live
The code is pretty simple. I'm pretty sure you can just copy and paste and use it in your project or just use the package.