Is it mandatory for servers to honor the defer/stream directive? #7
Replies: 3 comments 21 replies
-
I think SHOULD could just be changed to MUST. why does the server know better than the client what is more performant, and certainly will always take more bandwidth to send rather than defer. perhaps an argument could be added ‘@defer unlessYouThinkNot=true’ i also don’t think we can say this is implemented in graphql js, maybe I missed it, is there a case where graphql js chooses not to honor the directive? |
Beta Was this translation helpful? Give feedback.
-
I think the following questions are also related to this: graphql/graphql-over-http#167 |
Beta Was this translation helpful? Give feedback.
-
One reason why should is better for advanced use cases (maybe not a great reason but a reason): If you have a server that composes many child servers (so each of those child servers' schemas compose to form the parent schema): some of those child servers may implement @defer/@stream, but if even one child server responsible for even a single schema type does not support it, you either need to walk the entire tree in the parent server in order to split up the already-stitched-together response tree (if all servers that support @defer/@stream must batch every time), or we need to allow ignoring the defer/stream directives when the server chooses. |
Beta Was this translation helpful? Give feedback.
-
Decision
The spec will state that servers SHOULD honor the
@defer
and@stream
directives.Consequences
Most importantly, leaving open the possibility that defer/stream can be ignored ensures that clients remain flexible. This allows for spec changes in the future that are non-breaking. If this ends up being the wrong decision, a new RFC can be brought to the working group to change SHOULD to MUST without fear of breaking clients. If we go with MUST now, it would not be possible to change to SHOULD or MAY without breaking clients.
Status
Beta Was this translation helpful? Give feedback.
All reactions