Skip to main content

Voluptuous OpenAPI

Convert Voluptuous schemas to OpenAPI Schema object.

schema = {}
schema[vol.Required('name')] = vol.All(str, vol.Length(min=5))
schema[vol.Required('age', description='Age in full years')] = vol.All(vol.Coerce(int), vol.Range(min=18))
schema[vol.Optional('hobby', default='not specified')] = str
schema = vol.Schema(schema)

becomes

{
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "minLength": 5,
        },
        "age": {
            "type": "integer",
            "minimum": 18,
            "description": "Age in full years",
        },
        "hobby": {
            "type": "string",
            "default": "not specified",
        },
    },
    "required": ["name", "age"],
}

See the tests for more examples.

Custom serializer

You can pass a custom serializer to be able to process custom validators. If the serializer returns UNSUPPORTED, it will return to normal processing. Example:

from voluptuous_openapi import UNSUPPORTED, convert

def custom_convert(value):
    if value is my_custom_validator:
        return {'pattern': '^[a-zA-Z0-9]$'}
        
    return UNSUPPORTED

convert(value, custom_serializer=custom_convert)

Metadata

Release files for voluptuous-openapi 0.4.1

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

Source distribution (sdist)

Source distribution for voluptuous-openapi 0.4.1
File Size Uploaded Provenance Actions
voluptuous_openapi-0.4.1.tar.gz 21.4 kB Without provenance Details for voluptuous_openapi-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for voluptuous-openapi 0.4.1
File Interpreter ABI Platform Actions
voluptuous_openapi-0.4.1-py3-none-any.whl Python 3 none any Details for voluptuous_openapi-0.4.1-py3-none-any.whl

Total release size: 34.3 kB

Release files / voluptuous_openapi-0.4.1.tar.gz

Download URL voluptuous_openapi-0.4.1.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
745d0d60940a851d9a90c87eebf659c57072c9ef305c0f6f04f4fd7c063dc0ac
BLAKE2b-256 checksum
How to use checksums
60a5517c143607fd82cfc8842fcdccf5cf2c07cdd96528c936bde196e05dece3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / voluptuous_openapi-0.4.1-py3-none-any.whl

Download URL voluptuous_openapi-0.4.1-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b30abc527c622cd62dba1269a05099e6b6170678c2838908d347fa85ab0cdb44
BLAKE2b-256 checksum
How to use checksums
bcbb64db054ad3852e3b63841a570942d3ce29e6b44979d5ac4be806973a2338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for voluptuous-openapi 0.4.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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