docs: Update connectors error codes#3260
Conversation
|
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
d535d07 to
b717d13
Compare
| </td> | ||
| <td> | ||
|
|
||
| Using both [`$batch`](/graphos/connectors/mapping/variables#batch) and [`$this`](/graphos/connectors/mapping/variables#this) in a mapping is not allowed. |
There was a problem hiding this comment.
| Using both [`$batch`](/graphos/connectors/mapping/variables#batch) and [`$this`](/graphos/connectors/mapping/variables#this) in a mapping is not allowed. | |
| Using both [`$batch`](/graphos/connectors/mapping/variables#batch) and [`$this`](/graphos/connectors/mapping/variables#this) in the same connector is not allowed. |
| <td> | ||
|
|
||
| A `@key` could not be resolved for the given combination of variables. In order to create a valid `@key` | ||
| selection's are expected contain at least one of the following variables: `$args`, `$this`, or `$batch`. |
There was a problem hiding this comment.
| selection's are expected contain at least one of the following variables: `$args`, `$this`, or `$batch`. | |
| selections are expected contain at least one of the following variables: `$args`, `$this`, or `$batch`. |
Librarian is correct
There was a problem hiding this comment.
It's totally unclear to me from reading the code how this actually happens 😅. Seems like the user actually only gets an error if they mention a field which doesn't exist... which also generates another duplicate error. But I don't think not mentioning any variables causes this? So maybe we should be getting rid of this error code long term.
It already exists in released routers now, though, so I guess we should leave it documented.
| Variables (such as `$this` or `$context`) to define Connector `$batch` selections. | ||
| Batch selections should be mapped from the `$batch` variable. |
There was a problem hiding this comment.
I don't even know why we have this restriction—that doesn't seem like it should be required? But I think we should spell out the issue more clearly:
| Variables (such as `$this` or `$context`) to define Connector `$batch` selections. | |
| Batch selections should be mapped from the `$batch` variable. | |
| The `selection` fields which match any used `$batch` fields must come from the API response, not from any other variables. |
Can you also add a good/bad to https://www.apollographql.com/docs/graphos/connectors/requests/batching#rules-for-batch-connectors that we can link to here? Unless I'm misunderstanding the code—but again, I'm not sure why we added this restriction? What if the ID comes back in a header for some reason?
| </td> | ||
| <td> | ||
|
|
||
| `@connect` cannot be applied to a query, mutation, or subscription root type |
There was a problem hiding this comment.
| `@connect` cannot be applied to a query, mutation, or subscription root type | |
| `@connect` cannot be applied to a query, mutation, or subscription root type. |
For librarian
| <td> | ||
|
|
||
| The schema includes fields that aren't resolved by a connector. | ||
| The schema includes fields that aren't resolved by a [connector](/graphos/connectors). |
There was a problem hiding this comment.
| The schema includes fields that aren't resolved by a [connector](/graphos/connectors). | |
| When using [Connectors](/graphos/connectors) in a schema, every field must be resolvable by at least one Connector. To solve this problem, you will need to either add a `@connect` to the field in question, or add the field to the `selection` of an existing `@connect`. |
There was a problem hiding this comment.
I know you just added the link, but I figure we could explain the solution a bit while we're here.
Updates error code documentation for new
$batcherror codes.Also adds links to a few error messages where it may be helpful.