Search code examples
mongodbswaggerstorageopenapifull-text-indexing

How to store and organize swagger files?


Suppose I need to store and organize API documentation for ~1000 REST APIs. Each API provides a swagger file in JSON format and text files with images for guides, tutorials, and code examples. Users may update the documentation, browse and query it by API names, URLs, request fields, etc., and also search the text files.

I can probably store the text files and images in some cloud storage (e.g. S3) and create a full-text search index. I wonder how to store the swagger files. Should I store them just as the text files in a cloud storage or store them in a document database (e.g. Mongo) ?

What do you think ?


Solution

  • what do you mean by "swagger files" exactly? the generated output from openAPI schema files?

    I'm wondering why would you want to host that in a database? wouldn't be so much easier to have an S3 bucket per "REST API" and make that bucket a static web server instead? making it automatically accessible and never dependent on a connection to a secondary service?

    you might still want to use the DB to organize user/editors/admins, but ultimately I would simply host everything in a CDN and make sure to override when a new update is generated and clear the cache (CloudFront), you can even have "folders" to host a version in that bucket so user could easily revert back to a previous version if any mistake...

    won't you agree?