| ▲ | FootballMuse 2 days ago | ||||||||||||||||||||||||||||
Pruning a response does nothing since everything still goes across the network | |||||||||||||||||||||||||||||
| ▲ | hdjrudni 2 days ago | parent | next [-] | ||||||||||||||||||||||||||||
Pruning the response would help validate your response schema is correct and that is delivering what was promised. But you're right, if you have version skew and the client is expecting something else then it's not much help. You could do it client-side so that if the server adds an optional field the client would immediately prune it off. If it removes a field, it could fill it with a default. At a certain point too much skew will still break something, but that's probably what you want anyway. | |||||||||||||||||||||||||||||
| ▲ | hn_throwaway_99 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||
You're misunderstanding. In GraphQL, the server prunes the response object. That is, the resolver method can return a "fat" object, but only the object pruned down to just the requested fields is returned over the wire. It is an important security benefit, because one common attack vector is to see if you can trick a server method into returning additional privileged data (like detailed error responses). | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||