Function: allRelationPropertyTypesExist()
allRelationPropertyTypesExist(
types
):boolean
Defined in: packages/hypergraph/src/mapping/Mapping.ts:324
Iterate through all properties in all types in the schema of dataType
=== Relation(${string})
and validate that the schema.types have a type for the existing relation
Parameters
types
readonly object
[]
the user-submitted schema types
Returns
boolean
Examples
import { allRelationPropertyTypesExist, type Mapping } from '@graphprotocol/hypergraph/mapping'
const types: Mapping['types'] = [
{
name: "Account",
knowledgeGraphId: null,
properties: [
{
name: "username",
dataType: "String",
knowledgeGraphId: null
}
]
},
{
name: "Event",
knowledgeGraphId: null,
properties: [
{
name: "speaker",
dataType: "Relation(Account)"
relationType: "Account",
knowledgeGraphId: null,
}
]
}
]
expect(allRelationPropertyTypesExist(types)).toEqual(true)
import { allRelationPropertyTypesExist, type Mapping } from '@graphprotocol/hypergraph/mapping'
const types: Mapping['types'] = [
{
name: "Event",
knowledgeGraphId: null,
properties: [
{
name: "speaker",
dataType: "Relation(Account)",
relationType: "Account",
knowledgeGraphId: null,
}
]
}
]
expect(allRelationPropertyTypesExist(types)).toEqual(false)
Since
0.2.0