mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
81ac867d16
This is Part 2 in a stacked PR set that delivers aggregate root field support. * Part 1: OpenDD: https://github.com/hasura/v3-engine/pull/683 * Part 3: GraphQL API: https://github.com/hasura/v3-engine/pull/685 JIRA: [V3ENGINE-159](https://hasurahq.atlassian.net/browse/V3ENGINE-159) ## Description This PR implements the metadata resolve phase of the engine and adds support for resolving `AggregateExpression`s and validates their use when linked to a `Model`. The bulk of the changes can be found in: * `crates/metadata-resolve/src/stages/aggregates/*` - This is where the `AggregateExpression`s are resolved * `crates/metadata-resolve/src/stages/models/mod.rs` - This is where we validate the `AggregateExpression` specified for use in the model is actually compatible with the model and its data connector The `ndc-spec` version used has been lifted to the latest version that adds support for aggregates over nested objects (https://github.com/hasura/ndc-spec/pull/144). This necessitated changes in the Custom Connector, but actual functionality to implement aggregation over nested objects is implemented in Part 3. There are also some changes in `crates/metadata-resolve/src/types/subgraph.rs` where the `Display` trait for the various `Qualified<T>`, `QualifiedTypeReference`, etc types has been reworked so that they print more cleanly, with the subgraph being put outside the type syntax, and array types getting formatted correctly. For example, previous an array of Varchars would have printed as `Varchar (in subgraph default)!`, now it properly formats as `[Varchar!]! (in subgraph default)`. This was necessary to make useful error messages using these types. A tonne of tests have been added in `crates/engine/tests/validate_metadata_artifacts/aggregate_expressions` to test every error condition of the metadata resolve process. [V3ENGINE-159]: https://hasurahq.atlassian.net/browse/V3ENGINE-159?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ V3_GIT_ORIGIN_REV_ID: ffd859127a3f1560707f06ef01906c9d1b183d31 |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml |