Skip to content

How could i manage to add or remove field from a GraphQL query #1877

Discussion options

You must be logged in to vote

No it is not possible. If a user requests fieldA then they are guaranteed to get fieldA (or null if it is nullable) in the response OR its a server error. Changing request to remove some fields/add additional fields is breaking the contract (and will break your clients).

You could use directives to apply some authentication mechanism to modify the response to return null for unauthenticated/unauthorized users but your response would still contain an entry for the given field.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fmorissette-equisoft
Comment options

Answer selected by fmorissette-equisoft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants