Skip to main content

lollipop-jsonschema

License: MIT Build Status PyPI

Library to convert Lollipop schema to JSON schema in a format compliant with OpenAPI 3.1.0.

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

License

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

Metadata

Release files for lollipop-jsonschema 0.9.0

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.9.0
File Size Uploaded Provenance
lollipop_jsonschema-0.9.0.tar.gz 11.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 18.3 kB

Release files / lollipop_jsonschema-0.9.0.tar.gz

Download URL lollipop_jsonschema-0.9.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b2c69280f9cfc677c49b99c4782b9c31cb4f2f3cdbdc24b00f98ef1aad501371
BLAKE2b-256 checksum
How to use checksums
e63acafef31e4e5d349a25fc198bc4ee902f64c80a9eb14187e89ce6dbf3ae71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / lollipop_jsonschema-0.9.0-py3-none-any.whl

Download URL lollipop_jsonschema-0.9.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17535a4d19321b64211b2109bf9fc44eea899b34b30424d6bd21dab826abe627
BLAKE2b-256 checksum
How to use checksums
64c3666069de9add3ccefdad9b4ee315e8054616d2dadc9b59e9a9bcfcea0f6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Security for lollipop-jsonschema 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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