Open
Conversation
Compilers now receive derived_specification (with inferred defaults) instead of the raw specification, eliminating a duplicate induce_missing_values call in PythonCompiler. Documents the two-phase normalization pipeline in the Transformer class docstring. Closes #124
cf46a51 to
2f83dfc
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates the transformation-spec normalization pipeline by clearly separating load-time structural normalization from schema-bind-time semantic induction, and updates compilation pathways to use the schema-derived specification so compiler outputs include inferred fields (e.g., populated_from, range).
Changes:
- Route compiler invocations (CLI + tests) through
ObjectTransformer.derived_specificationinstead of the raw spec. - Remove redundant
induce_missing_valuesinvocation fromPythonCompiler. - Document the two-phase normalization pipeline and regenerate golden compiled markdown output.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/linkml_map/transformer/transformer.py |
Documents the two-phase normalization pipeline and expands derived_specification documentation. |
src/linkml_map/compiler/python_compiler.py |
Removes internal deep-copy + induction from the python compiler so it compiles the already-derived spec. |
src/linkml_map/cli/cli.py |
CLI compile now compiles the derived specification. |
tests/test_compliance/test_compliance_suite.py |
Compliance helper now compiles the derived spec when available. |
tests/test_compiler/test_python_compiler.py |
Python compiler unit test now compiles the derived spec via ObjectTransformer. |
tests/input/examples/personinfo_basic/output/personinfo_compiled.md |
Golden output updated to reflect inferred populated_from / range values. |
Comments suppressed due to low confidence (1)
src/linkml_map/transformer/transformer.py:250
derived_specificationcan raise and/or cache a partially-induced spec whensource_schemaviewis unset or ifinduce_missing_valueserrors. Because_derived_specificationis assigned before induction, an exception leaves the cache populated and subsequent calls will skip induction. Consider (1) returningNoneearly whensource_schemaviewis not set (consistent with the| Nonereturn type), and (2) computing into a local variable and only assigning_derived_specificationafterinduce_missing_valuessucceeds.
if self._derived_specification is None:
if self.specification is None:
return None
self._apply_source_schema_patches()
self._derived_specification = deepcopy(self.specification)
induce_missing_values(self._derived_specification, self.source_schemaview)
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
derived_specification(with schema-inferred defaults) instead of the rawspecification, eliminating a duplicateinduce_missing_valuescall inPythonCompilerTransformerclass docstring andderived_specificationpropertypopulated_fromandrangevalues — previously these showed asNonein compiled markdown/python outputTest plan
Closes #124