graphql-engine/server/src-lib/Hasura/GraphQL
Swann Moreau 5760d9289c server: introspection cleanups
this pr modifies the representation chosen for introspection parsers, "pushing down" the `Schema` input so it is not required to build the parser anymore. instead, the value produced when the parser is evaluated becomes a function that consumes a schema:
```diff
-schema :: MonadParse n => Schema -> FieldParser n (          J.Value)
+schema :: MonadParse n =>           FieldParser n (Schema -> J.Value)
 ```

this addresses points (1) and (2) of #2833 and is intended to make #2799 easier: we will need to enforce permissions when generating introspection objects, hiding fields the user is not allowed to see, so if we can pass the schema _later_, we can build this parser once, evaluate it once to (morally) obtain a function `Schema -> Value`, and simply run that single `Schema -> Value` function on different role-based schemas.

(we really need some terminology to be fixed here: "parser" is already not the best name, and then we have parser vs value/function "returned" by parser vs...)

however, we have immediate benefits: we no longer _need_ a `Schema` object to build the introspection parsers! this means we can remove the bogus "degenerate case" schema that is currently constructed in `emptyIntrospection` (and indeed we remove that binding altogether).

(fun fact: the diff for this pull request has a negative line count despite adding a lot of comments. @abooij says i have bragging rights in perpetuity now, à la @nicuveo)

changes:
- internal changes to the operation of the server, invisible outside of a small number of `GraphQL.Schema.*` modules
- no user-facing changes

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2835
Co-authored-by: Auke Booij <164426+abooij@users.noreply.github.com>
Co-authored-by: Brandon Simmons <210815+jberryman@users.noreply.github.com>
GitOrigin-RevId: 9990f53b8f5c733424c4d71a24d94c13dee842ba
2021-12-21 17:29:54 +00:00
..
Execute server: add support for nested object type in action 2021-12-15 23:52:43 +00:00
Parser Avoid NonNullableType 2021-12-20 17:03:28 +00:00
Schema server: introspection cleanups 2021-12-21 17:29:54 +00:00
Transport multitenant: support for starting multitenant in read only mode 2021-12-08 06:27:49 +00:00
Context.hs Source typename customization (close graphql-engine#6974) 2021-10-29 14:43:14 +00:00
Execute.hs multitenant: support for starting multitenant in read only mode 2021-12-08 06:27:49 +00:00
Explain.hs Source typename customization (close graphql-engine#6974) 2021-10-29 14:43:14 +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 server, pro: actually reformat the code-base using ormolu 2021-09-23 22:57:37 +00:00
Parser.hs server, pro: actually reformat the code-base using ormolu 2021-09-23 22:57:37 +00:00
RemoteServer.hs Remove Unique from Definition 2021-12-01 16:21:35 +00:00
Schema.hs server: introspection cleanups 2021-12-21 17:29:54 +00:00