Skip to content

Commit 3058a8a

Browse files
committed
enhance: Collection non-known (not Array/Values) key format improvement
1 parent ddb4724 commit 3058a8a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.changeset/real-bees-unite.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@data-client/endpoint': patch
3+
'@data-client/graphql': patch
4+
'@data-client/rest': patch
5+
---
6+
7+
Collection non-known (not Array/Values) key format improvement
8+
9+
Now wraps in parens `()`: "(Todo)"

packages/endpoint/src/schemas/Collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,5 +367,5 @@ function keyFromSchema(schema: PolymorphicInterface) {
367367
} else if (schema instanceof Values) {
368368
return `{${schema.schemaKey()}}`;
369369
}
370-
return `Collection:${schema.schemaKey()}`;
370+
return `(${schema.schemaKey()})`;
371371
}

packages/endpoint/src/schemas/__tests__/Collection.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ test('key works with custom schema', () => {
9595
}
9696

9797
const collection = new schema.Collection(new CustomArray(Todo));
98-
expect(collection.key).toBe('Collection:Todo');
98+
expect(collection.key).toBe('(Todo)');
9999
});
100100

101101
describe(`${schema.Collection.name} normalization`, () => {

0 commit comments

Comments
 (0)