Repository navigation
fix: a bare Link[T] annotation is required, like any bare annotation - #183
Merged
Merged
Conversation
- requiredness follows the annotation; OoldField(required=) overrides - Optional[Link[T]] = None is the optional form; Link[T | None] deprecated - LinkNotSet / LinkUnresolvable subclass LinkNotResolved; messages name the failing subject, Person(ex:p3).father - notation matrix tests cover every table row and column, both checkers - closes #159
Contributor
Release previewMerging this PR would release v2.3.3 (current: Changelog preview (truncated)## v2.3.3 (2026-11-20)
### Bug Fixes
- A bare Link[T] annotation is required, like any bare annotation
([`0fe5cac`](https://github.com/OO-LD/oold-python/commit/0fe5cac36a3a662d7965409ddf9973cbdaba7f8f))
- Review findings on the requiredness derivation
([`9388510`](https://github.com/OO-LD/oold-python/commit/9388510bc7c8e3594654ececa2f002ab9cb823eb))
Preview via python-semantic-release and conventional commits. |
Contributor
📊 Benchmark ResultsClick to see benchmark comparisonThreshold: 1.3x (30% slower triggers a regression warning) Note: Benchmarks are informational only and won't fail the build. 💡 Tip: Download the |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- required checks test key presence, not truthiness: an explicitly empty
list satisfies required, as {"f": []} satisfies JSON Schema required
- a declared default cancels the derivation, like any pydantic default
- unset strict LinkList raises LinkNotSet instead of answering []
- both legacy bindings honour required=False; they raised on key presence
- the OoldField() injection recognises stringized Link annotations under
from __future__ import annotations
Contributor
📊 Benchmark ResultsClick to see benchmark comparisonThreshold: 1.3x (30% slower triggers a regression warning) Note: Benchmarks are informational only and won't fail the build. 💡 Tip: Download the |
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.
Closes #159 with the target state posted there on 2026-11-17. Not a major: the annotation form ships since v1.0.0 but no downstream consumer uses it -
opensemantic0.2.1 /opensemantic_core0.56.0 importLinkedBaseModelonly and declare links with the legacyField(None, range="T")form, which is untouched (its requiredness still comes from the explicitx-oold-required-iriextra, and_extract_targetnever reports a bare link for it).required[]Link[Org]OrgLink[Org] = OoldField(...)OrgOptional[Link[Org]] = NoneOrg | NoneNoneLink[Org] | None = NoneOrg | NoneNoneLink[Org] = OoldField(required=False)OrgLinkList[Org]LinkResultList[Org]Optional[LinkList[Org]] = NoneLinkResultList[Org] | None[]LinkList[Org | None] = OoldField()LinkResultList[Org | None]NoneChanges:
_descriptor.py,_notation.pymirror); an explicitOoldField(required=)stays the override, which is also what keeps generated legacy code unchangedOoldField(required=False)is the escape for sparse data wanting a guard-free chain: strict read, not inrequired[]; not expressible in JSON Schema, so the generator never emits itLinkNotSet/LinkUnresolvablesubclassLinkNotResolved(which still catches both); messages name the failing subject -Person(ex:p3).father ...- since in a self-referential chain only the subject identifies the hopLink[T | None]is deprecated in favour ofOptional[Link[T]] = None; it keeps workingtests/test_link_notation_matrix.pyparametrises every table row over the runtime columns;tests/typing/links.pyasserts the read-type and filter columns, pyright and ty both green; tables land indocs/how-to/object-graph-mapping.md, rationale and history indocs/design/graph-object-binding.mdexamples/wiki_data.pywalks ancestry None-terminated overLink["Person"] | None; the one ungated chain line carries a bare# type: ignore # noqa: PGH003, the only spelling pyright and both ty generations all honourLink[hits, detection is the keyword test atv1/_descriptor.py:154833 passed under the descriptor binding, 817 under
OOLD_DESCRIPTOR_BINDING=0; ruff, ty, deptry, strict docs build clean.