Deprecate object_derivations in favor of slot-level class_derivations#204
Open
amc-corey-cox wants to merge 1 commit intomainfrom
Open
Deprecate object_derivations in favor of slot-level class_derivations#204amc-corey-cox wants to merge 1 commit intomainfrom
amc-corey-cox wants to merge 1 commit intomainfrom
Conversation
Add class_derivations to SlotDerivation as the replacement for object_derivations. Normalization flattens object_derivations into class_derivations with a deprecation warning, and errors if both are present on the same slot. Nested class_derivations inherit populated_from from their parent when unspecified, eliminating redundant source declarations in deeply nested specs. Closes #112
Contributor
There was a problem hiding this comment.
Pull request overview
This PR deprecates object_derivations in favor of slot-level, list-based class_derivations, shifting both normalization and runtime execution to the new construct while preserving backward compatibility via normalization.
Changes:
- Add
SlotDerivation.class_derivations(list-based) as the runtime-supported mechanism for nested object construction. - Normalize legacy
object_derivationsintoclass_derivationswith a deprecation warning, and addpopulated_frominheritance for nested entries. - Update tests, inference behavior, datamodel schema, and CLI help text to match the new approach.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_transformer/test_object_transformer.py | Adds coverage for slot-level list-based class_derivations, inheritance of populated_from, and backward-compat normalization from object_derivations. |
| tests/test_deprecations.py | Moves the object_derivations warning expectation to normalization time and adds a conflict test for both fields on the same slot. |
| src/linkml_map/transformer/transformer.py | Implements recursive normalization: flattens object_derivations → class_derivations, expands compact YAML keys, and supports populated_from inheritance. |
| src/linkml_map/transformer/object_transformer.py | Removes runtime handling of object_derivations and derives nested objects solely from slot_derivation.class_derivations. |
| src/linkml_map/inference/inference.py | Stops emitting runtime deprecation warnings for object_derivations and updates inference skip logic to key off class_derivations. |
| src/linkml_map/datamodel/transformer_model.yaml | Adds class_derivations to SlotDerivation and keeps object_derivations marked deprecated. |
| src/linkml_map/datamodel/transformer_model.py | Regenerates/updates the Python datamodel to include SlotDerivation.class_derivations. |
| src/linkml_map/cli/cli.py | Updates CLI help text to remove the object_derivations-specific requirement wording for --target-schema. |
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.
Summary
class_derivationstoSlotDerivationas the direct replacement forobject_derivationsobject_derivations→class_derivationswith deprecation warning; errors if both presentclass_derivationsinheritpopulated_fromfrom their parent when unspecified, eliminating redundant source declarations in deeply nested specs (e.g., MeasurementObservationSet → MeasurementObservation → Quantity)object_derivationsfrom the transformer execution path — onlyclass_derivationsis checked at runtimeBefore / After
Test plan
test_nested_class_derivations— verifies slot-level class_derivationstest_nested_class_derivations_inherit_populated_from— verifies populated_from inheritancetest_object_derivations_backward_compat— old specs still work via normalizationtest_object_derivations_and_class_derivations_conflict— errors when both presenttest_object_derivations_emits_deprecation_warning— warning now fires during normalizationCloses #112