In a GraphQL API, variables in a POST body should be input as an object. This is because it aligns with the syntax of GraphQL queries and allows for easier manipulation and validation of the input data on the server side. Using a JSON-encoded string with layers of recursion can make it difficult to parse and manipulate the input data, leading to potential errors and security vulnerabilities. Additionally, using an object as input allows for better type validation and easier error handling.
Asked: 2023-05-15 22:26:33 +0000
Seen: 17 times
Last updated: May 15 '23