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

[generator] filter lambda properties #1366

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

dariuszkuc
Copy link
Collaborator

📝 Description

Currently we don't support lambda parameters. Attempting to use a lambda property blows up with somewhat ambiguous messages (lambda return type is outside of supported packages/cannot calculate erasure type for suspendable lambda). Currently it was also not possible to filter out lambda properties using @GraphQLIgnore annotations as it was applied AFTER attempting to read lambda erasure type (which blows up as it cannot be calculated).

This PR adds new property filter that checks whether property is a lambda and throws InvalidPropertyReturnTypeException if it is. Also moved @GraphQLIgnore filter to be applied before we attempt to calculate JVM erasure (used to verify property type is not blacklisted).

Throwing exception from a filter might not be ideal but IMHO is a better alternative than throwing current ambiguous exception (about JVM erasure) or by just filtering lambda parameters (which leads to questions of why my public property is not available in the graph).

🔗 Related Issues

Resolves #1364

Currently we don't support lambda parameters. Attempting to use a lambda property blows up with somewhat ambiguous messages (lambda return type is outside of supported packages/cannot calculate erasure type for suspendable lambda). Currently it was also not possible to filter out lambda properties using `@GraphQLIgnore` annotations as it was applied AFTER attempting to read lambda erasure type (which blows up as it cannot be calculated).

This PR adds new property filter that checks whether property is a lambda and throws `InvalidPropertyReturnTypeException` if it is. Also moved `@GraphQLIgnore` filter to be applied before we attempt to calculate JVM erasure (used to verify property type is not blacklisted).

Throwing exception from a filter might not be ideal but IMHO is a better alternative than throwing current ambiguous exception (about JVM erasure) or by just filtering lambda parameters (which leads to questions of why my public property is not available in the graph).
@dariuszkuc dariuszkuc added type: bug Something isn't working changes: patch Changes require a patch version module: generator Issue affects the schema generator and federation code labels Feb 16, 2022
@dariuszkuc dariuszkuc merged commit 7627dd6 into ExpediaGroup:master Feb 16, 2022
@dariuszkuc dariuszkuc deleted the property_lambda branch February 16, 2022 21:46
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
Currently we don't support lambda parameters. Attempting to use a lambda property blows up with somewhat ambiguous messages (lambda return type is outside of supported packages/cannot calculate erasure type for suspendable lambda). Currently it was also not possible to filter out lambda properties using `@GraphQLIgnore` annotations as it was applied AFTER attempting to read lambda erasure type (which blows up as it cannot be calculated).

This PR adds new property filter that checks whether property is a lambda and throws `InvalidPropertyReturnTypeException` if it is. Also moved `@GraphQLIgnore` filter to be applied before we attempt to calculate JVM erasure (used to verify property type is not blacklisted).

Throwing exception from a filter might not be ideal but IMHO is a better alternative than throwing current ambiguous exception (about JVM erasure) or by just filtering lambda parameters (which leads to questions of why my public property is not available in the graph).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version module: generator Issue affects the schema generator and federation code type: bug Something isn't working
Development

Successfully merging this pull request may close these issues.

GraphQLIgnore is ignored for suspending lambda response types
2 participants