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

[Ignore] add check for hydration arg type against actor field #408

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

faizan-siddiqui
Copy link
Contributor

No description provided.

@@ -139,82 +150,4 @@ internal class NadelHydrationValidation(
return typeValidation + outputTypeMustBeNullable
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved all this into it's own class


return duplicatedArgumentsErrors + remoteArgErrors + missingActorArgErrors
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything above this moved from NadelHydrationArgumentValidation class, everything below is new

@@ -0,0 +1,1004 @@
package graphql.nadel.validation
Copy link
Contributor Author

@faizan-siddiqui faizan-siddiqui Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skip to line 390 for the new tests

val errors = validate(fixture)
assert(errors.map { it.message }.isEmpty())
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything below is new

@faizan-siddiqui faizan-siddiqui marked this pull request as ready for review April 6, 2022 20:33
@faizan-siddiqui faizan-siddiqui changed the title WIP: add check for hydration arg type against actor field add check for hydration arg type against actor field Apr 6, 2022
assert(error.overallField.name == "creator")
assert(error.remoteArg.name == "id")
assert(GraphQLTypeUtil.simplePrint(error.hydrationType) == "ID!")
assert(GraphQLTypeUtil.simplePrint(error.actorArgInputType) == "Int!")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm technically this is allowed. An input ID can be of Int type. We can circle back if we need.

var hydrationSource: GraphQLType = hydrationSourceType
var actorArgument: GraphQLType = actorArgumentInputType

while (hydrationSource.isWrapped && actorArgument.isWrapped) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not sure about this code… Can you explain it more? Perhaps it's okay.

I really think we should have checked whether the hydration was batched or not before taking any action… This code makes too many assumptions on whether something is batched or not and there's a lot of paths to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea so I found over here was really the only appropriate place I can check to see if it's a batch hydration, as I need to unravel and check the actor argument input type and the hydration source type, to see if one is a list and the other is a single value, there's no where before this execution that could indicate whether a hydration is batched or not, even the isBatched function checks if the actorFieldDef is a list type

@faizan-siddiqui
Copy link
Contributor Author

@gnawf comments implemented or replied to, plz re-review:)

@andimarek-atlassian andimarek-atlassian changed the title add check for hydration arg type against actor field [Ignore] add check for hydration arg type against actor field Nov 14, 2024
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

Successfully merging this pull request may close these issues.

2 participants