Skip to main content

lollipop-jsonschema

License: MIT Build Status PyPI

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

License

MIT licensed. See the bundled LICENSE file for more details.

Metadata

Release files for lollipop-jsonschema 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lollipop-jsonschema 0.2
File Size Uploaded
lollipop-jsonschema-0.2.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lollipop-jsonschema 0.2
File Interpreter ABI Platform
lollipop_jsonschema-0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.5 kB

Release files / lollipop-jsonschema-0.2.tar.gz

Download URL lollipop-jsonschema-0.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2bf828882c8f561c7f871cc3bc11c2ff3c3c2cc4c735be9a7d6ae7f744b31f24
BLAKE2b-256 checksum
How to use checksums
7f9e600e09ae00da87d73bcfadfd2d12aab2153a43dcfcc55f82b881dd4ee157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / lollipop_jsonschema-0.2-py2.py3-none-any.whl

Download URL lollipop_jsonschema-0.2-py2.py3-none-any.whl
Size 5.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e3d9c3bb13dc61dada0dd05bb23d22430ff6882e9aec1dfd314eb5f584129563
BLAKE2b-256 checksum
How to use checksums
bf72dc84eacd31999dc7ede1b5ccc614b98706d401281f806232ac7805b71526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page