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.7
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.7.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lollipop_jsonschema-0.7-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 15.8 kB
Release files / lollipop-jsonschema-0.7.tar.gz
| Download URL | lollipop-jsonschema-0.7.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd60fb3957c92c0ec6ea554a1aee5a5a6167a3bd27bf19b8da3f30e904d1e984
|
|
BLAKE2b-256 checksum How to use checksums |
1e86dfa7a22b4003efef4f86f8528a580c14d90a688018be6a602e291b6c8381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lollipop_jsonschema-0.7-py2.py3-none-any.whl
| Download URL | lollipop_jsonschema-0.7-py2.py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
885f5da1d64708341136615c1bbd51d025aebcbceb3f08f6eef699aa1068abb4
|
|
BLAKE2b-256 checksum How to use checksums |
3f43abbc785ca65c9d70d93ac050dbdee8e13229223817c56efb130e57c774f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |