hasura / hasura/graphql-engine
docs: add note on confusing error message for action relationships
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
When trying to save an array relationship from a Hasura Action, I get the following error message in the form `field X for relationship Y in object type Z does not exist`
Here's the action definition:
```
-- action:
type Mutation {
upsertNotes (
notes: [Note]
): NoteIds
}
--types:
input Note {
id : Int
title : String
content : [String]
refs : [String]
}
type NoteIds {
ids : [Int!]!
}
```
I can save the action, insert to it, and get a response, but when I try to create an array relationship of NoteIds.ids -> notes.id the error message I get is:
```
Saving relationship failed
validation for the given custom types failed because the field "ids" for relationship "notes" in object type "NoteIds" does not exist
```
However, if I change the action definition to the following, and use an object relationship of NoteId.id -> notes.id, it works.
```
-- action:
type Mutation {
upsertNotes (
notes: [Note]
): [NoteId]
}
-- types:
input Note {
id : Int
title : String
content : [String]
refs : [String]
}
type NoteId {
id : Int!
}
```
Contributor guide
Research direction
No documentation file or test is named. Start by reviewing the Hasura Action custom-type and relationship documentation against the two SDL examples in the report, then document why the array relationship validation fails and how the supported object relationship differs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100