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
9
9
import graphql.schema.GraphQLFieldDefinition
10
10
import graphql.schema.GraphQLType
11
11
12
- /* *
13
- * Default no-op wiring for deprecated directive.
14
- */
15
- private val defaultDeprecatedWiring = object : KotlinSchemaDirectiveWiring {}
16
-
17
12
/* *
18
13
* Wiring factory that is used to provide the directives.
19
14
*/
@@ -64,23 +59,15 @@ open class KotlinDirectiveWiringFactory(
64
59
val directiveWiring = discoverWiringProvider(directive.name, env)
65
60
if (directiveWiring != null ) {
66
61
modifiedObject = directiveWiring.wireOnEnvironment(env)
67
- } else {
68
- throw InvalidSchemaDirectiveWiringException (" No directive wiring provided for ${directive.name} " )
69
62
}
70
63
}
71
64
return modifiedObject
72
65
}
73
66
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) {
76
69
manualWiring[directiveName]
77
70
} else {
78
71
getSchemaDirectiveWiring(env)
79
72
}
80
-
81
- if (null == wiring && DEPRECATED_DIRECTIVE_NAME == directiveName) {
82
- wiring = defaultDeprecatedWiring
83
- }
84
- return wiring
85
- }
86
73
}
Original file line number Diff line number Diff line change @@ -92,12 +92,11 @@ class KotlinDirectiveWiringFactoryTest {
92
92
}
93
93
94
94
@Test
95
- fun `verify exception is thrown if no wirings are specified` () {
95
+ fun `verify no action is taken if no wirings are specified` () {
96
96
val original = GraphQLEnumType .newEnum().name(" MyEnum" ).withDirective(graphQLOverrideDescriptionDirective).build()
97
97
98
- assertThrows<InvalidSchemaDirectiveWiringException > {
99
- SimpleWiringFactory ().onWire(original)
100
- }
98
+ val modified = SimpleWiringFactory ().onWire(original)
99
+ assertEquals(original, modified)
101
100
}
102
101
103
102
@Test
You can’t perform that action at this time.
0 commit comments