Skip to content

Commit 4bbdc82

Browse files
committed
fix relation type
1 parent 9ecb525 commit 4bbdc82

File tree

1 file changed

+4
-1
lines changed
  • packages/hypergraph/src/type

1 file changed

+4
-1
lines changed

packages/hypergraph/src/type/type.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export const Point = (propertyId: string) =>
4545
export const Relation =
4646
<S extends Schema.Schema.AnyNoContext>(schema: S) =>
4747
(propertyId: string) => {
48-
return Schema.Array(schema).pipe(
48+
const schemaWithId = Schema.extend(
49+
Schema.Struct({ id: Schema.String, _relation: Schema.Struct({ id: Schema.String }) }),
50+
)(schema);
51+
return Schema.Array(schemaWithId).pipe(
4952
Schema.annotations({ [PropertyIdSymbol]: propertyId, [RelationSchemaSymbol]: schema, [RelationSymbol]: true }),
5053
);
5154
};

0 commit comments

Comments
 (0)