Library to convert Lollipop schema to JSON schema
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lollipop-jsonschema-0.8.2.tar.gz
(10.9 kB
view details)
Built Distribution
File details
Details for the file lollipop-jsonschema-0.8.2.tar.gz
.
File metadata
- Download URL: lollipop-jsonschema-0.8.2.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 541a48ecca00d4db5144eabff6058205ba9bee8d7b0eeb2732590cafbc9152e4 |
|
MD5 | 117df4091e8de8eb89715f6bc9bb6493 |
|
BLAKE2b-256 | e9fad93253fbca5b8474f76a13e57e076969bf5d6df4b932a002d7b55af36595 |
File details
Details for the file lollipop_jsonschema-0.8.2-py2.py3-none-any.whl
.
File metadata
- Download URL: lollipop_jsonschema-0.8.2-py2.py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 081f7f52eee415deb4d5cde4c2def6aa273e4b22ffe4fc9a7df66ca052384d44 |
|
MD5 | 6d50c5958866872468973db58929b1b9 |
|
BLAKE2b-256 | ddfb4e085fd5faadb0a55ef19dd097cddc56add7009d3f02ff9ee76a85dba8a0 |