mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 01:44:03 +03:00
404551acdb
### 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 |
||
---|---|---|
.. | ||
Control | ||
Data | ||
GHC/Stats | ||
Hasura | ||
Network |