hasura / hasura/graphql-engine
Object relationship in a SQL view is nullable but shouldn't be
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: v2.0.8-cloud.3
### Environment
Hasura Cloud and OSS
### What is the expected behaviour?
I set up a small repro case at https://nullable.hasura.app/v1/graphql -- happy to add anyone as a collaborator on it so you can see the setup. It's just a database with two tables, foo and bar, and a view foo_view which is essentially just a copy of foo.
foo and foo_view both have a 'bar_id' column and an object relationship to the 'bar' table.
foo.bar is non-nullable (as I would expect) and foo_view.bar is nullable (as I would not expect)
You can see this by running [graphqurl](https://www.npmjs.com/package/graphqurl):
`gq https://nullable.hasura.app/v1/graphql --introspect`
and looking for `type foo` (containing non-nullable `bar!`) and `type foo_view` (containing nullable `bar`) in the output:
```
"""
columns and relationships of "foo"
"""
type foo {
"""An object relationship"""
bar: bar!
bar_id: Int!
id: Int!
}
```
```
"""
columns and relationships of "foo_view"
"""
type foo_view {
"""An object relationship"""
bar: bar
bar_id: Int
id: Int
}
```
### Keywords
nullable, object relationship, sql view
Contributor guide
Research direction
Start by reproducing the schema with the linked Hasura Cloud setup and the graphqurl introspection command, comparing foo with foo_view. Trace how the object relationship and view columns are represented in the generated GraphQL schema; done means foo_view.bar and its related fields have the expected non-nullability.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, sql
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100