-
Notifications
You must be signed in to change notification settings - Fork 46
RFC - Non-Primitive Data Types (Graph) #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8826d03
to
9b97f39
Compare
9b97f39
to
de09ca1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
=======================================
Coverage 50.13% 50.13%
=======================================
Files 424 424
Lines 6624 6624
Branches 1428 1428
=======================================
Hits 3321 3321
Misses 2922 2922
Partials 381 381 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
||
A second kind of composability of data types will also be possible by allowing data types to be defined as choices between data types. Conceptually this is similar to JSON Schema's `oneOf` keyword where a schema can take on the shape of _one of_ a list of schemas. This composability, instead of constraining the value-space, will allow data types to expand their value-space. | ||
|
||
Lastly, we will allow for data types to compose through the use of lists. This means that data types can be of `{ type: "array" }` and use the `items` keyword to define their value-space(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The specific reason why data types can be arrays if they can already be modeled using property types? This introduces some redundancy and I imagine confusion, as in: do I construct arrays in my property-type
or data-type
.
|
In December 2023, we introduced support for non-primitive data types in HASH, based on an advanced version of this RFC. We will be adding more and iterating on these, before introducing support for user-defined non-primitive data types (aka. "custom data types") in the HASH app: hashintel/hash#3784 This draft PR (#355) will most likely be finalized for public comment in follow-up to that work, with HASH's implementation serving as a live sandbox for the ideas discussed within this RFC. |
This PR is still a work-in progress.
We define six primitive data types in the Graph type system. These data types define value spaces for the inner properties of entities, and currently are limited to basic primitives such as "text" or "number". Building robust data models will require the ability to define constraints and define validation mechanisms (think maximum/minimum lengths on properties, or applying regular expressions to define the pattern of a string).
This RFC will capture our thoughts on how to achieve this within the type system utilizing #428 and some new extensions to our Data Type model -- culminating in allowing the creation of non-primitive, "custom" data types.
Rendered view