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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file metaschema-0.0.3.tar.gz
.
File metadata
- Download URL: metaschema-0.0.3.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0628336ed1b614d737ef40d3e16b40dbda4aea16bf53985c7a798aa7aff9b38e |
|
MD5 | d46da1d008032e398a3adefee5b994c2 |
|
BLAKE2b-256 | b264ca0eec72d4e53ac646e474081c8e02a69e38cbed9bf614b359c83a55c2ef |
File details
Details for the file metaschema-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: metaschema-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.6 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b69bd78aecee2aa3cb66a8eedc446cd059d69f975b988c330837fa75ea4dadf5 |
|
MD5 | ae6e16ff3f43d04d139236f1e677f8f4 |
|
BLAKE2b-256 | 895403ff2b74affb1f119492c085db13e69c77e93754f4db749bf4b420289b5a |