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.3
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.3.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lollipop_jsonschema-0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 11.5 kB
Release files / lollipop-jsonschema-0.3.tar.gz
| Download URL | lollipop-jsonschema-0.3.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
108690a1df0aa6f52a714fddbd2fcd3d24c14668e7af89bcf63430d90a80a0ba
|
|
BLAKE2b-256 checksum How to use checksums |
0230ebf23e08d8be39906b0ee98475a123026efd9c7ad1bc25a40aac597a5ca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / lollipop_jsonschema-0.3-py2.py3-none-any.whl
| Download URL | lollipop_jsonschema-0.3-py2.py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2ca8fc35ce4efafd40949fadf8d8f287de550ed28003e7323330f213b9aaef82
|
|
BLAKE2b-256 checksum How to use checksums |
72d19a3462a033ce10daabd19a7c69146eebaab663a7789495259d18260cf352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |