Repository navigation
Commit 3488a31
committed
Move the SDL directive code out of SchemaParser
Moves directivesOf, isNonRepeatableByFirstDeclaration, createDirectives,
createDirective, createDirectiveArgument, withSdlDirectives, the functions that
resolve and render applied directives, ResolvedDirective, ResolvedArgument,
missingArgumentsWithDefault, getDeprecated, the schemaDirectives map and
BUILT_IN_DIRECTIVES to SdlDirectives.kt.
SdlDirectives builds the schema's directive definitions in its constructor, so
nothing can apply a directive before they exist. SchemaParser builds one in
parseSchemaObjects() where it used to call createDirectives(), so directive
errors are still thrown from there, and every schema it builds gets its own
definitions.
Edits to compile:
- SdlDirectives' header with directiveDefinitions, options, runtimeWiring,
SchemaParser's logger (its warnings keep that logger name) and inputType,
the type lookup createDirectiveArgument called. The lookup's comment moves
with it to SchemaParser.
- init { createDirectives() }, and a definitions property for SchemaObjects.
- schemaAppliedDirectives, the line SchemaParser used for the schema's own
directives, so the resolving functions stay private.
- private dropped on directivesOf, withSdlDirectives and getDeprecated.
- SchemaParser: lateinit var sdlDirectives replaces the map, directivesOf and
getDeprecated are called through it, and a private withSdlDirectives calls
the one in SdlDirectives, so the builder chains don't change.
- Imports.1 parent cb662e5 commit 3488a31
2 files changed
Lines changed: 271 additions & 235 deletions
0 commit comments