Skip to content

Commit 2c27a08

Browse files
authored
fix: preserve case in directive name (#136)
1 parent 0b109a9 commit 2c27a08

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/definitions/directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function buildDirectiveDefinition(
2525
return "";
2626
}
2727
return `@GraphQLDirective(
28-
name = "${titleCase(directiveName)}",
28+
name = "${directiveName}",
2929
description = "${node.description?.value ?? ""}",
3030
locations = [${node.locations.map((location) => `graphql.introspection.Introspection.DirectiveLocation.${location.value}`).join(", ")}]
3131
)

test/unit/should_generate_custom_directives/expected.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import com.expediagroup.graphql.generator.annotations.*
44
import should_honor_directiveReplacements_config.*
55

66
@GraphQLDirective(
7-
name = "MyCustomDirective",
8-
description = "A description for MyCustomDirective",
7+
name = "myCustomDirective",
8+
description = "A description for myCustomDirective",
99
locations = [graphql.introspection.Introspection.DirectiveLocation.OBJECT, graphql.introspection.Introspection.DirectiveLocation.FIELD_DEFINITION, graphql.introspection.Introspection.DirectiveLocation.INPUT_OBJECT, graphql.introspection.Introspection.DirectiveLocation.INPUT_FIELD_DEFINITION]
1010
)
1111
annotation class MyCustomDirective
1212

1313
@GraphQLDirective(
14-
name = "MyCustomDirective2",
14+
name = "myCustomDirective2",
1515
description = "",
1616
locations = [graphql.introspection.Introspection.DirectiveLocation.OBJECT, graphql.introspection.Introspection.DirectiveLocation.FIELD_DEFINITION, graphql.introspection.Introspection.DirectiveLocation.INPUT_OBJECT, graphql.introspection.Introspection.DirectiveLocation.INPUT_FIELD_DEFINITION]
1717
)

test/unit/should_generate_custom_directives/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"A description for MyCustomDirective"
1+
"A description for myCustomDirective"
22
directive @myCustomDirective on OBJECT | FIELD_DEFINITION | INPUT_OBJECT | INPUT_FIELD_DEFINITION
33
directive @myCustomDirective2 on OBJECT | FIELD_DEFINITION | INPUT_OBJECT | INPUT_FIELD_DEFINITION
44

0 commit comments

Comments
 (0)