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. |
| /** | ||
| * @todo fill in the relationValueTypes and properties for creating a relation property | ||
| */ | ||
| relationValueTypes: [], | ||
| properties: [], |
There was a problem hiding this comment.
@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.
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.
(We should probably rename relationValueTypes to something else since it's not obvious what it means)
There was a problem hiding this comment.
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-reactpackage currently maintains a definition forMappingwhich tells theHypergraphSpaceProviderhow to retrieve entities for the given schema types from the Knowledge Graph.After discussion, it was decided that
typesyncshould 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/typesyncthat:Mappingtype definitiongenerateMappingfunction that takes in a schema object and from it:Mappingentry from the existing/created Knowledge Graph IdsOpen questions
typeIdshave 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 thetypeIdsarray 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 therelationsproperty? Is this for props ofdataType===RELATIONand it would be the GRC-20 id of the relation type id?