Validate API against its Swagger using Hypothesis
Project description
# swaggercheck
You have a Swagger (aka OpenAPI) schema defining an API you provide - but does your API really conform to that schema, and does it correctly handle all valid inputs?
swaggercheck combines the power of hypothesis for property based / fuzz testing with pyswagger to explore all corners of your API - testing its conformance to its specification.
[![asciicast](https://asciinema.org/a/70ybJ8DqSG5u723GkHe3QMsU5.svg)](https://asciinema.org/a/70ybJ8DqSG5u723GkHe3QMsU5?t=25)
## Swagger-conformance
This project is a fork of [swagger-conformance by Oliver Pratt](http://swagger-conformance.readthedocs.io/en/latest/) and contributors.
The original library worked fine, but missed several options that were important to me (such as basic authentication support from the command line), so I made an adapted version that is breaking the original.
I don’t have plans for the moment contributing my changes upstream since it would be a significant effort to have a nice CLI and a nice embeddable library at the same time.
You could use swaggercheck as a library, but the purpose of the tool is to have a nice CLI that can output shiny colors in my terminal or in during CI builds, so most design decisions will be tailored towards this goal.
## Purpose
A Swagger/OpenAPI Spec allows you to carefully define what things are and aren’t valid for your API to consume and produce. This tool takes that definition, and tries to make requests exploring all parts of the API while strictly adhering to the schema. Its aim is to find any places where your application fails to adhere to its own spec, or even just falls over entirely, so you can fix them up.
_This is not a complete fuzz tester of your HTTP interface e.g. sending complete garbage, or to non-existent endpoints, etc. It’s aiming to make sure that any valid client, using your API exactly as you specify, can’t break it._
## Installation
$ pip install swagger-check
## Usage
After setup, the simplest test you can run against your API is just the following from the command line:
`bash swaggercheck 'http://example.com/api/schema.json' `
where the URL should resolve to your swagger schema, or it can be a path to the file on disk.
## Wait, I don’t get it, what does this thing do?
In short, it lets you generate example values for parameters to your Swagger API operations, make API requests using these values, and verify the responses.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for swagger-check-0.2.6.dev13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f2de421f2224f435236188f96a67ea3c5c22902c834171154bdaf0d9378135 |
|
MD5 | 28ef2e54495ae2adc11fac0e55e8e05c |
|
BLAKE2b-256 | 605059f2970a61f07a21c62965057dd6a3120c9669b04ad7701cf9983a92965f |