hasura / hasura/graphql-engine
Changing the data type of a remote schema will break the metadata
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
Version:
hasura/graphql-engine:v2.0.7.cli-migrations-v3
Steps to reproduce:
1. Add new input to remote schema (created with [DGS Framework](https://github.com/netflix/dgs-framework/))
```
input FooInput {
attachedFiles: [String]
}
```
1. Reload the remote schema from http://localhost:9695/console/remote-schemas/manage/XXX/details
1. Add permissions to `attachedFiles` field to the user role from http://localhost:9695/console/remote-schemas/manage/XXX/permissions
1. No problem so far
1. Change `attachedFiles` field to `[String!]`
```
input FooInput {
attachedFiles: [String!]
}
```
1. Restart DGS Framework (Spring Boot)
1. Reload remote schema from http://localhost:9695/console/remote-schemas/manage/XXX/details

1. Metadata is broken!
```
Inconsistent object: in remote schema permission for role "user": validation for the given role-based schema failed because expected type of "attachedFiles"("Input object argument") to be [String!] but received [String]
```


metadata/remote_schemas.yaml is still the old definition.
```
input FooInput {
attachedFiles: [String]
}
```
but remote schema permission is accurately updated.

I tried manually editing the metadata/remote_schemas.yaml as follows and reload metadata, but did not fix the problem.
```
input FooInput {
attachedFiles: [String!]
}
```
How can I safely change the data type of a remote schema?
Contributor guide
Research direction
Start by reproducing the remote-schema reload and permission update flow described in the issue, then inspect metadata/remote_schemas.yaml and the remote schema permission handling behind the Console details and permissions URLs. Done means changing an input field from [String] to [String!] no longer leaves metadata inconsistent, and reloading metadata succeeds without the reported validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql
- Domain
- api, authorization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100