Repository navigation
BE-1160: Replace the primitive-parent rule with a required type and reject Value in property types - #10525
BE-1160: Replace the primitive-parent rule with a required type and reject Value in property types#10525TimDiekmann wants to merge 3 commits into
type and reject Value in property types#10525Conversation
…Value` in property types
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
There was a problem hiding this comment.
🟡 Changes recommended
Newly accepted abstract union schemas still throw errors in data-type pages and property-table rendering, so frontend support is needed alongside the validator change.
1 open issue
What changed in this PR
This PR updates the Rust type system to support abstract parents spanning multiple primitive types, while tightening validation for concrete data types and property references.
Changes:
- Allows any data type to inherit directly from
Value, while requiring concrete types other thanValueto declaretype. - Rejects property-type references to
Value, including inside arrays. - Adds tests for validation failures and concrete children narrowing an abstract parent’s union constraints.
| File | Description |
|---|---|
libs/@blockprotocol/type-system/rust/src/ontology/property_type/schema/validation.rs |
Rejects data-type references to Value. |
libs/@blockprotocol/type-system/rust/src/ontology/property_type/schema/mod.rs |
Tests rejection of Value within array alternatives. |
libs/@blockprotocol/type-system/rust/src/ontology/data_type/schema/validation.rs |
Replaces primitive-parent restrictions with required-type validation. |
libs/@blockprotocol/type-system/rust/src/ontology/data_type/schema/mod.rs |
Exposes the shared Value identifier within the crate. |
libs/@blockprotocol/type-system/rust/src/ontology/data_type/schema/closed.rs |
Tests abstract union inheritance and concrete-child constraint narrowing. |
Review effort: Balanced
Merging this PR will not alter performance
Comparing Footnotes
|
PR SummaryMedium Risk Overview
Property type validation now rejects references to the base Tests cover abstract Reviewed by Cursor Bugbot for commit f4e5cba. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10525 +/- ##
==========================================
- Coverage 69.03% 69.03% -0.01%
==========================================
Files 2081 2081
Lines 214393 214393
Branches 9256 9256
==========================================
- Hits 148012 148011 -1
Misses 64494 64494
- Partials 1887 1888 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

🌟 Purpose
A data type cannot group children of different primitive types. An abstract
Colorwith the childrenRGB Color(a list) andColor Label(a string) has to inherit fromValue, and only the six primitive data types can do that.🔍 Changes
Three rules replace the rule that only primitive data types inherit from
Value:Value, directly or indirectly. Any data type can nameValueas its parent.type. A data type that allows several types throughanyOfhas to be abstract.Valueis exempt.Value.