Skip to content

Commit bc0c77b

Browse files
committed
Support deprecation of input values (directive args)
1 parent a3b35ed commit bc0c77b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

kgraphql/src/main/kotlin/com/apurebase/kgraphql/schema/model/MutableSchemaDefinition.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ private fun create__DirectiveDefinition() = TypeDSL(
227227
}
228228
deprecate("Use `locations`.")
229229
}
230+
transformation(__Directive::args) { args: List<__InputValue>, includeDeprecated: Boolean? ->
231+
if (includeDeprecated == true) {
232+
args
233+
} else {
234+
args.filterNot { it.isDeprecated }
235+
}
236+
}
230237
}.toKQLObject()
231238

232239
private fun <T> List<T>.containsAny(vararg elements: T) = elements.any { this.contains(it) }

kgraphql/src/test/kotlin/com/apurebase/kgraphql/integration/BaseSchemaTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ abstract class BaseSchemaTest {
3535
name
3636
description
3737
locations
38-
args {
38+
args(includeDeprecated: true) {
3939
...InputValue
4040
}
4141
}

0 commit comments

Comments
 (0)