Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avsolatorio/metaschema
Repository of Pydantic models for metadata schema.
https://github.com/avsolatorio/metaschema
Last synced: 19 days ago
JSON representation
Repository of Pydantic models for metadata schema.
- Host: GitHub
- URL: https://github.com/avsolatorio/metaschema
- Owner: avsolatorio
- License: mit
- Created: 2023-02-21T06:21:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-15T03:05:54.000Z (over 1 year ago)
- Last Synced: 2024-11-10T11:45:14.379Z (3 months ago)
- Language: Python
- Size: 78.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Meta Schema
This library contains the Pydantic models for the metadata schema standard outlined in this [Schema Guide](https://mah0001.github.io/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` .