如何存储和组织 swagger 文件? [英] How to store and organize swagger files?

查看:68
本文介绍了如何存储和组织 swagger 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我需要为大约 1000 个 REST API 存储和组织 API 文档.每个 API 都提供 JSON 格式的 swagger 文件和带有用于指南、教程和代码示例的图像的文本文件.用户可以更新文档,通过API名称、URL、请求字段等进行浏览和查询,也可以搜索文本文件.

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.

我可能可以将文本文件和图像存储在某些云存储(例如 S3)中并创建全文搜索索引.我想知道如何存储 swagger 文件.我应该将它们作为文本文件存储在云存储中还是将它们存储在文档数据库(例如 Mongo)中?

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) ?

你怎么看?

推荐答案

swagger 文件"是什么意思?确切地?从 openAPI 模式文件生成的输出?

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

我想知道您为什么要将其托管在数据库中?每个REST API"拥有一个 S3 存储桶不会容易得多;并将该存储桶设为静态网络服务器?使其自动访问并且从不依赖于与辅助服务的连接?

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?

您可能仍想使用数据库来组织用户/编辑者/管理员,但最终我只会将所有内容托管在 CDN 中,并确保在生成新更新时覆盖并清除缓存 (CloudFront),您可以甚至有文件夹"在该存储桶中托管一个版本,以便用户可以在出现任何错误时轻松恢复到以前的版本...

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...

你不同意吗?

这篇关于如何存储和组织 swagger 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆