lollipop-jsonschema
Library to convert Lollipop schema to JSON schema.
Example
import lollipop.types as lt
import lollipop.validators as lv
EMAIL_REGEXP = r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"
USER = lt.Object({
'name': lt.String(validate=lv.Length(min=1)),
'email': lt.String(validate=lv.Regexp(EMAIL_REGEXP)),
'age': lt.Optional(lt.Integer(validate=lv.Range(min=18))),
}, name='User', description='User information')
from lollipop_jsonschema import json_schema
import json
print json.dumps(json_schema(USER), indent=2)
# {
# "title": "User",
# "description": "User information",
# "type": "object",
# "properties": {
# "age": {
# "type": "integer",
# "minimum": 18
# },
# "name": {
# "type": "string",
# "minLength": 1
# },
# "email": {
# "type": "string",
# "pattern": "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$"
# }
# },
# "required": [
# "name",
# "email"
# ]
# }
Installation
$ pip install lollipop-jsonschema
Requirements
Python >= 2.7 and <= 3.6
lollipop >= 1.1.5
Project Links
License
MIT licensed. See the bundled LICENSE file for more details.
Metadata
Release files for lollipop-jsonschema 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lollipop-jsonschema-0.8.1.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lollipop_jsonschema-0.8.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.8 kB
Release files / lollipop-jsonschema-0.8.1.tar.gz
| Download URL | lollipop-jsonschema-0.8.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
502189a17fcb036f19d1d8ee5364fa4ef349407f3049def21cbb32d974102583
|
|
BLAKE2b-256 checksum How to use checksums |
d4de2c06aae8090fd61c616c98b08c24249d34ffa176fc8b9b84973b12c9b098
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lollipop_jsonschema-0.8.1-py2.py3-none-any.whl
| Download URL | lollipop_jsonschema-0.8.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0442503f222e2aee392e068b7a6b9eeee0bc038abb6efc21bd13c1c81f8ed4d2
|
|
BLAKE2b-256 checksum How to use checksums |
ebeecbc74a3eaf2f465928e93a2d6fbced3fafb388d93903d80df3c44d89046b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |