-
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
Refactor instruction definitions #644
base: improve-factory
Are you sure you want to change the base?
Conversation
context(NadelValidationContext) | ||
private fun visitElement(schemaElement: NadelServiceSchemaElement): Boolean { | ||
// Returns true if the element was added i.e. haven't visited before | ||
return visitedTypes.add(schemaElement.toRef()) |
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.
Moved visitElement
into NadelValidationContext
and made visitedTypes
private.
@@ -12,7 +12,7 @@ import java.util.Collections | |||
* Alternative to [graphql.schema.idl.TypeDefinitionRegistry] but is more generic | |||
* and tailored to Nadel specific operations to build the overall schema. | |||
*/ | |||
class NadelDefinitionRegistry { | |||
class NadelTypeDefinitionRegistry { |
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.
Renamed for clarity as I have also created a NadelInstructionDefinitionRegistry
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.
Holds the instruction definitions and utils.
This code was all moved from NadelValidationContext
Might be slightly refactored, but same otherwise.
@@ -17,7 +17,7 @@ class NadelAssignableTypeValidation internal constructor( | |||
requiredType = overallType, | |||
// Compare underlying type names | |||
suppliedTypeName = underlyingType.unwrapAll().name, | |||
requiredTypeName = getUnderlyingTypeName(overallType.unwrapAll()), | |||
requiredTypeName = instructionDefinitions.getUnderlyingTypeName(overallType.unwrapAll()), |
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.
Moved the util into NadelInstructionDefinitionRegistry
@@ -20,180 +11,16 @@ data class NadelValidationContext internal constructor( | |||
val hydrationUnions: Set<String>, | |||
val namespaceTypeNames: Set<String>, | |||
val combinedTypeNames: Set<String>, | |||
val definitions: Map<NadelSchemaMemberCoordinates, List<NadelDefinition>>, | |||
val instructionDefinitions: NadelInstructionDefinitionRegistry, |
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.
Created NadelInstructionDefinitionRegistry
holder and move all the isHydrated
etc methods into it
@@ -0,0 +1,3 @@ | |||
package graphql.nadel.definition | |||
|
|||
interface NadelInstructionDefinition |
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.
Renamed from NadelDefinition
File too small for Git to pick up on the rename.
Just renaming stuff for clarity e.g.
NadelDefinitionRegistry
->NadelTypeDefinitionRegistry
NadelDefinition
->NadelInstructionDefinition
NadelInstructionDefinitionRegistry
to hold theNadelInstructionDefinition
and util functions.Pending #638