The Relay Resolver backing this field is defined with an invalid `fragment_name`
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Experimenting with resolvers, I'm not sure if this is a bug or I'm doing something wrong.
With a type straight out of the documentation like:
```
type PetModel = {
id: DataID
}
/**
* @RelayResolver Pet
*/
export function Pet(id: DataID): PetModel {
return null
}
```
I get the following error:
```
[ERROR] Error: ✖︎ The Relay Resolver backing this field is defined with an invalid `fragment_name`. Could not find a fragment named 'Pet__id'.
src/schema-extensions/resolvers/pet.ts:16:3
16 │ *
│ ^
17 │ * @RelayResolver Pet
```
I'm not sure what this means or how to fix it. Heres my config:
v18.2.0
```
"relay": {
"noFutureProofEnums": true,
"typescriptExcludeUndefinedFromNullableUnion": true,
"artifactDirectory": "./src/__generated__/",
"customScalarTypes": {
"UUID": "string",
"BigInt": "string",
"NativeBigInt": "bigint",
"Date": "string",
"JSON": "JSONType",
"Datetime": "string",
"Upload": "File"
},
"language": "typescript",
"schema": "./../types/schema.graphql",
"src": "./src/",
"schemaConfig": {
"nodeInterfaceIdField": "nodeId"
},
"schemaExtensions": [
"./src/schema-extensions"
]
}
```
Contributor guide
Research direction
Start by reproducing the v18.2.0 error from src/schema-extensions/resolvers/pet.ts using the documented Pet resolver and the supplied Relay configuration. Check how the resolver's id field is interpreted and where the missing Pet__id fragment is expected; done means the documented example has a clear, working outcome without the invalid fragment_name error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100