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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fc97a575393d179d70e7c7ebd30ed9fc46eb6c5013f2790736c2e50ea150f06 |
|
MD5 | b34f2b0bf05064b0cceb16162972631e |
|
BLAKE2b-256 | b4c03d7b9a9f51f0d1b396036d14749cc3f470dc7983253ca4a3c904d3b2496c |
Close
Hashes for openapi_schema_validator-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7afe93aff4a876781279b376c1ba5decb338483e9484af26b140ef215119e23 |
|
MD5 | 31a182e0ea1c6e63cd35f8a633213e3b |
|
BLAKE2b-256 | 425d9149164c06a7dcb736d61d8c46eded3e9de7c097c4e660ff19981f063ca2 |
Close
Hashes for openapi_schema_validator-0.1.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f0b0f9086e7d717a0413a462d3d9e6f82f7e80a744abf21943ee2e0d9e8c50d |
|
MD5 | 50baa1d6e9e4570e82906facd049fce4 |
|
BLAKE2b-256 | 60d4a92ca5f5ffd5b6a256908755c101856c6600a83041f11ec976484030ff7b |