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

Suggestion: Enhance Type Definitions for GQLExtensions and FetchResponseBody #1813

Open
marcos-mo-loox opened this issue Dec 1, 2024 · 2 comments · May be fixed by #1927
Open

Suggestion: Enhance Type Definitions for GQLExtensions and FetchResponseBody #1813

marcos-mo-loox opened this issue Dec 1, 2024 · 2 comments · May be fixed by #1927
Labels
good first issue Good for newcomers Stale

Comments

@marcos-mo-loox
Copy link

Suggestion: Enhance Type Definitions for GQLExtensions and FetchResponseBody

Background

We are currently working on enhancing our GraphQL infrastructure and are evaluating the integration of this package. During our review, we encountered a few areas where the type definitions could better align with common usage patterns and improve type safety.

Problem Description

  1. GQLExtensions Type

    • Currently, GQLExtensions is typed as Record<string, any>.
    • While this provides flexibility, it lacks specificity and omits fields like cost, which we believe should be included by default.
    • Explicitly including common extension fields like cost would improve the developer experience and reduce ambiguity.
  2. FetchResponseBody Extensions Field

    • The extensions,data,errors,headers fields in FetchResponseBody are optional.
    • However, in our testing, this field is always present in successful responses.
    • Making it required would improve type safety and prevent unnecessary null checks.

Proposed Solution

  • Enhance the GQLExtensions Type

    • Include common fields like cost while maintaining flexibility to accommodate additional fields.
  • Update the FetchResponseBody Type

  • Introduce a SuccessClientResponse type for responses containing data and extensions.

  • Introduce an ErrorClientResponse type for responses containing errors.

This separation would allow for more explicit handling of success and error scenarios, aligning with common GraphQL response patterns.

Question

Would these changes align with your roadmap for the package? We believe this improvement could enhance the package’s usability for GraphQL clients.

Thank you for your consideration!

@lizkenyon
Copy link
Contributor

Hi there 👋

Thank you for the flag! To clarify you are speaking about the GraphQL client package specifically?
If you would like to make a PR the team would prioritize reviewing it.
Otherwise I can add this to the teams backlog.

@lizkenyon lizkenyon added the good first issue Good for newcomers label Dec 6, 2024
@admirsaheta admirsaheta linked a pull request Jan 7, 2025 that will close this issue
6 tasks
Copy link
Contributor

github-actions bot commented Feb 5, 2025

We're labeling this issue as stale because there hasn't been any activity on it for 60 days. While the issue will stay open and we hope to resolve it, this helps us prioritize community requests.

You can add a comment to remove the label if it's still relevant, and we can re-evaluate it.

@github-actions github-actions bot added the Stale label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants