-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed that the "java.lang.deprecated" annotation can work with: Opera…
…tions (high level fields), enum values, output type fields. Also fixed that while using generate-schema goal, there is no NPE. + minor refactoring of the code.
- Loading branch information
Showing
10 changed files
with
86 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
...a-builder/src/main/java/io/smallrye/graphql/schema/helper/DeprecatedDirectivesHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
package io.smallrye.graphql.schema.helper; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import org.jboss.jandex.DotName; | ||
import org.jboss.logging.Logger; | ||
|
||
import io.smallrye.graphql.schema.Annotations; | ||
import io.smallrye.graphql.schema.model.DirectiveInstance; | ||
import io.smallrye.graphql.schema.model.DirectiveType; | ||
|
||
public class DeprecatedDirectivesHelper { | ||
|
||
private static Logger LOGGER = Logger.getLogger(DeprecatedDirectivesHelper.class); | ||
|
||
public List<DirectiveInstance> transformDeprecatedToDirectives(Annotations annotations, DirectiveType directiveType) { | ||
List<DirectiveInstance> result = new ArrayList<>(); | ||
public Optional<DirectiveInstance> transformDeprecatedToDirective(Annotations annotations, DirectiveType directiveType) { | ||
Set<DotName> annotationNames = annotations.getAnnotationNames(); | ||
for (DotName annotationName : annotationNames) { | ||
if (annotationName.equals(DotName.createSimple("java.lang.Deprecated"))) { | ||
DirectiveInstance directive = new DirectiveInstance(); | ||
directive.setType(directiveType); | ||
result.add(directive); | ||
return Optional.of(directive); | ||
} | ||
} | ||
return result; | ||
return Optional.empty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters