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.2
Project Links
License
MIT licensed. See the bundled LICENSE file for more details.
Metadata
Release files for lollipop-jsonschema 0.5
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.5.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lollipop_jsonschema-0.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 15.4 kB
Release files / lollipop-jsonschema-0.5.tar.gz
| Download URL | lollipop-jsonschema-0.5.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
164973269ad5a21f6dbfade9c309e73edbde635d4cee42bd79295ae91dd119df
|
|
BLAKE2b-256 checksum How to use checksums |
750fb8e73642b0c114ec6166e34cae5c24871c8d6eb5c9abea9685561368f129
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lollipop_jsonschema-0.5-py2.py3-none-any.whl
| Download URL | lollipop_jsonschema-0.5-py2.py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0b0b00550392bd42dcc9702e1f6c8d3700f60fd08ac7ea71a4ff10d6f5e90d4b
|
|
BLAKE2b-256 checksum How to use checksums |
66db7a5882a0b5a08b24bd8d2cc808cbb43794b35b5493ae86f2b321997c6266
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |