@Override public void checkField(Field field) { GraphQLFieldDefinition fieldDef = getValidationContext().getFieldDef(); if (fieldDef == null) return; Map<String, Argument> argumentMap = argumentMap(field.getArguments()); for (GraphQLArgument graphQLArgument : fieldDef.getArguments()) { Argument argument = argumentMap.get(graphQLArgument.getName()); if (argument == null && (graphQLArgument.getType() instanceof GraphQLNonNull)) { addError(new ValidationError(ValidationErrorType.MissingFieldArgument)); } } }
@Override public List<GraphQLFieldDefinition> getFields( Class<? extends ProjectEntity> projectEntityClass, ProjectEntityType projectEntityType) { if (projectEntityType == ProjectEntityType.PROJECT) { return Collections.singletonList( GraphQLFieldDefinition.newFieldDefinition() .name("projectRoles") .description("Authorisations for the project") .type(stdList(projectAuthorization.getType())) .argument(a -> a.name("role").description("Filter by role name").type(GraphQLString)) .dataFetcher(projectAuthorizationsFetcher()) .build()); } else { return Collections.emptyList(); } }