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

Fix for Issue #39 Broke Optional Types in General #54

Closed
schettn opened this issue Nov 14, 2024 · 1 comment
Closed

Fix for Issue #39 Broke Optional Types in General #54

schettn opened this issue Nov 14, 2024 · 1 comment
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟥 priority: critical Must be fixed ASAP released 🏁 status: ready for de Ready for work

Comments

@schettn
Copy link
Contributor

schettn commented Nov 14, 2024

Original Issue Reference

Issue #39 introduced a fix to allow default values for parameters in GraphQL resolver functions. However, this fix has inadvertently broken the handling of optional parameters in general.

Problem Description

The current implementation does not support optional parameters (foo?: string or foo: string | undefined) in resolver functions due to the changes made in the fix for Issue #39. While the fix correctly handles parameters with default values, it has caused a regression for optional parameters.

Examples

Required (Working):

export const graphql = {
  Query: {
    test: (foo: string) => {
      return foo;
    }
  }
}

Optional (Not Working):

export const graphql = {
  Query: {
    // or foo: string | undefined
    test: (foo?: string) => {
      return foo;
    }
  }
}

Default Value (Working):

export const graphql = {
  Query: {
    test: (foo: string = 'bar') => {
      return foo;
    }
  }
}

Steps to Reproduce

  1. Define a GraphQL resolver with an optional parameter (foo?: string or foo: string | undefined).
  2. Attempt to query using this resolver with and without providing the optional parameter.

Expected Behavior

The resolver functions should handle optional parameters correctly, returning the appropriate values based on whether the parameter is provided or not.

Actual Behavior

The resolver functions fail to handle optional parameters, leading to runtime errors or incorrect behavior.

Impact

This issue prevents the use of optional parameters in resolver functions, reducing the flexibility and usability of the GraphQL API.

Additional Information

Please refer to the original issue for context: Issue #39.

@schettn schettn added 🟥 priority: critical Must be fixed ASAP 🏁 status: ready for de Ready for work 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository 🕹 aspect: interface Concerns end-users' experience with the software labels Nov 14, 2024
@schettn schettn self-assigned this Nov 14, 2024
Copy link
Contributor

🎉 This issue has been resolved in version @getcronit/pylon-builder-v2.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟥 priority: critical Must be fixed ASAP released 🏁 status: ready for de Ready for work
Projects
None yet
Development

No branches or pull requests

1 participant