File tree 3 files changed +22
-1
lines changed
test/unit/should_annotate_types_properly
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,13 @@ export function buildDescriptionAnnotation(
27
27
const isDeprecatedDescription = trimmedDescription . startsWith (
28
28
deprecatedDescriptionPrefix ,
29
29
) ;
30
- if ( isDeprecatedDescription && typeMetadata ?. unionAnnotation ) {
30
+ const isRequiredInputField =
31
+ definitionNode . kind === Kind . INPUT_VALUE_DEFINITION &&
32
+ definitionNode . type . kind === Kind . NON_NULL_TYPE ;
33
+ if (
34
+ isDeprecatedDescription &&
35
+ ( typeMetadata ?. unionAnnotation || isRequiredInputField )
36
+ ) {
31
37
return `@GraphQLDescription("${ trimmedDescription } ")\n` ;
32
38
} else if ( isDeprecatedDescription ) {
33
39
const descriptionValue = description . replace (
Original file line number Diff line number Diff line change @@ -30,3 +30,11 @@ data class TypeThatShouldBeProperlyAnnotated(
30
30
) : UnionThatShouldBeProperlyAnnotated
31
31
32
32
interface UnionThatShouldBeProperlyAnnotated
33
+
34
+ @GraphQLValidObjectLocations(locations = [GraphQLValidObjectLocations .Locations .INPUT_OBJECT ])
35
+ data class InputTypeThatShouldBeProperlyAnnotated (
36
+ @Deprecated(" this field is deprecated" )
37
+ val optionalField : String? = null ,
38
+ @GraphQLDescription(" DEPRECATED: this field is deprecated" )
39
+ val requiredField : String
40
+ )
Original file line number Diff line number Diff line change @@ -34,3 +34,10 @@ type TypeThatShouldBeProperlyAnnotated {
34
34
}
35
35
36
36
union UnionThatShouldBeProperlyAnnotated = TypeThatShouldBeProperlyAnnotated
37
+
38
+ input InputTypeThatShouldBeProperlyAnnotated {
39
+ "DEPRECATED: this field is deprecated"
40
+ optionalField : String
41
+ "DEPRECATED: this field is deprecated"
42
+ requiredField : String !
43
+ }
You can’t perform that action at this time.
0 commit comments