Recently I had a requirement to publish a Swagger spec. My preferred method as a consumer would always be to have the JSON or YAML available to post to the Swagger Editor, because that tool offers the ability to generate code. But here the recipient just wanted to view it. So I looked at running the Swagger UI tool somewhere. Hosting via Docker was not, at this point, an option. So the download took me to the GitHub repo.

I have to admit to being a little confused by the documentation on deployment. The options just seemed to talk about embedding it in another web application, either npm or not. I was hoping for an option to just install Node.JS, build with some configuration of port etc and go. It looks like you have to build the web server component (which isn’t hard, admittedly) yourself. I think.

But the swagger-ui-dist module doesn’t need Node.JS and runs standalone. A quick test of putting it in the domino/html folder, amending the index.html to point to my spec and it was working. Very nice.

But this isn’t a Swagger spec that needs to be public access. So I tried importing the files as File Resources into an NSF. Not surprisingly, it just worked – it’s a method used for deploying JavaScript web apps by many for years, so of course it would. And with some simple configuration of the ACL, I now have a fully secured Swagger UI ready to share with only those who need to see it. This may not please the Node.JS purists, but it’s RADD and secure in a foolproof manner. Replace the Swagger spec in the design, and I have an updated version deployed with zero downtime. Need more people to see it or the revoke access? Just update the ACL. No hacks, no quirks, just standard and best of breed. Combining Domino’s strengths with modern development techniques is a compelling story.

1 thought on “Publishing a Secured Swagger Spec”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.