Skip to main content

A set of utilities to generate JSON Schema from simple JSON objects

Project description

JSON Schema is good but very verbose. Writing it by hand is hard. This library defines a simpler version of JSON Schema. It supports only part of the full spec and turns that simpler format into standard JSON Schema.

Examples:

an object

{
    "x": "string",
    "y": "number",
}

nullable fields

{
    "x?": "string",
}

"x?" is a shortcut for

{
    "x": ["string", "null"],
}

union fields

{
    "x": ["string", "number"],
}

array

{
    "x": ["string"],
}

enum (uses set type in python)

{
    "x": {1,2,3,"unknown",null},
}

complex union type

{
    "x": [
        "number",
        { "z": "string" },
    ],
}

By default, the object schema is strict: all properties are required, and no extra properties are allowed.

Code example:

from schemautil import object_schema

object_schema({
    "x": "string",
    "y": "number",
})

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

bfg_schemautil-0.2.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bfg_schemautil-0.2.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file bfg_schemautil-0.2.0.tar.gz.

File metadata

  • Download URL: bfg_schemautil-0.2.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for bfg_schemautil-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b5833bd8cd548fced4798cc71ef66ecc10353dc33e426bba53057eee3ef23b40
MD5 3d5ec37e313d20cb01c63cae7e0dc489
BLAKE2b-256 9e354c6e5c0e8aad3550dcf3c0726b6cddc14e7cd14b0ec5a124587ec418952c

See more details on using hashes here.

File details

Details for the file bfg_schemautil-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bfg_schemautil-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45a0e5fa9fae634844527c4a7bdbe952290cc183c2c4707624d9f8cf64575d8d
MD5 53f9d18d654059ff441b5bed10b6d3a6
BLAKE2b-256 8385f4630d5baa4256f0bb7ca50c21f8f5fcec4e14e9677fe63bbf3447931de1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page