Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider Use of JSON Return Type in columnStatistics GraphQL Query #31

Open
msk opened this issue May 25, 2023 · 0 comments
Open

Reconsider Use of JSON Return Type in columnStatistics GraphQL Query #31

msk opened this issue May 25, 2023 · 0 comments

Comments

@msk
Copy link
Contributor

msk commented May 25, 2023

The current implementation of the columnStatistics query in REview's GraphQL API schema is noted to return a JSON! type. This configuration, while providing broad flexibility, raises several concerns regarding efficiency and the overall utilization of GraphQL's key benefits.

  • Type Safety: GraphQL's value is considerably augmented by its strong typing system. It ensures predictability and consistency across the API. The usage of a raw JSON object in the columnStatistics query circumvents this safety feature, possibly leading to downstream issues due to a lack of clear expectations on the client's end.
  • Introspection Capabilities: GraphQL offers introspection capabilities allowing clients to understand the structure of the schema and the data it can return. When returning raw JSON, these capabilities are bypassed, reducing the client's ability to interact with the data effectively.
  • Query Flexibility: One of the key strengths of GraphQL lies in the flexibility it offers clients to specify exactly what data they require. By returning a raw JSON object, the client is obliged to manage the entire JSON structure, irrespective of their data requirements.
  • Efficiency Concerns: Returning a complete JSON object could introduce inefficiencies, particularly in terms of data transmission and processing time. This becomes increasingly significant when clients require only a subset of the returned data.

If the JSON object returned by the columnStatistics query has a complex structure, the proposed solution would be to revisit the design of the API. The objective would be to define a return type for each query explicitly. By structuring the return type of the columnStatistics query into a defined GraphQL object type, the clients can understand the expected data and request only the fields necessary for their use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant