hasura / hasura/graphql-engine
String cast issue: field name is a graphql type and a reserved words in many languages
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: 2.8.0
CLI Version (for CLI related issue): 2.8.0
### Environment
OSS
### What is the expected behaviour?
Fields in the graphql schema don't clash with graphql types and common reserved words in many languages.
### Keywords
cast, String, jsonb
### What is the current behaviour?
Schema contains fields named `String`. E.g.:
```
input jsonb_cast_exp {
String: String_comparison_exp
}
```
### How to reproduce the issue?
1. Export schema that uses jsonb, or any of the postgres types in https://github.com/hasura/graphql-engine/pull/8524
### Screenshots or Screencast
Error in autogenerated dart code for flutter app:

### Please provide any traces or logs that could help here.
Issue exists with JSONB since 2.5.0, but recently it was added to other types in this PR: https://github.com/hasura/graphql-engine/pull/8524
### Any possible solutions?
Use `string` or `_String`.
### Can you identify the location in the source code where the problem exists?
Not sure.
### If the bug is confirmed, would you be willing to submit a PR?
If someone can point me to the code, yes.
Contributor guide
Research direction
Start by reviewing pull request #8524 and the schema export path for JSONB and other PostgreSQL types. Reproduce the exported schema and inspect the generated Dart code; done means generated field names no longer collide with GraphQL types or common language reserved words.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter, postgresql
- Domain
- api, backend-api-design, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100