graphql-engine/server/src-lib/Hasura/Server
Antoine Leblanc 3a400fab3d Rewrite OpenAPI
### Description

This PR rewrites OpenAPI to be more idiomatic. Some noteworthy changes:
- we accumulate all required information during the Analyze phase, to avoid having to do a single lookup in the schema cache during the OpenAPI generation phase (we now only need the schema cache as input to run the analysis)
- we no longer build intermediary endpoint information and aggregate it, we directly build the the `PathItem` for each endpoint; additionally, that means we no longer have to assume that different methods have the same metadata
- we no longer have to first declare types, then craft references: we do everything in one step
- we now properly deal with nullability by treating "typeName" and "typeName!" as different
- we add a bunch of additional fields in the generated "schema", such as title
- we do now support enum values in both input and output positions
- checking whether the request body is required is now performed on the fly rather than by introspecting the generated schema
- the methods in the file are sorted by topic

### Controversial point

However, this PR creates some additional complexity, that we might not want to keep. The main complexity is _knot-tying_: to avoid lookups when generating the OpenAPI, it builds an actual graph of input types, which means that we need something similar to (but simpler than) `MonadSchema`, to avoid infinite recursions when analyzing the input types of a query. To do this, this PR introduces `CircularT`, a lesser `SchemaT` that aims at avoiding ever having to reinvent this particular wheel ever again.

### Remaining work

- [x] fix existing tests (they are all failing due to some of the schema changes)
- [ ] add tests to cover the new features:
  - [x] tests for `CircularT`
  - [ ] tests for enums in output schemas
- [x] extract / document `CircularT` if we wish to keep it
- [x] add more comments to `OpenAPI`
- [x] have a second look at `buildVariableSchema`
- [x] fix all missing diagnostics in `Analyze`
- [x] add a Changelog entry?

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4654
Co-authored-by: David Overton <7734777+dmoverton@users.noreply.github.com>
GitOrigin-RevId: f4a9191f22dfcc1dccefd6a52f5c586b6ad17172
2022-06-30 12:57:09 +00:00
..
API server: GHC 9.2 changes compatible with 8.10 (#3550) 2022-06-25 22:09:05 +00:00
Auth server: Fix a bunch of HLint suggestions 2022-06-21 11:12:42 +00:00
Init server: add default naming convention to TenantConfig 2022-06-14 09:18:20 +00:00
Migrate server: Encapsulate catalog versions in their own type. 2022-06-29 08:19:33 +00:00
Telemetry server/telemetry: support multiple sources 2022-06-15 08:03:31 +00:00
App.hs Rewrite OpenAPI 2022-06-30 12:57:09 +00:00
Auth.hs server: assorted minor clean-up around HTTP managers 2022-02-16 07:09:47 +00:00
CheckUpdates.hs Yeet some default-extensions 2022-03-16 00:40:17 +00:00
Compression.hs server, pro: actually reformat the code-base using ormolu 2021-09-23 22:57:37 +00:00
Cors.hs Yeet some default-extensions 2022-03-16 00:40:17 +00:00
Init.hs Fixes asyncActionsFetchIntervalEnv help message. 2022-06-23 05:07:13 +00:00
Limits.hs server: add explicit export lists in OSS server and enforce with warning 2021-11-04 16:09:38 +00:00
Logging.hs server: Refactor TByteString to SerializableBlob 2022-06-17 09:57:38 +00:00
MetadataOpenAPI.hs server: initial set of DTO types for metadata 2022-06-27 16:33:31 +00:00
Metrics.hs server: add metric for the metadata resource version 2022-03-08 23:00:27 +00:00
Middleware.hs server: assorted minor clean-up around HTTP managers 2022-02-16 07:09:47 +00:00
Migrate.hs server: Encapsulate catalog versions in their own type. 2022-06-29 08:19:33 +00:00
Name.hs server: Reorganize quasi-quoted names. 2022-06-23 09:15:31 +00:00
OpenAPI.hs Rewrite OpenAPI 2022-06-30 12:57:09 +00:00
Rest.hs server: Reorganize quasi-quoted names. 2022-06-23 09:15:31 +00:00
SchemaCacheRef.hs Add unless/when related hints 2022-05-27 13:34:42 +00:00
SchemaUpdate.hs Remove RQL/Types.hs 2022-04-27 13:58:47 +00:00
Telemetry.hs Remove source cache requirement in action schema 2022-06-23 10:52:32 +00:00
Types.hs server/telemetry: support multiple sources 2022-06-15 08:03:31 +00:00
Utils.hs Weeding (2/?) 2022-06-09 16:40:49 +00:00
Version.hs server/ci: rework version baking, and cache dist-newstyle in CI 2022-04-05 15:59:09 +00:00