StellateHQ / fuse

Fuse: The fastest way to build and query great APIs with TypeScript

Home Page:https://fusedata.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: node always have `id` even if `key` is set to something else

mxstbr opened this issue · comments

Description

CleanShot 2024-01-16 at 12 24 16@2x

My User type has a username key. The underlying data does not have an id. Yet, the generated GraphQL object type has User.id even though that field doesn't exist.

User.username is also nullable in the GraphQL schema even though it is the key.

the key prop is used to generate the id property. A node needs a key and you are telling us that we can generate that from username. This is intended behaviour, it's true however that a nullable field should warn in ts.

We translate __typename:values[key] to the id property

Ohh, that makes a ton of sense!