private void checkTypes(GraphQLSchema schema, SchemaValidationErrorCollector validationErrorCollector) { List<GraphQLType> types = schema.getAllTypesAsList(); types.forEach(type -> { for (SchemaValidationRule rule : rules) { rule.check(type, validationErrorCollector); } }); }
Map<String, List<GraphQLObjectType>> groupImplementations(GraphQLSchema schema) { Map<String, List<GraphQLObjectType>> result = new LinkedHashMap<>(); for (GraphQLType type : schema.getAllTypesAsList()) { if (type instanceof GraphQLObjectType) { for (GraphQLOutputType interfaceType : ((GraphQLObjectType) type).getInterfaces()) { List<GraphQLObjectType> myGroup = result.computeIfAbsent(interfaceType.getName(), k -> new ArrayList<>()); myGroup.add((GraphQLObjectType) type); } } } return result; }
public List<GraphQLObjectType> findImplementations(GraphQLSchema schema, GraphQLInterfaceType interfaceType) { List<GraphQLObjectType> result = new ArrayList<>(); for (GraphQLType type : schema.getAllTypesAsList()) { if (!(type instanceof GraphQLObjectType)) { continue;
void extractCodeFromTypes(GraphQLCodeRegistry.Builder codeRegistry, GraphQLSchema schema) { Introspection.addCodeForIntrospectionTypes(codeRegistry); TRAVERSER.depthFirst(new CodeRegistryVisitor(codeRegistry), schema.getAllTypesAsList()); } }
/** * This can print an in memory GraphQL schema back to a logical schema definition * * @param schema the schema in play * * @return the logical schema definition */ public String print(GraphQLSchema schema) { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); GraphqlFieldVisibility visibility = schema.getCodeRegistry().getFieldVisibility(); printer(schema.getClass()).print(out, schema, visibility); List<GraphQLType> typesAsList = schema.getAllTypesAsList() .stream() .sorted(Comparator.comparing(GraphQLType::getName)) .collect(toList()); printType(out, typesAsList, GraphQLInterfaceType.class, visibility); printType(out, typesAsList, GraphQLUnionType.class, visibility); printType(out, typesAsList, GraphQLObjectType.class, visibility); printType(out, typesAsList, GraphQLEnumType.class, visibility); printType(out, typesAsList, GraphQLScalarType.class, visibility); printType(out, typesAsList, GraphQLInputObjectType.class, visibility); String result = sw.toString(); if (result.endsWith("\n\n")) { result = result.substring(0, result.length() - 1); } return result; }
private void checkTypes(GraphQLSchema schema, SchemaValidationErrorCollector validationErrorCollector) { List<GraphQLType> types = schema.getAllTypesAsList(); types.forEach(type -> { for (SchemaValidationRule rule : rules) { rule.check(type, validationErrorCollector); } }); }
Map<String, List<GraphQLObjectType>> groupImplementations(GraphQLSchema schema) { Map<String, List<GraphQLObjectType>> result = new LinkedHashMap<>(); for (GraphQLType type : schema.getAllTypesAsList()) { if (type instanceof GraphQLObjectType) { for (GraphQLOutputType interfaceType : ((GraphQLObjectType) type).getInterfaces()) { List<GraphQLObjectType> myGroup = result.computeIfAbsent(interfaceType.getName(), k -> new ArrayList<>()); myGroup.add((GraphQLObjectType) type); } } } return result; }
public List<GraphQLObjectType> findImplementations(GraphQLSchema schema, GraphQLInterfaceType interfaceType) { List<GraphQLObjectType> result = new ArrayList<>(); for (GraphQLType type : schema.getAllTypesAsList()) { if (!(type instanceof GraphQLObjectType)) { continue;
void extractCodeFromTypes(GraphQLCodeRegistry.Builder codeRegistry, GraphQLSchema schema) { Introspection.addCodeForIntrospectionTypes(codeRegistry); TRAVERSER.depthFirst(new CodeRegistryVisitor(codeRegistry), schema.getAllTypesAsList()); } }
/** * This can print an in memory GraphQL schema back to a logical schema definition * * @param schema the schema in play * @return the logical schema definition */ public String print(GraphQLSchema schema) { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); GraphqlFieldVisibility visibility = schema.getCodeRegistry().getFieldVisibility(); printer(schema.getClass()).print(out, schema, visibility); List<GraphQLType> typesAsList = schema.getAllTypesAsList() .stream() .sorted(Comparator.comparing(GraphQLType::getName)) .collect(toList()); printType(out, typesAsList, GraphQLInterfaceType.class, visibility); printType(out, typesAsList, GraphQLUnionType.class, visibility); printType(out, typesAsList, GraphQLObjectType.class, visibility); printType(out, typesAsList, GraphQLEnumType.class, visibility); printType(out, typesAsList, GraphQLScalarType.class, visibility); printType(out, typesAsList, GraphQLInputObjectType.class, visibility); String result = sw.toString(); if (result.endsWith("\n\n")) { result = result.substring(0, result.length() - 1); } return result; }
final List<GraphQLEnumType> enums = new ArrayList<>(); for(graphql.schema.GraphQLType graphQLType : graphQLSchema.getAllTypesAsList()){ GraphQLType type = GraphQLObjectTypeFactory.parse(graphQLType);