-
Notifications
You must be signed in to change notification settings - Fork 8
feat(mapping generation): create a typesync pkg to take a user-built schema and generate the mappings definition #210
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
feat(mapping generation): create a typesync pkg to take a user-built schema and generate the mappings definition #210
Conversation
@cmwhited is attempting to deploy a commit to the The Graph Foundation team on Vercel, but is not a member of this team. To resolve this issue, you can:
To read more about collaboration on Vercel, click here. |
packages/typesync/src/Mapping.ts
Outdated
/** | ||
* @todo fill in the relationValueTypes and properties for creating a relation property | ||
*/ | ||
relationValueTypes: [], | ||
properties: [], |
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.
@baiirun could you help me understand the id(s) I would pass here for creating the relation property?
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.
Not entirely sure what properties
is here. Might be a bug in grc-20
. My guess is we copied the interface from createType
.
For relationValueTypes
it should be the id of whatever type we want to use as the target for a relation. For example,Relation(Person)
requires that a relation points to a Person. The relation value type for this would be the Person
entity id.
If you had a property called Employees
that should point to a Person, it might look like this
Graph.createProperty({
name: "Employees",
dataType: "RELATION",
relationValueTypes: ["<person-entity-id>"]
})
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.
(We should probably rename relationValueTypes
to something else since it's not obvious what it means)
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 defineWorkspace
function from vitest/config
is deprecated in favor of config.test.projects
….whited/feat-typesync-pkg/mapping-generation
….whited/feat-typesync-pkg/mapping-generation
….whited/feat-typesync-pkg/mapping-generation
Description
The
@graphprotocol/hypergraph-react
package currently maintains a definition forMapping
which tells theHypergraphSpaceProvider
how to retrieve entities for the given schema types from the Knowledge Graph.After discussion, it was decided that
typesync
should be responsible for this logic as it is the framework for letting users build, maintain, and publish their schemas to the Knowledge Graph and part of this action is the generatedMapping
.This PR creates a new package:
@graphprotocol/typesync
that:Mapping
type definitiongenerateMapping
function that takes in a schema object and from it:Mapping
entry from the existing/created Knowledge Graph IdsOpen questions
typeIds
have more than one entry based off this schema? Is it if: the type comes from the Knowledge Graph, but there are new properties being created/edited so thetypeIds
array would be: the initial type id from the Knowledge Graph + the newly generated id for the type with the property changesWhat is the use of therelations
property? Is this for props ofdataType
===RELATION
and it would be the GRC-20 id of the relation type id?