Skip to main content

gkm-metaschema

Tools and scripts for parsing the GA4GH Genomic Knowledge Standards (GKS) metaschemas. The metaschema processor (MSP) converts JSON Schema Version 2020-12 in YAML to reStructuredText (RST) and JSON files.

Currently used in:

Metaschema processing model

A *-source.yaml document is JSON Schema 2020-12 with a few GKS conventions the processor expands into standard JSON Schema. In brief:

  • Classes are abstract (abstract: true) or concrete. A concrete class is either inherited (inherits: a parent, with members under properties / required) or composed (a top-level allOf/anyOf/oneOf — e.g. the VA/cat-vrs profiles and recipes). The processor injects type: object, and every class — abstract included — is emitted as its own schema.
  • Inheritance copies the parent's properties/required into the child, superclass-first. A subclass specializes an inherited property by redeclaring it under the same name; the legacy extends keyword is removed and now raises an error.
  • Schema covariance (Liskov): a parent schema must always validate a subclass instance. A subclass may narrow properties (add constraints), refine descriptions/comments/array sizes, and add properties — but it may not rename an inherited property or change its type/const/default (violations raise an error).
  • References to an abstract class stay direct $refs (no expansion into a oneOf of descendants).
  • Closure (with strict: true): concrete classes get additionalProperties: false; allOf/anyOf/oneOf-composed classes get unevaluatedProperties: false; abstract classes are left open.

The full, authoritative description — including known limitations — is in METASCHEMA_BEHAVIOR.md. Keep that document in sync when processor behavior changes.

📊 Visual overview — how the processor works (click to expand)
The metaschema processor explained as a compiler: a DRY *-source.yaml is compiled — inlining inheritance, resolving $refs, injecting type: object — into self-contained per-class JSON Schemas plus RST docs, subject to type-system guarantees (base members first, Liskov substitution, concrete types sealed / abstract left open, abstract types not instantiated).

Click the image for full resolution, or open the self-contained interactive version at docs/msp-explainer.html.

Installing for development

Prerequisites

  • Python 3.12: We recommend using pyenv.

Installation Steps

Fork the repo at https://github.com/ga4gh/gkm-metaschema, and initialize a development environment.

git clone git@github.com:YOUR_GITHUB_ID/gkm-metaschema.git
cd gkm-metaschema
make devready
source venv/3.12/bin/activate

Set up pre-commit hooks:

pre-commit install

Testing

To run the tests:

make test

Usage

File Hierarchy

The metaschema processor expects the following hierarchy:

├── docs
│   ├── source
│   |   ├── ...
│   ├── Makefile
├── schema
│   ├──gkm_schema
│   |   ├── gkm-schema-source.yaml
│   |   ├── Makefile
│   |   ├── prune.mk
│   ├── Makefile
  • docs: Sphinx documentation directory. Must be named docs.
    • source: Directory containing documentation written in reStructuredText and Sphinx configuration. Must be named source.
    • Makefile: Commands to create the reStructuredText files. This file should not change across GKS projects.
  • schema: Schema directory. Can also contain submodules for other GKS product schemas.
    • gkm_schema: Schema directory for GKS product. The directory name should reflect the product, e.g. vrs.
      • gkm-schema-source.yaml: Source document for the JSON Schema 2020-12. The file name should reflect the standard, e.g. vrs-source.yaml. The file name must end with -source.yaml.
      • Makefile: Commands to create the reStructuredText and JSON files. This file should not change across GKS projects.
      • prune.mk: Cleanup of files in def and json directories based on source document. This file should not change across GKS projects.
    • Makefile: Commands to create the reStructuredText and JSON files.

Contributing to the schema

To create the corresponding def (reStructuredText) and json files after making changes to the source document, from the schema directory:

    make all

The file structure will now look like:

├── schema
│   ├──gkm_schema
|   |   ├── def
│   |   |   ├── ...
|   |   ├── json
│   |   |   ├── ...
│   |   ├── gkm-schema-source.yaml
│   |   ├── Makefile
│   |   ├── prune.mk
│   ├── Makefile

Contributing to the docs

GKS specification documentation is written in reStructuredText and located in docs/source.

To build documentation locally, you must install entr:

brew install entr

Then from the docs directory:

make clean watch &

Then, open docs/build/html/index.html. The above make command should build docs when the source changes.

NOTE: Some types of changes require recleaning and building.

Metadata

Release files for ga4gh.gkm.metaschema 0.4.9

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

Source distribution (sdist)

Source distribution for ga4gh.gkm.metaschema 0.4.9
File Size Uploaded Provenance Actions
ga4gh_gkm_metaschema-0.4.9.tar.gz 983.8 kB With provenance Details for ga4gh_gkm_metaschema-0.4.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ga4gh.gkm.metaschema 0.4.9
File Interpreter ABI Platform Actions
ga4gh_gkm_metaschema-0.4.9-py3-none-any.whl Python 3 none any Details for ga4gh_gkm_metaschema-0.4.9-py3-none-any.whl

Total release size: 1.0 MB

Release files / ga4gh_gkm_metaschema-0.4.9.tar.gz

Download URL ga4gh_gkm_metaschema-0.4.9.tar.gz
Size 983.8 kB
Tags Source
SHA-256 checksum
How to use checksums
41d5d952f10b50be13529302f58ed39f98f4a2e8c73e410042728fa14e8dad27
BLAKE2b-256 checksum
How to use checksums
3f5283e0ef07c66ebc2b52151c254ab5472af7b71a6c94f6334778e186d9f8ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / ga4gh_gkm_metaschema-0.4.9-py3-none-any.whl

Download URL ga4gh_gkm_metaschema-0.4.9-py3-none-any.whl
Size 43.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f71436c437332d03a95131b1e68bcaa32627cee7ee3620c49199757c029089fb
BLAKE2b-256 checksum
How to use checksums
f3048bf6b491684e1d8fd9815df4cba8bde3295523a42578a19c3eca52e21929
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for ga4gh.gkm.metaschema 0.4.9

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ga4gh_gkm_metaschema-0.4.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

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