use of graphql.language.OperationTypeDefinition in project graphql-java by graphql-java.
the class GraphqlAntlrToLanguage method visitOperationTypeDefinition.
@Override
public Void visitOperationTypeDefinition(GraphqlParser.OperationTypeDefinitionContext ctx) {
OperationTypeDefinition def = new OperationTypeDefinition(ctx.operationType().getText());
newNode(def, ctx);
for (ContextEntry contextEntry : contextStack) {
if (contextEntry.contextProperty == ContextProperty.SchemaDefinition) {
((SchemaDefinition) contextEntry.value).getOperationTypeDefinitions().add(def);
break;
}
}
addContextProperty(ContextProperty.OperationTypeDefinition, def);
super.visitChildren(ctx);
popContext();
return null;
}
use of graphql.language.OperationTypeDefinition in project graphql-java by graphql-java.
the class SchemaDiff method synthOperationTypeDefinition.
// looks for a type called `Query|Mutation|Subscription` and if it exist then assumes it as an operation def
private Optional<OperationTypeDefinition> synthOperationTypeDefinition(Function<Type, Optional<ObjectTypeDefinition>> typeReteriver, String opName) {
TypeName type = new TypeName(capitalize(opName));
Optional<ObjectTypeDefinition> typeDef = typeReteriver.apply(type);
return typeDef.map(objectTypeDefinition -> new OperationTypeDefinition(opName, type));
}
Aggregations