graphql-engine/server/src-lib/Hasura/RQL/IR
David Overton 346804fc67 Support nested object fields in DC API and use this to implement nest…
## Description

This change adds support for nested object fields in HGE IR and Schema Cache, the Data Connectors backend and API, and the MongoDB agent.

### Data Connector API changes

- The `/schema` endpoint response now includes an optional set of GraphQL type definitions. Table column types can refer to these definitions by name.
- Queries can now include a new field type `object` which contains a column name and a nested query. This allows querying into a nested object within a field.

### MongoDB agent changes

- Add support for querying into nested documents using the new `object` field type.

### HGE changes

- The `Backend` type class has a new type family `XNestedObjects b` which controls whether or not a backend supports querying into nested objects. This is currently enabled only for the `DataConnector` backend.
- For backends that support nested objects, the `FieldInfo` type gets a new constructor `FINestedObject`, and the `AnnFieldG` type gets a new constructor `AFNestedObject`.
- If the DC `/schema` endpoint returns any custom GraphQL type definitions they are stored in the `TableInfo` for each table in the source.
- During schema cache building, the function `addNonColumnFields` will check whether any column types match custom GraphQL object types stored in the `TableInfo`. If so, they are converted into `FINestedObject` instead of `FIColumn` in the `FieldInfoMap`.
- When building the `FieldParser`s from `FieldInfo` (function `fieldSelection`) any `FINestedObject` fields are converted into nested object parsers returning `AFNestedObject`.
- The `DataConnector` query planner converts `AFNestedObject` fields into `object` field types in the query sent to the agent.

## Limitations

### HGE not yet implemented:
- Support for nested arrays
- Support for nested objects/arrays in mutations
- Support for nested objects/arrays in order-by
- Support for filters (`where`) in nested objects/arrays
- Support for adding custom GraphQL types via track table metadata API
- Support for interface and union types
- Tests for nested objects

### Mongo agent not yet implemented:

- Generate nested object types from validation schema
- Support for aggregates
- Support for order-by
- Configure agent port
- Build agent in CI
- Agent tests for nested objects and MongoDB agent

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7844
GitOrigin-RevId: aec9ec1e4216293286a68f9b1af6f3f5317db423
2023-04-11 01:30:37 +00:00
..
BoolExp server: delete the Cacheable type class in favor of Eq 2022-11-21 16:35:37 +00:00
Update Refactor Update IR to generalize Update vs Update Many across backends - compositional approach [GDC-687] 2023-01-10 01:56:14 +00:00
Action.hs Remove strictness annotations from data types in the Hasura.RQL hierarchy 2022-08-01 09:33:35 +00:00
BoolExp.hs chore(server): move user-defined-functions into Hasura.Function.* 2023-04-03 10:20:20 +00:00
Conflict.hs server: Improve code readability around OnConflict clauses 2021-12-20 11:16:46 +00:00
Delete.hs Simplify instance boilerplate 2022-08-11 16:32:41 +00:00
Insert.hs Enhance insert table schema with extra info and remove need for cached schema usage in Super Connector mutations 2023-04-05 02:23:20 +00:00
OrderBy.hs Remove strictness annotations from data types in the Hasura.RQL hierarchy 2022-08-01 09:33:35 +00:00
RemoteSchema.hs Show RQL IR Select 2023-01-04 08:29:43 +00:00
Returning.hs Simplify instance boilerplate 2022-08-11 16:32:41 +00:00
Root.hs chore(server): move some query tags code to a sensible place 2023-03-30 21:19:38 +00:00
Select.hs Support nested object fields in DC API and use this to implement nest… 2023-04-11 01:30:37 +00:00
Update.hs Refactor Update IR to generalize Update vs Update Many across backends - compositional approach [GDC-687] 2023-01-10 01:56:14 +00:00
Value.hs server: switch to ghc 9.2 (2nd try) 2022-10-06 09:09:01 +00:00