use of graphql.Directives.SpecifiedByDirective in project graphql-java by graphql-java.
the class SchemaGeneratorHelper method getSpecifiedByUrl.
String getSpecifiedByUrl(ScalarTypeDefinition scalarTypeDefinition, List<ScalarTypeExtensionDefinition> extensions) {
List<Directive> allDirectives = new ArrayList<>(scalarTypeDefinition.getDirectives());
extensions.forEach(extension -> allDirectives.addAll(extension.getDirectives()));
Optional<Directive> specifiedByDirective = FpKit.findOne(allDirectives, directiveDefinition -> directiveDefinition.getName().equals(SpecifiedByDirective.getName()));
if (!specifiedByDirective.isPresent()) {
return null;
}
Argument urlArgument = specifiedByDirective.get().getArgument("url");
StringValue url = (StringValue) urlArgument.getValue();
return url.getValue();
}
Aggregations