File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
test/unit/should_annotate_types_properly Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,13 @@ export function buildDescriptionAnnotation(
2727 const isDeprecatedDescription = trimmedDescription . startsWith (
2828 deprecatedDescriptionPrefix ,
2929 ) ;
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+ ) {
3137 return `@GraphQLDescription("${ trimmedDescription } ")\n` ;
3238 } else if ( isDeprecatedDescription ) {
3339 const descriptionValue = description . replace (
Original file line number Diff line number Diff line change @@ -30,3 +30,11 @@ data class TypeThatShouldBeProperlyAnnotated(
3030) : UnionThatShouldBeProperlyAnnotated
3131
3232interface 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 {
3434}
3535
3636union 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