Package graphql.util
Class Anonymizer
java.lang.Object
graphql.util.Anonymizer
Util class which converts schemas and optionally queries
into anonymized schemas and queries.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQLSchema
anonymizeSchema
(GraphQLSchema schema) static GraphQLSchema
anonymizeSchema
(String sdl) static Anonymizer.AnonymizeResult
anonymizeSchemaAndQueries
(GraphQLSchema schema, List<String> queries) static Anonymizer.AnonymizeResult
anonymizeSchemaAndQueries
(GraphQLSchema schema, List<String> queries, Map<String, Object> variables) static Anonymizer.AnonymizeResult
anonymizeSchemaAndQueries
(String sdl, List<String> queries) static Anonymizer.AnonymizeResult
private static void
assertUniqueOperation
(Document document) private static GraphQLType
fromTypeToGraphQLType
(Type type, GraphQLSchema schema) private static List
<GraphQLArgument> getMatchingArgumentDefinitions
(String name, Set<GraphQLFieldDefinition> fieldDefinitions) private static void
getMatchingFieldDefinitions
(String fieldName, List<? extends GraphQLType> interfaces, Set<GraphQLFieldDefinition> result) private static Set
<GraphQLFieldDefinition> getSameFields
(String fieldName, String objectOrInterfaceName, Map<String, List<GraphQLImplementingType>> interfaceToImplementations, GraphQLSchema schema) private static void
getSameFieldsImpl
(String fieldName, String curObjectOrInterface, Map<String, List<GraphQLImplementingType>> interfaceToImplementations, GraphQLSchema schema, Set<String> alreadyChecked, Set<GraphQLFieldDefinition> result) static Map
<GraphQLNamedSchemaElement, String> recordNewNamesForSchema
(GraphQLSchema schema) private static Type
replaceTypeName
(Type type, String newName) private static Value
replaceValue
(Value valueLiteral, GraphQLInputType argType, Map<GraphQLNamedSchemaElement, String> newNameMap, AtomicInteger defaultStringValueCounter, AtomicInteger defaultIntValueCounter) private static String
rewriteQuery
(String query, GraphQLSchema schema, Map<GraphQLNamedSchemaElement, String> newNames, Map<String, Object> variables)
-
Constructor Details
-
Anonymizer
public Anonymizer()
-
-
Method Details
-
anonymizeSchema
-
anonymizeSchema
-
anonymizeSchemaAndQueries
public static Anonymizer.AnonymizeResult anonymizeSchemaAndQueries(String sdl, List<String> queries) -
anonymizeSchemaAndQueries
public static Anonymizer.AnonymizeResult anonymizeSchemaAndQueries(GraphQLSchema schema, List<String> queries) -
anonymizeSchemaAndQueries
-
anonymizeSchemaAndQueries
public static Anonymizer.AnonymizeResult anonymizeSchemaAndQueries(GraphQLSchema schema, List<String> queries, Map<String, Object> variables) -
replaceValue
private static Value replaceValue(Value valueLiteral, GraphQLInputType argType, Map<GraphQLNamedSchemaElement, String> newNameMap, AtomicInteger defaultStringValueCounter, AtomicInteger defaultIntValueCounter) -
recordNewNamesForSchema
-
getSameFields
private static Set<GraphQLFieldDefinition> getSameFields(String fieldName, String objectOrInterfaceName, Map<String, List<GraphQLImplementingType>> interfaceToImplementations, GraphQLSchema schema) -
getSameFieldsImpl
private static void getSameFieldsImpl(String fieldName, String curObjectOrInterface, Map<String, List<GraphQLImplementingType>> interfaceToImplementations, GraphQLSchema schema, Set<String> alreadyChecked, Set<GraphQLFieldDefinition> result) -
getMatchingFieldDefinitions
private static void getMatchingFieldDefinitions(String fieldName, List<? extends GraphQLType> interfaces, Set<GraphQLFieldDefinition> result) -
getMatchingArgumentDefinitions
private static List<GraphQLArgument> getMatchingArgumentDefinitions(String name, Set<GraphQLFieldDefinition> fieldDefinitions) -
rewriteQuery
private static String rewriteQuery(String query, GraphQLSchema schema, Map<GraphQLNamedSchemaElement, String> newNames, Map<String, Object> variables) -
fromTypeToGraphQLType
-
replaceTypeName
-
assertUniqueOperation
-