在Firebase Cloud Functions项目中生成Swagger文档 [英] Generating Swagger Docs in Firebase Cloud Functions project
问题描述
是否可以从firebase云函数中的函数注释生成Swagger Spec文件?如果是这样,我们该怎么办?
Is it possible to generate Swagger Spec file from function comments in firebase cloud functions? If so, how can we do it?
我看到云功能代码更像是无服务器的代码,所以想知道这是否可能.
I see the cloud functions code to be more like serverless, so wondering if this is possible.
推荐答案
我还没有找到一种自动方法,但是有很多库可供选择.
I haven't found an automatic way, but there are plenty of libraries to choose from.
我在Firebase Function实现中使用express和nodejs,对我来说, 可以通过以下库来实现Swagger文档生成: https://github.com/scottie1984/swagger-ui-express https://github.com/Surnet/swagger-jsdoc
I'm using express and nodejs in my Firebase Function implementations, and for me, Swagger doc generation can be implemented via the following libraries: https://github.com/scottie1984/swagger-ui-express https://github.com/Surnet/swagger-jsdoc
您可以在以下位置找到其他库: https://swagger.io/tools/open-source/open-source -integrations/
You can find other libraries at: https://swagger.io/tools/open-source/open-source-integrations/
这将创建一个新的HTTP终结点,该终结点将为不可靠的文档的HTML页面提供服务.
This will create a new HTTP endpoint, which will serve an HTML page of a swagger doc.
这篇关于在Firebase Cloud Functions项目中生成Swagger文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!