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 GraphQLSchemaanonymizeSchema(GraphQLSchema schema) static GraphQLSchemaanonymizeSchema(String sdl) static Anonymizer.AnonymizeResultanonymizeSchemaAndQueries(GraphQLSchema schema, List<String> queries) static Anonymizer.AnonymizeResultanonymizeSchemaAndQueries(GraphQLSchema schema, List<String> queries, Map<String, Object> variables) static Anonymizer.AnonymizeResultanonymizeSchemaAndQueries(String sdl, List<String> queries) static Anonymizer.AnonymizeResultprivate static voidassertUniqueOperation(Document document) private static GraphQLTypefromTypeToGraphQLType(Type type, GraphQLSchema schema) private static List<GraphQLArgument> getMatchingArgumentDefinitions(String name, Set<GraphQLFieldDefinition> fieldDefinitions) private static voidgetMatchingFieldDefinitions(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 voidgetSameFieldsImpl(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 TypereplaceTypeName(Type type, String newName) private static ValuereplaceValue(Value valueLiteral, GraphQLInputType argType, Map<GraphQLNamedSchemaElement, String> newNameMap, AtomicInteger defaultStringValueCounter, AtomicInteger defaultIntValueCounter) private static StringrewriteQuery(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
-