Skip to content

Commit bbb8b73

Browse files
committed
if empty string is sent as a description in @GraphQLDeprecate - set it to "Deprecated" so graphiql will be able to parse it and present it as a deprecated field
1 parent 06fc05b commit bbb8b73

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/graphql/annotations/processor/retrievers/fieldBuilders/DeprecateBuilder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@ public DeprecateBuilder(AccessibleObject object) {
3030
public String build() {
3131
GraphQLDeprecate deprecate = object.getAnnotation(GraphQLDeprecate.class);
3232
if (deprecate != null) {
33-
return deprecate.value();
33+
return deprecate.value().isEmpty() ? DEFAULT_DEPRECATION_DESCRIPTION : deprecate.value();
3434
}
3535
if (object.getAnnotation(Deprecated.class) != null) {
3636
return DEFAULT_DEPRECATION_DESCRIPTION;

src/test/java/graphql/annotations/processor/retrievers/fieldBuilders/DeprecateBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void build_graphQLDeprecateAnnotationExistsWithNoValue_returnEmptyString(
6767
String deprecate = deprecateBuilder.build();
6868

6969
// assert
70-
assertEquals(deprecate, "");
70+
assertEquals(deprecate, "Deprecated");
7171
}
7272

7373
@Test

0 commit comments

Comments
 (0)