No project description provided
Project description
About
Openapi-schema-validator is a Python library that validates schema against the OpenAPI Schema Specification v3.0 which is an extended subset of the JSON Schema Specification Wright Draft 00.
Installation
Recommended way (via pip):
$ pip install openapi-schema-validator
Alternatively you can download the code and install from the repository:
$ pip install -e git+https://github.com/p1c2u/openapi-schema-validator.git#egg=openapi_schema_validator
Usage
Simple usage
from openapi_schema_validator import OAS30Validator, oas30_format_checker
# A sample schema
schema = {
"type" : "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer",
"format": "int32",
"minimum": 0,
"nullable": True,
},
},
"additionalProperties": False,
}
validator = OAS30Validator(schema)
# If no exception is raised by validate(), the instance is valid.
validator.validate({"name": "John", "age": 23})
validator.validate({"name": "John", "city": "London"})
Traceback (most recent call last):
...
ValidationError: Additional properties are not allowed ('city' was unexpected)
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 Distributions
Close
Hashes for openapi-schema-validator-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79f29b2b035e415ac641084a9cc4cc34174f43c13e38c691828f35890d1a8abb |
|
MD5 | c45c7e9e9d38efb9c4dd99a2e57bc9b9 |
|
BLAKE2b-256 | 64205a9ea4ee190b9131def500a0ebb0121d8f5e66195e5a127d3759b8e176fb |
Close
Hashes for openapi_schema_validator-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 193d7b74cfe4e98a5d11b1305875b20d9da37eaf4fcb19587a253b49083bd338 |
|
MD5 | fc2a7e306b145dee5cd2f40532c5719d |
|
BLAKE2b-256 | 68a1530f56a341f04023af52508f18e8884ba0c85479d0c984fe39d38b268a00 |
Close
Hashes for openapi_schema_validator-0.1.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059cd9d908ef90941cd902abccbba70c222b1c185205afa993a18fc966a01608 |
|
MD5 | c47ac97c6892cb064189e8e0b3ae70a1 |
|
BLAKE2b-256 | 0a3c87f212c7ca53218df3096f5e4b3ee112503aafe0a1b0daec7292c4575657 |