Skip to content

Deprecate object_derivations in favor of slot-level class_derivations#204

Open
amc-corey-cox wants to merge 1 commit intomainfrom
deprecate-object-derivations
Open

Deprecate object_derivations in favor of slot-level class_derivations#204
amc-corey-cox wants to merge 1 commit intomainfrom
deprecate-object-derivations

Conversation

@amc-corey-cox
Copy link
Copy Markdown
Contributor

Summary

  • Add class_derivations to SlotDerivation as the direct replacement for object_derivations
  • Normalization flattens object_derivationsclass_derivations with deprecation warning; errors if both present
  • Nested class_derivations inherit populated_from from their parent when unspecified, eliminating redundant source declarations in deeply nested specs (e.g., MeasurementObservationSet → MeasurementObservation → Quantity)
  • Remove object_derivations from the transformer execution path — only class_derivations is checked at runtime

Before / After

# Before (object_derivations):
slot_derivations:
  conditions:
    object_derivations:
      - class_derivations:
          Condition:
            populated_from: Person
            slot_derivations: ...

# After (class_derivations with inherited populated_from):
slot_derivations:
  conditions:
    class_derivations:
      - Condition:
          slot_derivations: ...  # inherits populated_from from parent

Test plan

  • New: test_nested_class_derivations — verifies slot-level class_derivations
  • New: test_nested_class_derivations_inherit_populated_from — verifies populated_from inheritance
  • New: test_object_derivations_backward_compat — old specs still work via normalization
  • New: test_object_derivations_and_class_derivations_conflict — errors when both present
  • Updated: test_object_derivations_emits_deprecation_warning — warning now fires during normalization
  • All 589 tests pass (534 unit + 55 compliance)
  • Ruff clean

Closes #112

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
Copilot AI review requested due to automatic review settings April 13, 2026 22:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_derivations into class_derivations with a deprecation warning, and add populated_from inheritance 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_derivationsclass_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.

Comment thread src/linkml_map/transformer/transformer.py
@amc-corey-cox amc-corey-cox requested a review from madanucd April 14, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate object_derivations in favor of list-based class_derivations

2 participants