Ask Your Question
1

In a GraphQL API, should the variables in a POST body be input as an object or represented as a JSON-encoded string with layers of recursion?

asked 2023-05-15 22:26:33 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-05-15 22:32:02 +0000

bukephalos gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-15 22:26:33 +0000

Seen: 16 times

Last updated: May 15 '23