在 Firebase Cloud Functions 项目中生成 Swagger 文档 [英] Generating Swagger Docs in Firebase Cloud Functions project

查看:18
本文介绍了在 Firebase Cloud Functions 项目中生成 Swagger 文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从 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 函数实现中使用 express 和 nodejs,对我来说,Swagger 文档生成可以通过以下库实现:https://github.com/scottie1984/swagger-ui-expresshttps://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-整合/

You can find other libraries at: https://swagger.io/tools/open-source/open-source-integrations/

这将创建一个新的 HTTP 端点,它将提供一个 swagger 文档的 HTML 页面.

This will create a new HTTP endpoint, which will serve an HTML page of a swagger doc.

这篇关于在 Firebase Cloud Functions 项目中生成 Swagger 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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