Skip to content

Commit

Permalink
enhance: Remove name in toJSON() for Entities
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Jul 21, 2024
1 parent 8564893 commit 3b2f528
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/five-meals-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@data-client/endpoint': patch
'@data-client/graphql': patch
'@data-client/rest': patch
---

Remove name in toJSON() for Entities
7 changes: 7 additions & 0 deletions .changeset/four-berries-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@data-client/endpoint': patch
'@data-client/graphql': patch
'@data-client/rest': patch
---

Add toString() to Collection
7 changes: 5 additions & 2 deletions packages/endpoint/src/schemas/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
}

Expand Down
3 changes: 1 addition & 2 deletions packages/endpoint/src/schemas/EntitySchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ export default function EntitySchema<TBase extends Constructor>(

static toJSON() {
return {
name: this.name,
schema: this.schema,
key: this.key,
schema: this.schema,
};
}

Expand Down

0 comments on commit 3b2f528

Please sign in to comment.