nearform / udaru

Open source Access Manager for node.js
https://nearform.github.io/udaru
MIT License
124 stars 19 forks source link

update of swagger json #532

Closed cianfoley-nearform closed 6 years ago

cianfoley-nearform commented 6 years ago

The only item required to updated when updating swagger docs is that we update the swagger-json.js file.

For some reason the script section that swagger-gen replaces stopped working recently so it is probably a safer approach to just update the json and js files when performing an update. This should probably form part of every commit.

We can probably remove swagger-gen at this point as currently it is not working.

I updated the getSwagger.json to take an optional command like parameter js to generate json and assign to variable, without it, it works as previously and just outputs the json stringified.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 93.002% when pulling 3c931b571217b85faea0aee28870f25743c0a397 on swagger-generation-issue into 28414a3067a2534f03c1fd4b3641e53f95b294cb on master.

ShogunPanda commented 6 years ago

In the https://github.com/nearform/trail repository I followed a different approach. The Swagger JSON file is generated on the fly, so we don't have to remember about scripts and similar.

Since the parsing is only done once on startup, there's no performance overhead (rather than keeping the small JSON file in memory).

Hope this helps!

cianfoley-nearform commented 6 years ago

I put swagger-ui-dist 3.14.1 (latest), into a subfolder of docs/swagger so that the distribution remains intact, if upgrading in future, this folder can be replaced wholesale...

Specific files we need such as the css, swagger-json.js and index.htm are in the root of docs/swagger

For future updates to docs this will keep the process of upgrading simple and stable.

swagger-gen npm command simply creates a swagger-json.js file, which index loads as per previous swagger-gen package.