Support fragments in GraphQL API queries
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
Using fragment in GraphQL
**Returns**
```bash
{
"errors": [
{
"message": "Query should contain either measures, dimensions or timeDimensions with granularities in order to be valid",
"locations": [
{
"line": 34,
"column": 3
}
],
"path": [
"cube"
]
}
],
"data": null
}
```
**The Query**
```graphql
fragment recoveredSalesStats on Result {
orders {
recovered_sales
created_at @include(if: $charts) {
hour @include(if: $isHourly)
day @include(if: $isDaily)
week @include(if: $isWeekly)
month @include(if: $isMonthly)
year @include(if: $isYearly)
}
}
}
query GetRecoveredSalesStats(
$currDateRange: [String]
$prevDateRange: [String]
$brandId: String
$workflowId: String
$charts: Boolean = true
$isHourly: Boolean = false
$isDaily: Boolean = false
$isWeekly: Boolean = false
$isMonthly: Boolean = false
$isYearly: Boolean = false
$timezone: String
) {
cube(
timezone: $timezone
where: {
workflows: { id: { equals: $workflowId } }
brands: { id: { equals: $brandId } }
orders: { created_at: { inDateRange: $currDateRange } }
}
) {
...recoveredSalesStats
}
prev: cube(
timezone: $timezone
where: {
workflows: { id: { equals: $workflowId } }
brands: { id: { equals: $brandId } }
orders: { created_at: { inDateRange: $prevDateRange } }
}
) {
...recoveredSalesStats
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.