Skip to content

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

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

Alfred-Mountfield
Copy link
Contributor

@Alfred-Mountfield Alfred-Mountfield commented Jun 14, 2022

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

@Alfred-Mountfield Alfred-Mountfield added the area: user success > rfcs Þ RFCs: blockprotocol.org/rfcs (content) label Jun 14, 2022
@Alfred-Mountfield Alfred-Mountfield changed the title RFC - User Generated Data Types (Graph) RFC - User Created Data Types (Graph) Jun 14, 2022
@Alfred-Mountfield Alfred-Mountfield changed the title RFC - User Created Data Types (Graph) RFC - Non-Primitive Data Types (Graph) Jun 28, 2022
@benwerner01 benwerner01 force-pushed the am/rfc-graph-user-data-types branch 3 times, most recently from 8826d03 to 9b97f39 Compare July 5, 2022 08:57
@codecov
Copy link

codecov bot commented Feb 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.13%. Comparing base (2f693a5) to head (4683a2d).
Report is 71 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


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).
Copy link
Collaborator

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.

@CLAassistant
Copy link

CLAassistant commented Jul 4, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 3 committers have signed the CLA.

❌ Alfred-Mountfield
❌ benwerner01
❌ thehabbos007
You have signed the CLA already but the status is still pending? Let us recheck it.

@vilkinsons
Copy link
Member

vilkinsons commented Jan 4, 2024

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.

@github-actions github-actions bot added the area: apps Relates to non-content work in `apps` (area) label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: apps Relates to non-content work in `apps` (area) area: user success > rfcs Þ RFCs: blockprotocol.org/rfcs (content)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants