-
Notifications
You must be signed in to change notification settings - Fork 23
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
Union hydration validation #663
Conversation
Test Results 138 files ±0 138 suites ±0 58s ⏱️ +2s Results for commit 7d91dd7. ± Comparison against base commit 38ac346. This pull request removes 6 and adds 9 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
@@ -56,13 +52,6 @@ class NadelDefaultHydrationDefinition( | |||
val batchSize: Int | |||
get() = appliedDirective.getArgument(Keyword.batchSize).getValue() | |||
|
|||
val arguments: List<NadelHydrationArgumentDefinition> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used
@@ -34,11 +32,9 @@ class NadelDefaultHydrationDefinition( | |||
"How to identify matching results" | |||
identifiedBy: String! = "id" | |||
"The batch size" | |||
batchSize: Int | |||
batchSize: Int! = 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to match normal @hydrated
definition.
Not sure why it was different to begin with.
unionMemberType as GraphQLObjectType, | ||
).onErrorCast { return it } | ||
.mapNotNull { unionMemberType -> | ||
if ((unionMemberType as? GraphQLNamedType)?.getDefaultHydrationOrNull() == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only resolve hydration for those types wiith default hydration defined.
@@ -79,36 +84,44 @@ internal class NadelIdHydrationDefinitionParser { | |||
val defaultHydration = (type as? GraphQLNamedType)?.getDefaultHydrationOrNull() | |||
?: return NadelValidationInterimResult.Error.of(NadelMissingDefaultHydrationError(parent, virtualField)) | |||
|
|||
val hydration = object : NadelHydrationDefinition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made this a named class
Adds validation to
@hydrated
that returns the union member type.