Publish standalone YAML schema files as single source of truth - #12
Publish standalone YAML schema files as single source of truth#12matsen wants to merge 1 commit into
Conversation
|
@davidrich27 the reason I went ahead and set this up is because I want the AIRR people to consider our schema. Can you try it out and make sure it works, please? |
|
🤖 Nice work on the core mechanics — YAML-as-source-of-truth loaded at import time is exactly right, and the schemas.py reduction from 660→39 lines is clean. Two things to revisit: 1. Single file vs four files. The official AIRR schema is one monolithic YAML ( 2. |
Introduces olmsted_cli/schemas/olmsted-schema.yaml as the authoritative source for the Node/Tree/Clone/Dataset schemas (AIRR-style monolithic file with #/Object cross-refs and x-olmsted annotations). schemas.py loads it at import and patches the dynamic fragments (field_metadata levels, field type/display enums) from constants.py. A generated olmsted-schema.json is committed alongside for linking from AIRR Standards proposals; 'make schemas' regenerates it and test_schema_freshness.py fails if it drifts. Resolves the duplicate timepoint_multiplicity_spec definition (#11). Rebased onto main and re-synced the schema to the post-#34 field set: cdr3_sequence/cdr3_sequence_aa (node), min/max_cdr3_length and reconstruction_method (tree), cdr3_alignment_start/end and cdr1/cdr2/cdr3_length (clone), plus the expanded dataset.type text. Closes #11 Co-Authored-By: David Rich <david.rich27@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bb87493 to
24991b2
Compare
🤖
Summary
olmsted_cli/schemas/{node,tree,clone,dataset}.schema.yamlas the single authoritative source for all Olmsted JSON schemas. Python loads these at import time, so the validation dicts are always identical to the published artifacts — structural divergence is impossible.timepoint_multiplicity_specbug (lines 49 and 757 in oldschemas.py): the canonical definition now lives in each YAML file'sdefinitionsblock with a title, description,minimum: 0, nullabletimepoint_id, andadditionalProperties: false.*.schema.jsonfiles alongside the YAML for linking from AIRR Standards proposals. Amake schemastarget regenerates JSON from YAML; a newtest_schema_freshness.pytest fails if committed JSON is stale.Deliverables checklist
olmsted_cli/schemas/node.schema.yaml— standalone with AIRR/extension annotations per fieldolmsted_cli/schemas/tree.schema.yamlolmsted_cli/schemas/clone.schema.yamlolmsted_cli/schemas/dataset.schema.yaml—field_metadata.propertiespatched dynamically fromFIELD_LEVELSolmsted_cli/schemas/*.schema.json— generated artifactsschemas.pyreplaced with YAML-loading code + dynamic patchingmake schemasMakefile targettests/test_schema_freshness.py— asserts JSON matches YAMLpyproject.tomlupdated to includeschemas/*.yamlandschemas/*.jsonin package dataTest plan
pytest tests/test_schema_freshness.pypasses for all 4 schemasmake schemasregenerates JSON correctly (no-op when JSON is current)Closes #11
🤖 Generated with Claude Code