swagger解析器提供有关swagger文件的有用信息
swagger-parser的Python项目详细描述
摇摆分析器
swagger parser是一个python模块,允许您访问有关swagger文件的一些有趣的数据。就像从定义名称中获取字典示例一样,获取字典的定义等等。
示例用法
fromswagger_parserimportSwaggerParserparser=SwaggerParser(swagger_path='swagger_path')# Init with fileparser=SwaggerParser(swagger_dict={})# Init with dictionary# Get an example of dict for the definition Fooparser.definitions_example.get('Foo')# Get the definition of a dictionarytest={'foo':'bar'}parser.get_dict_definition(test)# Validate the definition of a dictparser.validate_definition('Foo',test)# Validate that the given data match a path specificationparser.validate_request('/foo','post',body=test,query={'foo':'bar'})# Get the possible return value of a path# It will return a dictionary with keys as status_code# and value as example of return value.parser.get_request_data('/foo','post',body=test)# Get an example of a correct body for a pathparser.get_send_request_correct_body('/foo','post')
设置
进行安装或pip install swagger parser
1.0.0(2017-6-11)
- 放弃对python 2.6的支持,添加对python 3.5、python3.6和pypy的支持
- 解决问题#35
- Add file parser tests and fixes for #40, #41, #42, #43, #44, #45,感谢@mtherieau
- Use isinstance for simple type checking,感谢@pankaj28843
- Fixes for #31, #32, #33,感谢@crudo10和@beanqueen的评论
- Bug fix when dictionary only contains 1 element,感谢@tenos
- Add tests for “official” petstore json and yaml,感谢@beanqueen
0.1.11(2016-9-25)
- 支持其他属性。
0.1.10(2016-8-25)
- 如果没有定义,不要窒息
- 生成不带operationid的操作
- 从属性生成示例
0.1.9(2016-7-28)
- 支持数组定义。
0.1.8(2016-5-11)
- 支持类型字段为数组。
- 使用基本路径验证请求。
0.1.7(2016-4-1)
- 在swagger.yaml中支持utf-8。
0.1.6(2016-3-16)
- 添加对路径级别参数的支持。
0.1.5(2016-2-17)
- 添加对路径等级库中参数引用的支持。
0.1.4(2016-2-10)
- 将字符串作为状态代码处理。
0.1.3(2016-2-3)
- 修复get_response_示例中仅包含类型字段的架构的错误。
0.1.2(2016-2-3)
- 只支持类型字段的架构。
0.1.1(2016-1-31)
- 把执照改成麻省理工学院。
0.1(2016-1-28)
- pypi上的第一个版本。