Skip to content

Commit

Permalink
fix the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
danadajian committed Apr 3, 2024
1 parent 29be91a commit 08849db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/helpers/build-directive-annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export function buildDirectiveAnnotations(
deprecatedReasonNode?.kind === "StringValue"
? deprecatedReasonNode.value
: "";
if (incomingNode.description?.value && resolvedType?.unionAnnotation) {
return "";
}
const descriptionAnnotator = resolvedType?.unionAnnotation
? "@GraphQLDescription"
: "@Deprecated";
Expand Down
1 change: 0 additions & 1 deletion test/unit/should_annotate_types_properly/expected.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ data class MyType(
val deprecated6: Any? = null,
@MyUnion
@GraphQLDescription("When there is a description")
@Deprecated("It puts the deprecated reason in @Deprecated")
val deprecated7: Any? = null
)

Expand Down
2 changes: 1 addition & 1 deletion test/unit/should_annotate_types_properly/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type MyType {
)
"When there is a description"
deprecated7: MyUnion
@deprecated(reason: "It puts the deprecated reason in @Deprecated")
@deprecated(reason: "It omits the @Deprecated annotation for now")
}

union MyUnion = MyType

0 comments on commit 08849db

Please sign in to comment.