graphql-engine/server/src-lib
Antoine Leblanc 404551acdb server: fix major issue with JSON instances of AnyBackend
### Description
This PR fixes a major issue in the JSON instances of `AnyBackend`: they were not symmetrical! `FromJSON` always made the assumption that the value was an object, and that it contained a "kind" field if it happened to not be a Postgres value. `ToJSON` did NOT insert said field in the output, and did not enforce that the output was an object.

....however, it worked, because nowhere in the code did we yet rely on those being symmetrical. They are both used only once:
- `parseJSON` was used to decode a `Metadata` object, but the matching `toJSON` instance, which is heavily customized, does insert the "kind" field properly
- `toJSON` was only used on the `SchemaCache`, which has no corresponding `FromJSON` instance, since we only serialize it in debug endpoints

This PR makes no attempt at making the instances symmetrical. Instead, it implements simpler functions, and pushes the problem of identifying the proper backend (if any) to the call sites.

### Notes

Additionally, it cleans up some instances that were manually written where they could be auto-generated. In the process, this PR changes the semantics of `Show`, since the stock derived instance will include the constructor name, where before it was skipped. I think it is preferable.

https://github.com/hasura/graphql-engine-mono/pull/1672

GitOrigin-RevId: 0a1580a0e0f01c25b8c9fee7612dba6e7de055d5
2021-06-28 18:39:01 +00:00
..
Control server: graceful shutdown for event and cron triggers and async action (II) 2021-05-14 09:39:33 +00:00
Data server: misc cleanups 2021-06-15 15:06:37 +00:00
GHC/Stats Add a new /dev/rts_stats endpoint, enabled when '+RTS -T' 2021-04-13 17:33:38 +00:00
Hasura server: fix major issue with JSON instances of AnyBackend 2021-06-28 18:39:01 +00:00
Network server: RQL code health 2021-01-08 23:10:36 +00:00