From 3b2f528616587ff4cb5a16cb5d617fb493a41e83 Mon Sep 17 00:00:00 2001 From: Nathaniel Tucker Date: Sun, 21 Jul 2024 13:38:23 +0200 Subject: [PATCH] enhance: Remove name in toJSON() for Entities --- .changeset/five-meals-refuse.md | 7 +++++++ .changeset/four-berries-jog.md | 7 +++++++ packages/endpoint/src/schemas/Collection.ts | 7 +++++-- packages/endpoint/src/schemas/EntitySchema.ts | 3 +-- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 .changeset/five-meals-refuse.md create mode 100644 .changeset/four-berries-jog.md diff --git a/.changeset/five-meals-refuse.md b/.changeset/five-meals-refuse.md new file mode 100644 index 000000000000..db3fbf899e91 --- /dev/null +++ b/.changeset/five-meals-refuse.md @@ -0,0 +1,7 @@ +--- +'@data-client/endpoint': patch +'@data-client/graphql': patch +'@data-client/rest': patch +--- + +Remove name in toJSON() for Entities diff --git a/.changeset/four-berries-jog.md b/.changeset/four-berries-jog.md new file mode 100644 index 000000000000..2af398b0b4a3 --- /dev/null +++ b/.changeset/four-berries-jog.md @@ -0,0 +1,7 @@ +--- +'@data-client/endpoint': patch +'@data-client/graphql': patch +'@data-client/rest': patch +--- + +Add toString() to Collection diff --git a/packages/endpoint/src/schemas/Collection.ts b/packages/endpoint/src/schemas/Collection.ts index 6cbefeeeb73e..882e322715b4 100644 --- a/packages/endpoint/src/schemas/Collection.ts +++ b/packages/endpoint/src/schemas/Collection.ts @@ -121,11 +121,14 @@ export default class CollectionSchema< return this.schema.schema; } + toString() { + return this.key; + } + toJSON() { return { - name: `Collection(${this.schema.schema.name})`, - schema: this.schema.schema.toJSON(), key: this.key, + schema: this.schema.schema.toJSON(), }; } diff --git a/packages/endpoint/src/schemas/EntitySchema.ts b/packages/endpoint/src/schemas/EntitySchema.ts index c064fe61ddde..d56bf0e8c1f9 100644 --- a/packages/endpoint/src/schemas/EntitySchema.ts +++ b/packages/endpoint/src/schemas/EntitySchema.ts @@ -28,9 +28,8 @@ export default function EntitySchema( static toJSON() { return { - name: this.name, - schema: this.schema, key: this.key, + schema: this.schema, }; }