jj mocks validator for openapi specs
Project description
Usage
- Decorate your mocked function with
@validate_spec()
, providing a link to a YAML or JSON OpenAPI spec.
import jj
from jj.mock import mocked
from jj_spec_validator import validate_spec
@validate_spec(spec_link="http://example.com/api/users/spec.yml")
async def your_mocked_function():
matcher = jj.match("GET", "/users")
response = jj.Response(status=200, json=[])
mock = await mocked(matcher, response)
- Control discrepancy handling with
validate_level
key:"error"
(default, raises error)"warning"
(prints warning, continues execution)"skip"
(skips validation)
@validate_spec(spec_link="http://example.com/spec.yml", validate_level="warning")
is_strict
key (in development) will allow choosing between strict and non-strict comparison. Currently, non-strict comparison is used.
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
Built Distribution
Close
Hashes for jj_spec_validator-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46fa25f148c9db2a706b1c424530a0e262f44ef98cbee6acc3f0a8b51e9771a8 |
|
MD5 | 38c059c0bf936fadb8ac94e66891243c |
|
BLAKE2b-256 | d862eb3984404d51fc0a3d032363321b4c81cf5472c6a76603dfcac3032e2b6c |