Skip to main content

Repository of Pydantic models for metadata schema.

Project description

Meta Schema

This library contains the Pydantic models for the metadata schema standard outlined in this Schema Guide.

The pydantic models for each data type will allow for an easy conversion across JSON, dict, and Python-objects (Pydantic model). Additionally, the metadata is also automatically validated using the expected field types to guarantee that the metadata is consistent.

Install

The package is available on PyPi:

pip install metaschema

Notes

Generating the models from the JSON schema. This is done using the datamodel-codegen.

First, download the JSON schema from NADA API. For example, for documents (https://ihsn.github.io/nada-api-redoc/catalog-admin/#tag/Documents). Store the JSON schema in data/examples/doc.json.

Then, run the following command to generate the models. Note that the --input-file-type is json and not jsonschema

poetry run datamodel-codegen  --input data/examples/doc.json --input-file-type json --output src/metaschema/doc.py

We then change the Model to a more explicit name: DocModel .

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

metaschema-0.0.3.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

metaschema-0.0.3-py3-none-any.whl (11.8 kB view hashes)

Uploaded Python 3

Supported by

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