mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
b1ee3ae1b8
## Description This PR continues on from #725 and adds the metadata resolve logic to validate the usage of aggregates applied to relationships. The metadata resolve logic is gated behind a new `enable_aggregate_relationships` flag and disabled by default. The new resolve logic lives in `crates/metadata-resolve/src/stages/relationships/mod.rs`, however, most of the actual logic that validates the usage of the aggregate expression with the relationship has been reused from the model aggregate resolve code. Subsequently, that code (`crates/metadata-resolve/src/stages/models/aggregation.rs`) was refactored to return a distinct error type `ModelAggregateExpressionError` that can be composed with the `RelationshipError` type, so the same errors can be returned with the additional context of the relationship they were found in. New metadata resolve error tests have been added in `crates/metadata-resolve/tests/failing/aggregate_expression_in_relationship/*`. Also, two new passing metadata resolve tests have been added to cover the happy case of root field and relationship aggregate expressions: `crates/metadata-resolve/tests/passing/aggregate_expressions/*` JIRA: [V3ENGINE-160](https://hasurahq.atlassian.net/browse/V3ENGINE-160) [V3ENGINE-160]: https://hasurahq.atlassian.net/browse/V3ENGINE-160?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ V3_GIT_ORIGIN_REV_ID: 8cd7040cc9277940641d5ac239d7b34f8c1462c5 |
||
---|---|---|
.. | ||
src | ||
tests | ||
Cargo.toml |