graphql-engine/server/src-lib/Hasura/GraphQL
Antoine Leblanc 498442b1d3 Remove circular dependency in schema building code
### Description

The main goal of this PR is, as stated, to remove the circular dependency in the schema building code. This cycle arises from the existence of remote relationships: when we build the schema for a source A, a remote relationship might force us to jump to the schema of a source B, or some remote schema. As a result, we end up having to do a dispatch from a "leaf" of the schema, similar to the one done at the root. In turn, this forces us to carry along in the schema a lot of information required for that dispatch, AND it forces us to import the instances in scope, creating an import loop.

As discussed in #4489, this PR implements the "dependency injection" solution: we pass to the schema a function to call to do the dispatch, and to get a generated field for a remote relationship. That way, this function can be chosen at the root level, and the leaves need not be aware of the overall context.

This PR grew a bit bigger than that, however; in an attempt to try and remove the `SourceCache` from the schema altogether, it changed a lot of functions across the schema building code, to thread along the `SourceInfo b` of the source being built. This avoids having to do cache lookups within a given source. A few cases remain, such as relay, that we might try to tackle in a subsequent PR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4557
GitOrigin-RevId: 9388e48372877520a72a9fd1677005df9f7b2d72
2022-05-27 17:22:38 +00:00
..
Execute Add unless/when related hints 2022-05-27 13:34:42 +00:00
Parser server: add infrastructure to write runit tests for update parsers 2022-05-26 14:06:24 +00:00
Schema Remove circular dependency in schema building code 2022-05-27 17:22:38 +00:00
Transport Rename Data Wrapper to Data Connector [GDW-89] 2022-05-02 05:04:07 +00:00
Analyse.hs server: refactor Hasura.GraphQL.Analyse 2022-05-04 10:57:55 +00:00
Context.hs server: streaming subscriptions schema generation and tests (incremental PR - 3) 2022-04-22 19:54:11 +00:00
Execute.hs move action IR types to IR.Actions module 2022-05-14 11:10:42 +00:00
Explain.hs Remove RQL/Types.hs 2022-04-27 13:58:47 +00:00
Logging.hs Source typename customization (close graphql-engine#6974) 2021-10-29 14:43:14 +00:00
Namespace.hs Refactor type name customization 2021-11-30 09:52:53 +00:00
ParameterizedQueryHash.hs Prevent uses of unsafeMkName whenever possible. 2022-01-27 15:13:37 +00:00
Parser.hs Fix Decimal serialization for BigQuery backend 2022-04-13 17:09:45 +00:00
RemoteServer.hs Remove circular dependency in schema building code 2022-05-27 17:22:38 +00:00
Schema.hs Remove circular dependency in schema building code 2022-05-27 17:22:38 +00:00