Swagger Api Generation for Flask-Mongorest

Flask-MongoRest-Swagger的Python项目详细描述


Flask Mongorest Swagger
=========



Flask Mongorest的Swagger API生成




example
----
rest API=Mongorest(app)
swagger=Swagger(rest API)

Class APIResource(mongorest.resource):
document=documentClass
parameters={
“额外参数”:参数('query','string',
'does something else')}


@swagger.register(url='/api endpoint')
类apiview(resourceview):
resource=apirource

@swagger.route(
'/api function',methods=['post'],
description='此API视图的说明',
终结点=[终结点(
终结点(
'/API函数/',
登录描述,
操作=[操作(
'发布','函数','更多说明!',
响应“token”,
参数={
“data”:参数(
“body”,“input”,“whatever you need to pass in”,
必需=true)},
错误响应={401:“无效电子邮件/密码”}),
models={
“input”:model('input',{
“input廑string”:property('string','input to the function')})、
“token”:model('token',{
“token”:property(
“string”,“the token which cours')})
def api廑function():
return“谢谢!”

这将生成一个可在<;http://localhost:5000/api docs.json>;上使用的招摇api


-
*swagger<;https://developers.helloreverb.com/swagger/>;
*flask<;http://flask.pocoo.org/>;
*flask mongorest<;https://github.com/elasticsales/flask mongorest>;
*matchbox<;http://matchbox.net/>;

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
空间计数器在Java中不起作用   json在java中表示XPath列表的最佳方式   java报警服务接收器安卓   java注入bean在自定义的all存储库中   java从迁移到Spring MVC 4+Hibernate5   JavaEclipseIDE透视图被缓存,更改没有任何影响   java Hibernate:在将对象插入Derby嵌入式数据库时引发SQLGrammerException   适用于mp4或mp3文件的java Exoplayer自动流媒体质量   安卓如何在java的静态方法中使用这个关键字?   SSL服务器端的spring主机名验证+Tomcat和Java 8   java Eclipse强制刷新IDs   java有可能返回Mono。只是从GetMapping(“/”)处理程序中获取(“索引”)吗?   arraylist当我用java编程时,我遇到了这个错误,有人能告诉我到底出了什么问题吗?   java如何更改Apache CXF web服务中的日期时间格式   Jfoenix ChipView中的java多线程   java任务在Spark上不可序列化