private void checkDirectives(DiffCtx ctx, TypeDefinition oldDef, TypeDefinition newDef) { List<Directive> oldDirectives = oldDef.getDirectives(); List<Directive> newDirectives = newDef.getDirectives(); checkDirectives(ctx, oldDef, oldDirectives, newDirectives); }
@SuppressWarnings("unchecked") private void checkTypeExtensionDirectiveRedefinition(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry, String name, List<? extends TypeDefinition> extensions, Class<? extends TypeDefinition> targetClass) { Optional<? extends TypeDefinition> typeDefinition = typeRegistry.getType(TypeName.newTypeName().name(name).build(), targetClass); if (typeDefinition.isPresent() && typeDefinition.get().getClass().equals(targetClass)) { List<Directive> directives = typeDefinition.get().getDirectives(); Map<String, Directive> directiveMap = FpKit.getByName(directives, Directive::getName, mergeFirst()); extensions.forEach(typeExt -> { List<Directive> extDirectives = typeExt.getDirectives(); extDirectives.forEach(directive -> { if (directiveMap.containsKey(directive.getName())) { errors.add(new TypeExtensionDirectiveRedefinitionError(typeDefinition.get(), directive)); } }); } ); } }
private void checkDirectives(DirectiveLocation expectedLocation, List<GraphQLError> errors, TypeDefinition<?> typeDef) { checkDirectives(expectedLocation, errors, typeRegistry, typeDef, typeDef.getName(), typeDef.getDirectives()); if (typeDef instanceof ObjectTypeDefinition) { List<FieldDefinition> fieldDefinitions = ((ObjectTypeDefinition) typeDef).getFieldDefinitions(); checkFieldsDirectives(errors, typeRegistry, fieldDefinitions); } if (typeDef instanceof InterfaceTypeDefinition) { List<FieldDefinition> fieldDefinitions = ((InterfaceTypeDefinition) typeDef).getFieldDefinitions(); checkFieldsDirectives(errors, typeRegistry, fieldDefinitions); } if (typeDef instanceof EnumTypeDefinition) { List<EnumValueDefinition> enumValueDefinitions = ((EnumTypeDefinition) typeDef).getEnumValueDefinitions(); enumValueDefinitions.forEach(definition -> checkDirectives(ENUM_VALUE, errors, typeRegistry, definition, definition.getName(), definition.getDirectives())); } if (typeDef instanceof InputObjectTypeDefinition) { List<InputValueDefinition> inputValueDefinitions = ((InputObjectTypeDefinition) typeDef).getInputValueDefinitions(); inputValueDefinitions.forEach(definition -> checkDirectives(INPUT_FIELD_DEFINITION, errors, typeRegistry, definition, definition.getName(), definition.getDirectives())); } }
private void checkDirectives(DiffCtx ctx, TypeDefinition oldDef, TypeDefinition newDef) { List<Directive> oldDirectives = oldDef.getDirectives(); List<Directive> newDirectives = newDef.getDirectives(); checkDirectives(ctx, oldDef, oldDirectives, newDirectives); }
@SuppressWarnings("unchecked") private void checkTypeExtensionDirectiveRedefinition(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry, String name, List<? extends TypeDefinition> extensions, Class<? extends TypeDefinition> targetClass) { Optional<? extends TypeDefinition> typeDefinition = typeRegistry.getType(TypeName.newTypeName().name(name).build(), targetClass); if (typeDefinition.isPresent() && typeDefinition.get().getClass().equals(targetClass)) { List<Directive> directives = typeDefinition.get().getDirectives(); Map<String, Directive> directiveMap = FpKit.getByName(directives, Directive::getName, mergeFirst()); extensions.forEach(typeExt -> { List<Directive> extDirectives = typeExt.getDirectives(); extDirectives.forEach(directive -> { if (directiveMap.containsKey(directive.getName())) { errors.add(new TypeExtensionDirectiveRedefinitionError(typeDefinition.get(), directive)); } }); } ); } }
private void checkDirectives(DirectiveLocation expectedLocation, List<GraphQLError> errors, TypeDefinition<?> typeDef) { checkDirectives(expectedLocation, errors, typeRegistry, typeDef, typeDef.getName(), typeDef.getDirectives()); if (typeDef instanceof ObjectTypeDefinition) { List<FieldDefinition> fieldDefinitions = ((ObjectTypeDefinition) typeDef).getFieldDefinitions(); checkFieldsDirectives(errors, typeRegistry, fieldDefinitions); } if (typeDef instanceof InterfaceTypeDefinition) { List<FieldDefinition> fieldDefinitions = ((InterfaceTypeDefinition) typeDef).getFieldDefinitions(); checkFieldsDirectives(errors, typeRegistry, fieldDefinitions); } if (typeDef instanceof EnumTypeDefinition) { List<EnumValueDefinition> enumValueDefinitions = ((EnumTypeDefinition) typeDef).getEnumValueDefinitions(); enumValueDefinitions.forEach(definition -> checkDirectives(ENUM_VALUE, errors, typeRegistry, definition, definition.getName(), definition.getDirectives())); } if (typeDef instanceof InputObjectTypeDefinition) { List<InputValueDefinition> inputValueDefinitions = ((InputObjectTypeDefinition) typeDef).getInputValueDefinitions(); inputValueDefinitions.forEach(definition -> checkDirectives(INPUT_FIELD_DEFINITION, errors, typeRegistry, definition, definition.getName(), definition.getDirectives())); } }
type.getDirectives().forEach(dir -> { if (dir.getName().equals("service")) { String getQueryUri = typeUri + "_GET";
type.getDirectives().forEach(dir -> { if (dir.getName().equals("service")) { String getQueryUri = typeUri + "_GET";