use of graphql.language.FieldDefinition in project graphql-java by graphql-java.
the class GraphqlAntlrToLanguage method visitListType.
@Override
public Void visitListType(GraphqlParser.ListTypeContext ctx) {
ListType listType = new ListType();
newNode(listType, ctx);
for (ContextEntry contextEntry : contextStack) {
if (contextEntry.value instanceof ListType) {
((ListType) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof NonNullType) {
((NonNullType) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof VariableDefinition) {
((VariableDefinition) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof FieldDefinition) {
((FieldDefinition) contextEntry.value).setType(listType);
break;
}
if (contextEntry.value instanceof InputValueDefinition) {
((InputValueDefinition) contextEntry.value).setType(listType);
break;
}
}
addContextProperty(ContextProperty.ListType, listType);
super.visitListType(ctx);
popContext();
return null;
}
use of graphql.language.FieldDefinition in project graphql-java by graphql-java.
the class SchemaDiff method checkFieldAdditions.
private void checkFieldAdditions(DiffCtx ctx, TypeDefinition newDef, Map<String, FieldDefinition> oldFields, Map<String, FieldDefinition> newFields) {
for (Map.Entry<String, FieldDefinition> entry : newFields.entrySet()) {
String fieldName = entry.getKey();
ctx.report(DiffEvent.apiInfo().typeName(newDef.getName()).typeKind(getTypeKind(newDef)).fieldName(fieldName).reasonMsg("\tExamining field '%s' ...", mkDotName(newDef.getName(), fieldName)).build());
FieldDefinition oldField = oldFields.get(fieldName);
if (oldField == null) {
ctx.report(DiffEvent.apiInfo().category(DiffCategory.ADDITION).typeName(newDef.getName()).typeKind(getTypeKind(newDef)).fieldName(fieldName).reasonMsg("The new API adds the field '%s'", mkDotName(newDef.getName(), fieldName)).build());
}
}
}
Aggregations