-
Notifications
You must be signed in to change notification settings - Fork 2.8k
support union and interface types in remote schema (close #1276) #1361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Review app for commit fd9ea10 deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
| instance EquatableGType ObjTyInfo where | ||
| type EqProps ObjTyInfo = | ||
| (G.NamedType, Map.HashMap G.Name (G.Name, G.GType, ParamMap)) | ||
| getEqProps a = (,) (_otiName a) (Map.map getEqProps (_otiFields a)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll also need to check if the interfaces that are implemented are same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed getEqProps to output a 3 part tuple, which includes HashSet of implementing interfaces
| , _otiFields :: !ObjFieldMap | ||
| { _otiDesc :: !(Maybe G.Description) | ||
| , _otiName :: !G.NamedType | ||
| , _otiImplIFaces :: [G.NamedType] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use a hashset here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Changed from Array of implementing interfaces to HashSet.
2) In Object equality check, check whether the implementing interfaces are the same as well
|
Review app for commit e40372e deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
|
Review app for commit d0ebdeb deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
|
Review app for commit 9970446 deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
|
@nizar-m can you also mention which portions of documentation has to change? |
2) Test for remote schema validation errors with union types
|
Review app for commit 2de92c3 deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
|
Review app for commit 44b2c68 deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
…ct and Interface types 2) Tests for schema validation errors on object types implementing interfaces
|
Review app for commit 4485c0b deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
|
Review app for commit d43a42f deployed to Heroku: https://hge-ci-pull-1361.herokuapp.com |
|
Review app https://hge-ci-pull-1361.herokuapp.com is deleted |
…ssues with nested fields (#1361) ### What This PR reworks the GraphQL schema annotation types and IR parsing for boolean expressions. This was required because the existing code was quite tangled and broken as it did not properly handled nested fields. For example, it had the following issues: * If you use more than one nested field in a single where, an invalid NDC query is generated with mangled field paths * If you use logical operators inside a nested field, an internal error occurs The new annotation structure and IR parsing code cleanly matches the two types of boolean expressions we currently have: object boolean expressions and scalar boolean expressions. The new parsing code correctly tracks nested fields and allows arbitrary nesting of object boolean expressions (and therefore logical operators at the object boolean expression level). ### How In `crates/graphql/schema/src/types.rs` `BooleanExpressionAnnotation` has been reworked to capture the two different types of boolean expressions. It now has the two `ObjectBooleanExpressionField` and `ScalarBooleanExpressionField` variants, which are used to denote fields on each of the different types of boolean expression objects. Previously scalar boolean expression annotations lived on `ModelInputAnnotation`, muddying the waters. Then in `crates/graphql/ir/src/filter.rs`, we have `resolve_object_boolean_expression` and `resolve_scalar_boolean_expression` which are capable of reading the respective variants of boolean expressions. `resolve_object_boolean_expression` is recursive, and so nested logical operators are handled naturally. As nested fields are descended through, this is kept track of with `column_path`. Some new fields were added to the existing nested object test (`crates/engine/tests/execute/models/select_many/where/nested_select/object/request.gql`) to capture and test the previously broken scenarios. A minor fix was made to `crates/graphql/frontend/src/to_opendd_ir.rs` because it did not handle multiple root fields properly, as it did not use the root field aliases and ended up overwriting the same query over and over. This resulted in many snapshots getting updated, even though they are unrelated to the real change in this PR. V3_GIT_ORIGIN_REV_ID: f7cbbe8c86f542150e0ce247c6597df717836c06
Description
What component does this PR affect?
Requires changes from other components? If yes, please mark the components:
Related Issue
#1276
Solution and Design
Type
Checklist: