public void checkField()

in src/main/com/intellij/lang/jsgraphql/types/validation/rules/ProvidedNonNullArguments.java [45:67]


  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());
      boolean nonNullType = isNonNull(graphQLArgument.getType());
      boolean noDefaultValue = graphQLArgument.getDefaultValue() == null;
      if (argument == null && nonNullType && noDefaultValue) {
        String message = String.format("Missing field argument '%s'", graphQLArgument.getName());
        addError(ValidationErrorType.MissingFieldArgument, field.getSourceLocation(), message);
      }

      if (argument != null) {
        Value value = argument.getValue();
        if ((value == null || value instanceof NullValue) && nonNullType && noDefaultValue) {
          String message = String.format("null value for non-null field argument '%s'", graphQLArgument.getName());
          addError(ValidationErrorType.NullValueForNonNullArgument, field.getSourceLocation(), message);
        }
      }
    }
  }