Skip to content

Commit db29e1e

Browse files
fix(graphql): id field non null (#8169)
Resolves #8172 ## Summary This PR addresses an issue where the`id` field in the GraphQL schema is incorrectly marked as `nullable`. The change ensures that the `id` field is set to non-nullable, which aligns with the expectation that every resource should have a non-nullable ID, especially when using UUIDs as primary keys. ### Changes - Fix: Set the `id` field type to `GraphQLNonNull` for consistency in the GraphQL schema.
1 parent d28d40c commit db29e1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/graphql/src/schema/initCollections.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function initCollections({ config, graphqlResult }: InitCollectionsGraphQ
9797
const whereInputFields = [...fields]
9898

9999
if (!hasIDField) {
100-
baseFields.id = { type: idType }
100+
baseFields.id = { type: new GraphQLNonNull(idType) }
101101
whereInputFields.push({
102102
name: 'id',
103103
type: config.db.defaultIDType as 'text',

0 commit comments

Comments
 (0)