Tried to improve a query to generate better names by using fragments, like specified in LifeOfAQuery.md, which resulted in the following query:
query MyPortal_OnboardingPlans() {
onboardingPlans {
... OnboardingPlan
}
}
fragment OnboardingPlan on OnboardingPlan {
icon
title
description
tasks {
... OnboardingTask
}
}
fragment OnboardingTask on OnboardingTask {
icon
image
previewTitle
fullTitle
description
primaryAction {
__typename
... on OnboardingGoToRoute {
label
route
}
}
secondaryAction {
__typename
... on OnboardingAppCue {
label
id
}
... on OnboardingExternalLink {
label
url
}
}
completed
}
This query fails when run at runtime with the error:
ERROR: Unknown fragment "OnboardingTask".
GraphQL request:98:11
97 | description
98 | tasks {...OnboardingTask} }
| ^
99 | fragment OnboardingTask_batch_1 on OnboardingTask {icon
ERROR: Fragment "OnboardingTask_batch_1" is never used.
GraphQL request:99:1
98 | tasks {...OnboardingTask} }
99 | fragment OnboardingTask_batch_1 on OnboardingTask {icon
| ^
100 | image
The generated code for the fragments in the query is:
toFragments_ : Int -> String
toFragments_ version_ =
String.join
"""
"""
[ ("fragment " ++ GraphQL.Engine.versionedName version_ "OnboardingPlan"
)
++ """ on OnboardingPlan {icon
title
description
tasks {...OnboardingTask} }"""
, ("fragment " ++ GraphQL.Engine.versionedName version_ "OnboardingTask"
)
++ """ on OnboardingTask {icon
image
previewTitle
fullTitle
description
primaryAction{__typename
... on OnboardingGoToRoute {label
route}}
secondaryAction{__typename
... on OnboardingAppCue {label
id}
... on OnboardingExternalLink {label
url}}
completed }"""
]
Which uses the versioned fragment name when defining the OnboardingTask fragment, but it doesn't use it in the OnboardingPlan fragment itself, resulting in the above mentioned error.
Originally here (only for Vendr folk): https://github.com/Blissfully/ironzion/pull/11352/commits/7a9dfff05db1559bc128225e256e86d60fbe4036
Tried to improve a query to generate better names by using fragments, like specified in LifeOfAQuery.md, which resulted in the following query:
This query fails when run at runtime with the error:
The generated code for the fragments in the query is:
Which uses the versioned fragment name when defining the OnboardingTask fragment, but it doesn't use it in the OnboardingPlan fragment itself, resulting in the above mentioned error.