Skip to main content

pydantic-jsonapi

Build Status PyPi Link

an implementation of JSON:api using pydantic for validation

from pydantic_jsonapi import JsonApiModel
from pydantic import BaseModel

class Item(BaseModel):
    name: str
    quantity: int
    price: float

ItemRequest, ItemResponse = JsonApiModel('item', Item)

# request validation
request = {
    'data': {
        'type': 'item',
        'attributes': {
            'name': 'apple',
            'quantity': 10,
            'price': 1.20,
        },
    }
}
ItemRequest(**request)

#response validation
response = {
    'data': {
        'id': 'abc123',
        'type': 'item',
        'attributes': {
            'name': 'apple',
            'quantity': 10,
            'price': 1.20,
        },
        'relationships': {
            'store': {
                'links': {
                    'related': '/stores/123'
                }
            }
        }
    },
    'links': {
        'self': '/item/abc123'
    }
}
ItemResponse(**response)

Metadata

Release files for pydantic-jsonapi 0.11.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 pydantic-jsonapi 0.11.0
File Size Uploaded Provenance Actions
pydantic_jsonapi-0.11.0.tar.gz 3.6 kB Without provenance Details for pydantic_jsonapi-0.11.0.tar.gz

Release files / pydantic_jsonapi-0.11.0.tar.gz

Download URL pydantic_jsonapi-0.11.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c0c72d7543017121e49a41ee7e36224ba1cc3627be5efac048e3b81425e623a8
BLAKE2b-256 checksum
How to use checksums
0c08688ff0a722796c7671576cc6c1936f64302f5d20356631947dcd7b88b141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.1

Security for pydantic-jsonapi 0.11.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.

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