Repository navigation
Say in the JSON Schema which slots key a nested list - #35
Merged
Merged
Conversation
The storage schema declares unique keys for the nested lists a claim path may index (Cell by term and level, AnalysisGroup by group, ModelTerm by name, FactorLevel by level), but only in the LinkML YAML, so consumers such as neurostore kept their own copy. The generator now writes "x-unique-keys": [[slot, ...], ...] on each class that has unique keys: its own first, then inherited ones from is_a and mixins, deduplicated by key name with the nearest declaration winning. study_schema.jsonschema.unique_keys(name) returns them sorted by class, as tuples. Only storage-study has any. The generator's two annotators now share one walk over the classes, and the tests share the generator fixture and a schema-building helper in conftest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The storage schema declares unique keys for the nested lists a claim path may index, but only in the LinkML YAML. Neurostore keeps its own copy of them (
DECLARED_KEYS), and so does its review front end. This is the second of the schema-export PRs, after #34'sx-reference.What changes
tools/generate_models.pywrites"x-unique-keys": [[slot, ...], ...]on each class with LinkMLunique_keys. A class's own keys come first, then those inherited throughis_aand mixins. Keys are deduplicated by name, and the nearest declaration wins.study_schema.jsonschema.unique_keys(name)returns{class: ((slot, ...), ...)}, sorted by class._class_definitions. The tests share the generator fixture and a schema-building helper inconftest.py.storage-study.schema.jsonchanges, by the added keyword.Keys (storage-study only; the other schemas declare none)
These equal neurostore's
DECLARED_KEYS. The test pins them as a golden check of the YAML. Keeping neurostore in sync belongs in neurostore, which will read them throughunique_keys("storage-study").Tests
pytest testspasses: 105 passed, 2 skipped (pyarrow and pyarty).generate_models.py --checkpasses.🤖 Generated with Claude Code