Generating Swagger Docs in Firebase Cloud Functions project

自古美人都是妖i 提交于 2020-05-25 11:27:14

问题


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.


回答1:


I haven't found an automatic way, but there are plenty of libraries to choose from.

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

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

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




回答2:


There is not an automatic way to do this at this time. I think you could build your own but seems like it would be a lot of work.



来源:https://stackoverflow.com/questions/49573560/generating-swagger-docs-in-firebase-cloud-functions-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!