File tree Expand file tree Collapse file tree 2 files changed +5
-19
lines changed
main/kotlin/com/expedia/graphql/directives
test/kotlin/com/expedia/graphql/directives Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,6 @@ import graphql.schema.GraphQLDirectiveContainer
99import graphql.schema.GraphQLFieldDefinition
1010import graphql.schema.GraphQLType
1111
12- /* *
13- * Default no-op wiring for deprecated directive.
14- */
15- private val defaultDeprecatedWiring = object : KotlinSchemaDirectiveWiring {}
16-
1712/* *
1813 * Wiring factory that is used to provide the directives.
1914 */
@@ -64,23 +59,15 @@ open class KotlinDirectiveWiringFactory(
6459 val directiveWiring = discoverWiringProvider(directive.name, env)
6560 if (directiveWiring != null ) {
6661 modifiedObject = directiveWiring.wireOnEnvironment(env)
67- } else {
68- throw InvalidSchemaDirectiveWiringException (" No directive wiring provided for ${directive.name} " )
6962 }
7063 }
7164 return modifiedObject
7265 }
7366
74- private fun discoverWiringProvider (directiveName : String , env : KotlinSchemaDirectiveEnvironment <GraphQLDirectiveContainer >): KotlinSchemaDirectiveWiring ? {
75- var wiring = if (directiveName in manualWiring) {
67+ private fun discoverWiringProvider (directiveName : String , env : KotlinSchemaDirectiveEnvironment <GraphQLDirectiveContainer >): KotlinSchemaDirectiveWiring ? =
68+ if (directiveName in manualWiring) {
7669 manualWiring[directiveName]
7770 } else {
7871 getSchemaDirectiveWiring(env)
7972 }
80-
81- if (null == wiring && DEPRECATED_DIRECTIVE_NAME == directiveName) {
82- wiring = defaultDeprecatedWiring
83- }
84- return wiring
85- }
8673}
Original file line number Diff line number Diff line change @@ -92,12 +92,11 @@ class KotlinDirectiveWiringFactoryTest {
9292 }
9393
9494 @Test
95- fun `verify exception is thrown if no wirings are specified` () {
95+ fun `verify no action is taken if no wirings are specified` () {
9696 val original = GraphQLEnumType .newEnum().name(" MyEnum" ).withDirective(graphQLOverrideDescriptionDirective).build()
9797
98- assertThrows<InvalidSchemaDirectiveWiringException > {
99- SimpleWiringFactory ().onWire(original)
100- }
98+ val modified = SimpleWiringFactory ().onWire(original)
99+ assertEquals(original, modified)
101100 }
102101
103102 @Test
You can’t perform that action at this time.
0 commit comments