diff --git a/graphql-java-support/src/main/java/com/apollographql/federation/graphqljava/Federation.java b/graphql-java-support/src/main/java/com/apollographql/federation/graphqljava/Federation.java index dad58bfa..011e422e 100644 --- a/graphql-java-support/src/main/java/com/apollographql/federation/graphqljava/Federation.java +++ b/graphql-java-support/src/main/java/com/apollographql/federation/graphqljava/Federation.java @@ -161,7 +161,7 @@ private static RuntimeWiring ensureFederationV2DirectiveDefinitionsExist( importedDefinitions.forEach( def -> { if (def instanceof DirectiveDefinition - && !typeRegistry.getDirectiveDefinition(def.getName()).isPresent()) { + && typeRegistry.getDirectiveDefinition(def.getName()).isEmpty()) { typeRegistry.add(def); } else if (def instanceof ScalarTypeDefinition) { if (!typeRegistry.scalars().containsKey(def.getName())) { @@ -193,11 +193,11 @@ private static RuntimeWiring ensureFederationDirectiveDefinitionsExist( // Add Federation directives if they don't exist. FederationDirectives.federation1DirectiveDefinitions.stream() - .filter(def -> !typeRegistry.getDirectiveDefinition(def.getName()).isPresent()) + .filter(def -> typeRegistry.getDirectiveDefinition(def.getName()).isEmpty()) .forEachOrdered(typeRegistry::add); // Add scalar type for _FieldSet, since the directives depend on it. - if (!typeRegistry.getType(_FieldSet.typeName).isPresent()) { + if (typeRegistry.getType(_FieldSet.typeName).isEmpty()) { typeRegistry.add(_FieldSet.definition); }