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.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.1.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lollipop_jsonschema-0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / lollipop-jsonschema-0.1.tar.gz
| Download URL | lollipop-jsonschema-0.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23907b797f7916ceb36103c698d74c792e77723f5ab6a7902752bf44eccb2c54
|
|
BLAKE2b-256 checksum How to use checksums |
f2ae7f520ca0cab9ebe0d12f4f70abfdb60b57b6fc3c80f4b02ac1629e507991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lollipop_jsonschema-0.1-py2.py3-none-any.whl
| Download URL | lollipop_jsonschema-0.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
14536b9c068ff1f0925d0ce627ceee011c6e07308c6ea4f9cd7727eb9663734c
|
|
BLAKE2b-256 checksum How to use checksums |
f523da858d9ab499cef79d9eb9eeb9d0ea90b068dc9ba7b5e3c126c2d840c110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |