跳转到主要内容

测试您的swagger规范

项目描述

Swaggertest

这是一个非常简单的工具,用于测试swagger(OpenAPI)规范。特别是,它将文档中'components/schemas'部分提供的模式与随模式一起提供的任何示例进行比较。

安装

$ pip install swaggertest

用法

$ swaggertest --help
usage: swaggertest [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]
[--pdb]

Swagger testing tool

optional arguments:
  --version            show program's version number and exit
  -v, --verbose        Increase verbosity of output. Can be repeated.
  -q, --quiet          Suppress output except warnings and errors.
  --log-file LOG_FILE  Specify a file to log output. Disabled by default.
  -h, --help           Show help message and exit.
  --debug              Show tracebacks on errors.
  --pdb

Commands:
  complete       print bash completion command (cliff)
  help           print detailed help for another command (cliff)
  test-schemas   Validate examples against schemas

主要的子命令是 test-schemas

$ swaggertest help test-schemas
usage: swaggertest test-schemas [-h] [-d] [-p PATH] [-s] filename

Validate examples against schemas

positional arguments:
  filename

optional arguments:
  -h, --help            show this help message and exit
  -d, --detail
  -p PATH, --path PATH  Path to where the schemas are located
  -s, --strict          Default to 'allowExtraProperties: false'

要测试规范,只需将其作为 filename 参数提供。您还可以提供路径参数来指定模式所在的路径

$ swaggertest test petstore.json --path '/definitions' --detail --strict
Validated 6 schemas:
  - 0 had errors

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源代码分布

swaggertest-0.1.1.tar.gz (4.5 kB 查看哈希值)

上传时间 源代码

构建分布

swaggertest-0.1.1-py3-none-any.whl (9.3 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWSAWS 云计算和安全赞助商 DatadogDatadog 监控 FastlyFastly CDN GoogleGoogle 下载分析 MicrosoftMicrosoft PSF赞助商 PingdomPingdom 监控 SentrySentry 错误日志 StatusPageStatusPage 状态页面