Validation of @defer
/@stream
label arguments
#35
Replies: 4 comments 5 replies
-
3 sounds reasonable to me. If this ends up preventing real use cases, we can always allow it later. |
Beta Was this translation helpful? Give feedback.
-
This was discussed at the March 2022 WG meeting and we decided to add validation preventing variables in labels, and a validation enforcing uniqueness. Spec and reference implementation PRs have both been updated to reflect this. |
Beta Was this translation helpful? Give feedback.
-
from @yaacovCR
|
Beta Was this translation helpful? Give feedback.
-
Sorry to come back to this topic again! A question arose while implementing this validation: is "document" meant to mean the whole document across multiple operations? For instance, this would mean the following is invalid: query Query1 {
field {
...fieldDetails1 @defer(label: "details")
}
}
query Query2 {
field {
...fieldDetails2 @defer(label: "details")
}
} even though this can never cause any ambiguity? |
Beta Was this translation helpful? Give feedback.
-
Context
raised by @BoD graphql/graphql-spec#742 (comment)
The
label
argument on@defer
and@stream
is used by GraphQL clients to identify the data from patch responses and associate it with the correct fragment. If provided, the GraphQL Server must add it to the payload.Validating this argument runs into the same issue that was discussed in @stream initialCount validation; the validation stage can happen before variables are known.
Three options considered:
Decision
Discussed at the March 2022 WG meeting and decided to add validation preventing variables in labels, and a validation enforcing uniqueness.
There haven't been any use cases raised that require variables for label values. This could be loosened later without breaking backwards compatibility if additional use cases are discovered.
Status
Beta Was this translation helpful? Give feedback.
All reactions