Skip to content

fix: preserve case in directive name #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/definitions/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function buildDirectiveDefinition(
return "";
}
return `@GraphQLDirective(
name = "${titleCase(directiveName)}",
name = "${directiveName}",
description = "${node.description?.value ?? ""}",
locations = [${node.locations.map((location) => `graphql.introspection.Introspection.DirectiveLocation.${location.value}`).join(", ")}]
)
Expand Down
6 changes: 3 additions & 3 deletions test/unit/should_generate_custom_directives/expected.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import com.expediagroup.graphql.generator.annotations.*
import should_honor_directiveReplacements_config.*

@GraphQLDirective(
name = "MyCustomDirective",
description = "A description for MyCustomDirective",
name = "myCustomDirective",
description = "A description for myCustomDirective",
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]
)
annotation class MyCustomDirective

@GraphQLDirective(
name = "MyCustomDirective2",
name = "myCustomDirective2",
description = "",
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]
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"A description for MyCustomDirective"
"A description for myCustomDirective"
directive @myCustomDirective on OBJECT | FIELD_DEFINITION | INPUT_OBJECT | INPUT_FIELD_DEFINITION
directive @myCustomDirective2 on OBJECT | FIELD_DEFINITION | INPUT_OBJECT | INPUT_FIELD_DEFINITION

Expand Down