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.2
Project Links
License
MIT licensed. See the bundled LICENSE file for more details.
Metadata
Release files for lollipop-jsonschema 0.6
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.6.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lollipop_jsonschema-0.6-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 15.8 kB
Release files / lollipop-jsonschema-0.6.tar.gz
| Download URL | lollipop-jsonschema-0.6.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8d49a6505269b909842a645588a9e2c039daef8001cd2823e92527954a2f7f4
|
|
BLAKE2b-256 checksum How to use checksums |
665be4ecde2ae836adc180fe53f54db872196e4438781d554e9eafa1e16c7ed1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lollipop_jsonschema-0.6-py2.py3-none-any.whl
| Download URL | lollipop_jsonschema-0.6-py2.py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
024fad28553dc340e1b5b0099fc917e4b4244145f860ac5bb92d9eb7c799e215
|
|
BLAKE2b-256 checksum How to use checksums |
2115c33f1ebd497eb2a27d45e8b0950bbbde0824ac1a6cb076636465b3e89cbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |