Search in sources :

Example 1 with GraphQLAppliedDirectiveArgument

use of graphql.schema.GraphQLAppliedDirectiveArgument in project graphql-java by graphql-java.

the class IntrospectionWithDirectivesSupport method addAppliedDirectives.

private GraphQLObjectType addAppliedDirectives(GraphQLObjectType originalType, GraphQLCodeRegistry.Builder codeRegistry, GraphQLObjectType appliedDirectiveType, GraphQLObjectType directiveArgumentType) {
    GraphQLObjectType objectType = originalType.transform(bld -> bld.field(fld -> fld.name("appliedDirectives").type(nonNull(list(nonNull(appliedDirectiveType))))));
    DataFetcher<?> df = env -> {
        Object source = env.getSource();
        GraphQLSchema schema = env.getGraphQLSchema();
        if (source instanceof GraphQLDirectiveContainer) {
            GraphQLDirectiveContainer type = env.getSource();
            List<GraphQLAppliedDirective> appliedDirectives = DirectivesUtil.toAppliedDirectives(type);
            return filterAppliedDirectives(schema, false, type, appliedDirectives);
        }
        if (source instanceof GraphQLSchema) {
            List<GraphQLAppliedDirective> appliedDirectives = DirectivesUtil.toAppliedDirectives(schema.getSchemaAppliedDirectives(), schema.getSchemaDirectives());
            return filterAppliedDirectives(schema, true, null, appliedDirectives);
        }
        return assertShouldNeverHappen("What directive containing element have we not considered? - %s", originalType);
    };
    DataFetcher<?> argsDF = env -> {
        final GraphQLAppliedDirective directive = env.getSource();
        // we only show directive arguments that have values set on them
        return directive.getArguments().stream().filter(arg -> arg.getArgumentValue().isSet());
    };
    DataFetcher<?> argValueDF = env -> {
        final GraphQLAppliedDirectiveArgument argument = env.getSource();
        InputValueWithState value = argument.getArgumentValue();
        Node<?> literal = ValuesResolver.valueToLiteral(value, argument.getType());
        return AstPrinter.printAst(literal);
    };
    codeRegistry.dataFetcher(coordinates(objectType, "appliedDirectives"), df);
    codeRegistry.dataFetcher(coordinates(appliedDirectiveType, "args"), argsDF);
    codeRegistry.dataFetcher(coordinates(directiveArgumentType, "value"), argValueDF);
    return objectType;
}
Also used : GraphQLSchemaElement(graphql.schema.GraphQLSchemaElement) GraphQLCodeRegistry(graphql.schema.GraphQLCodeRegistry) Node(graphql.language.Node) SchemaTransformer(graphql.schema.SchemaTransformer) GraphQLString(graphql.Scalars.GraphQLString) GraphQLDirectiveContainer(graphql.schema.GraphQLDirectiveContainer) TraversalControl(graphql.util.TraversalControl) ValuesResolver(graphql.execution.ValuesResolver) Introspection.__Type(graphql.introspection.Introspection.__Type) GraphQLType(graphql.schema.GraphQLType) TraverserContext(graphql.util.TraverserContext) GraphQLList.list(graphql.schema.GraphQLList.list) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) InputValueWithState(graphql.schema.InputValueWithState) Introspection.__EnumValue(graphql.introspection.Introspection.__EnumValue) Assert.assertShouldNeverHappen(graphql.Assert.assertShouldNeverHappen) GraphQLNonNull.nonNull(graphql.schema.GraphQLNonNull.nonNull) DataFetcher(graphql.schema.DataFetcher) GraphQLSchema(graphql.schema.GraphQLSchema) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) DirectivesUtil(graphql.DirectivesUtil) GraphQLObjectType(graphql.schema.GraphQLObjectType) GraphQLDirective(graphql.schema.GraphQLDirective) ImmutableSet(com.google.common.collect.ImmutableSet) PublicSpi(graphql.PublicSpi) CONTINUE(graphql.util.TraversalControl.CONTINUE) Set(java.util.Set) GraphQLTypeVisitorStub(graphql.schema.GraphQLTypeVisitorStub) FieldCoordinates.coordinates(graphql.schema.FieldCoordinates.coordinates) Introspection.__Schema(graphql.introspection.Introspection.__Schema) AstPrinter(graphql.language.AstPrinter) Introspection.__InputValue(graphql.introspection.Introspection.__InputValue) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) PublicApi(graphql.PublicApi) Assert.assertNotNull(graphql.Assert.assertNotNull) GraphQLObjectType.newObject(graphql.schema.GraphQLObjectType.newObject) Introspection.__Field(graphql.introspection.Introspection.__Field) NotNull(org.jetbrains.annotations.NotNull) GraphQLDirectiveContainer(graphql.schema.GraphQLDirectiveContainer) InputValueWithState(graphql.schema.InputValueWithState) Node(graphql.language.Node) GraphQLObjectType(graphql.schema.GraphQLObjectType) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) GraphQLObjectType.newObject(graphql.schema.GraphQLObjectType.newObject) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) GraphQLSchema(graphql.schema.GraphQLSchema)

Example 2 with GraphQLAppliedDirectiveArgument

use of graphql.schema.GraphQLAppliedDirectiveArgument in project graphql-java by graphql-java.

the class SchemaGeneratorAppliedDirectiveHelper method buildAppliedDirective.

// builds directives from a type and its extensions
private static Pair<GraphQLDirective, GraphQLAppliedDirective> buildAppliedDirective(SchemaGeneratorHelper.BuildContext buildCtx, Function<Type<?>, GraphQLInputType> inputTypeFactory, Directive directive, Set<GraphQLDirective> directiveDefinitions, Introspection.DirectiveLocation directiveLocation, GraphqlTypeComparatorRegistry comparatorRegistry) {
    GraphQLDirective.Builder builder = GraphQLDirective.newDirective().name(directive.getName()).description(buildDescription(buildCtx, directive, null)).comparatorRegistry(comparatorRegistry).validLocations(directiveLocation);
    GraphQLAppliedDirective.Builder builderAppliedDirective = GraphQLAppliedDirective.newDirective().name(directive.getName()).description(buildDescription(buildCtx, directive, null)).comparatorRegistry(comparatorRegistry);
    Optional<GraphQLDirective> directiveDefOpt = FpKit.findOne(directiveDefinitions, dd -> dd.getName().equals(directive.getName()));
    GraphQLDirective graphQLDirective = directiveDefOpt.orElseGet(() -> {
        return buildDirectiveDefinitionFromAst(buildCtx, buildCtx.getTypeRegistry().getDirectiveDefinition(directive.getName()).get(), inputTypeFactory);
    });
    builder.repeatable(graphQLDirective.isRepeatable());
    builder.definition(buildCtx.isCaptureAstDefinitions() ? graphQLDirective.getDefinition() : null);
    builderAppliedDirective.definition(buildCtx.isCaptureAstDefinitions() ? directive : null);
    List<GraphQLArgument> directiveArguments = new ArrayList<>();
    List<GraphQLAppliedDirectiveArgument> appliedArguments = new ArrayList<>();
    for (Argument arg : directive.getArguments()) {
        directiveArguments.add(buildDirectiveArg(buildCtx, arg, graphQLDirective));
        appliedArguments.add(buildAppliedArg(buildCtx, arg, graphQLDirective));
    }
    directiveArguments = transferMissingArguments(buildCtx, directiveArguments, graphQLDirective);
    directiveArguments.forEach(builder::argument);
    appliedArguments = transferMissingAppliedArguments(appliedArguments, graphQLDirective);
    appliedArguments.forEach(builderAppliedDirective::argument);
    return pair(builder.build(), builderAppliedDirective.build());
}
Also used : GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) GraphQLArgument(graphql.schema.GraphQLArgument) Argument(graphql.language.Argument) ArrayList(java.util.ArrayList) GraphQLArgument(graphql.schema.GraphQLArgument) GraphQLDirective(graphql.schema.GraphQLDirective) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument)

Example 3 with GraphQLAppliedDirectiveArgument

use of graphql.schema.GraphQLAppliedDirectiveArgument in project graphql-java by graphql-java.

the class Anonymizer method anonymizeSchemaAndQueries.

public static AnonymizeResult anonymizeSchemaAndQueries(GraphQLSchema schema, List<String> queries, Map<String, Object> variables) {
    assertNotNull(queries, () -> "queries can't be null");
    AtomicInteger defaultStringValueCounter = new AtomicInteger(1);
    AtomicInteger defaultIntValueCounter = new AtomicInteger(1);
    Map<GraphQLNamedSchemaElement, String> newNameMap = recordNewNamesForSchema(schema);
    // stores a reverse index of anonymized argument name to argument instance
    // this is to handle cases where the fields on implementing types MUST have the same exact argument and default
    // value definitions as the fields on the implemented interface. (argument default values must match exactly)
    Map<String, GraphQLArgument> renamedArgumentsMap = new HashMap<>();
    SchemaTransformer schemaTransformer = new SchemaTransformer();
    GraphQLSchema newSchema = schemaTransformer.transform(schema, new GraphQLTypeVisitorStub() {

        @Override
        public TraversalControl visitGraphQLTypeReference(GraphQLTypeReference graphQLTypeReference, TraverserContext<GraphQLSchemaElement> context) {
            GraphQLNamedSchemaElement type = (GraphQLNamedSchemaElement) schema.getType(graphQLTypeReference.getName());
            String newName = newNameMap.get(type);
            GraphQLTypeReference newReference = GraphQLTypeReference.typeRef(newName);
            return changeNode(context, newReference);
        }

        @Override
        public TraversalControl visitGraphQLArgument(GraphQLArgument graphQLArgument, TraverserContext<GraphQLSchemaElement> context) {
            String newName = assertNotNull(newNameMap.get(graphQLArgument));
            if (context.getParentNode() instanceof GraphQLFieldDefinition) {
                // arguments on field definitions must be identical across implementing types and interfaces.
                if (renamedArgumentsMap.containsKey(newName)) {
                    return changeNode(context, renamedArgumentsMap.get(newName).transform(b -> {
                    }));
                }
            }
            GraphQLArgument newElement = graphQLArgument.transform(builder -> {
                builder.name(newName).description(null).definition(null);
                if (graphQLArgument.hasSetDefaultValue()) {
                    Value<?> defaultValueLiteral = ValuesResolver.valueToLiteral(graphQLArgument.getArgumentDefaultValue(), graphQLArgument.getType());
                    builder.defaultValueLiteral(replaceValue(defaultValueLiteral, graphQLArgument.getType(), newNameMap, defaultStringValueCounter, defaultIntValueCounter));
                }
                if (graphQLArgument.hasSetValue()) {
                    Value<?> valueLiteral = ValuesResolver.valueToLiteral(graphQLArgument.getArgumentValue(), graphQLArgument.getType());
                    builder.valueLiteral(replaceValue(valueLiteral, graphQLArgument.getType(), newNameMap, defaultStringValueCounter, defaultIntValueCounter));
                }
            });
            renamedArgumentsMap.put(newName, newElement);
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLAppliedDirectiveArgument(GraphQLAppliedDirectiveArgument graphQLArgument, TraverserContext<GraphQLSchemaElement> context) {
            String newName = assertNotNull(newNameMap.get(graphQLArgument));
            GraphQLAppliedDirectiveArgument newElement = graphQLArgument.transform(builder -> {
                builder.name(newName).description(null).definition(null);
                if (graphQLArgument.hasSetValue()) {
                    Value<?> valueLiteral = ValuesResolver.valueToLiteral(graphQLArgument.getArgumentValue(), graphQLArgument.getType());
                    builder.valueLiteral(replaceValue(valueLiteral, graphQLArgument.getType(), newNameMap, defaultStringValueCounter, defaultIntValueCounter));
                }
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLInterfaceType(GraphQLInterfaceType graphQLInterfaceType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLInterfaceType)) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLInterfaceType));
            GraphQLInterfaceType newElement = graphQLInterfaceType.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            GraphQLCodeRegistry.Builder codeRegistry = assertNotNull(context.getVarFromParents(GraphQLCodeRegistry.Builder.class));
            TypeResolver typeResolver = codeRegistry.getTypeResolver(graphQLInterfaceType);
            codeRegistry.typeResolver(newName, typeResolver);
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLEnumType(GraphQLEnumType graphQLEnumType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLEnumType)) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLEnumType));
            GraphQLEnumType newElement = graphQLEnumType.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLEnumValueDefinition(GraphQLEnumValueDefinition enumValueDefinition, TraverserContext<GraphQLSchemaElement> context) {
            String newName = assertNotNull(newNameMap.get(enumValueDefinition));
            GraphQLEnumValueDefinition newElement = enumValueDefinition.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition graphQLFieldDefinition, TraverserContext<GraphQLSchemaElement> context) {
            String newName = assertNotNull(newNameMap.get(graphQLFieldDefinition));
            GraphQLFieldDefinition newElement = graphQLFieldDefinition.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLDirective(GraphQLDirective graphQLDirective, TraverserContext<GraphQLSchemaElement> context) {
            if (Directives.DEPRECATED_DIRECTIVE_DEFINITION.getName().equals(graphQLDirective.getName())) {
                GraphQLArgument reason = newArgument().name("reason").type(Scalars.GraphQLString).clearValue().build();
                GraphQLDirective newElement = graphQLDirective.transform(builder -> {
                    builder.description(null).argument(reason);
                });
                changeNode(context, newElement);
                return TraversalControl.ABORT;
            }
            if (DirectiveInfo.isGraphqlSpecifiedDirective(graphQLDirective.getName())) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLDirective));
            GraphQLDirective newElement = graphQLDirective.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLAppliedDirective(GraphQLAppliedDirective graphQLDirective, TraverserContext<GraphQLSchemaElement> context) {
            if (Directives.DEPRECATED_DIRECTIVE_DEFINITION.getName().equals(graphQLDirective.getName())) {
                GraphQLAppliedDirectiveArgument reason = GraphQLAppliedDirectiveArgument.newArgument().name("reason").type(Scalars.GraphQLString).clearValue().build();
                GraphQLAppliedDirective newElement = graphQLDirective.transform(builder -> {
                    builder.description(null).argument(reason);
                });
                changeNode(context, newElement);
                return TraversalControl.ABORT;
            }
            if (DirectiveInfo.isGraphqlSpecifiedDirective(graphQLDirective.getName())) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLDirective));
            GraphQLAppliedDirective newElement = graphQLDirective.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField graphQLInputObjectField, TraverserContext<GraphQLSchemaElement> context) {
            String newName = assertNotNull(newNameMap.get(graphQLInputObjectField));
            Value<?> defaultValue = null;
            if (graphQLInputObjectField.hasSetDefaultValue()) {
                defaultValue = ValuesResolver.valueToLiteral(graphQLInputObjectField.getInputFieldDefaultValue(), graphQLInputObjectField.getType());
                defaultValue = replaceValue(defaultValue, graphQLInputObjectField.getType(), newNameMap, defaultStringValueCounter, defaultIntValueCounter);
            }
            Value<?> finalDefaultValue = defaultValue;
            GraphQLInputObjectField newElement = graphQLInputObjectField.transform(builder -> {
                builder.name(newName);
                if (finalDefaultValue != null) {
                    builder.defaultValueLiteral(finalDefaultValue);
                }
                builder.description(null);
                builder.definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLInputObjectType(GraphQLInputObjectType graphQLInputObjectType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLInputObjectType)) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLInputObjectType));
            GraphQLInputObjectType newElement = graphQLInputObjectType.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLObjectType(GraphQLObjectType graphQLObjectType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLObjectType)) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLObjectType));
            GraphQLObjectType newElement = graphQLObjectType.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLScalarType(GraphQLScalarType graphQLScalarType, TraverserContext<GraphQLSchemaElement> context) {
            if (ScalarInfo.isGraphqlSpecifiedScalar(graphQLScalarType)) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLScalarType));
            GraphQLScalarType newElement = graphQLScalarType.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            return changeNode(context, newElement);
        }

        @Override
        public TraversalControl visitGraphQLUnionType(GraphQLUnionType graphQLUnionType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLUnionType)) {
                return TraversalControl.ABORT;
            }
            String newName = assertNotNull(newNameMap.get(graphQLUnionType));
            GraphQLUnionType newElement = graphQLUnionType.transform(builder -> {
                builder.name(newName).description(null).definition(null);
            });
            GraphQLCodeRegistry.Builder codeRegistry = assertNotNull(context.getVarFromParents(GraphQLCodeRegistry.Builder.class));
            TypeResolver typeResolver = codeRegistry.getTypeResolver(graphQLUnionType);
            codeRegistry.typeResolver(newName, typeResolver);
            return changeNode(context, newElement);
        }
    });
    List<String> newQueries = new ArrayList<>();
    for (String query : queries) {
        String newQuery = rewriteQuery(query, schema, newNameMap, variables);
        newQueries.add(newQuery);
    }
    AnonymizeResult result = new AnonymizeResult(newSchema, newQueries);
    return result;
}
Also used : OperationDefinition(graphql.language.OperationDefinition) Value(graphql.language.Value) QueryVisitorInlineFragmentEnvironment(graphql.analysis.QueryVisitorInlineFragmentEnvironment) ValuesResolver(graphql.execution.ValuesResolver) GraphQLInputObjectType(graphql.schema.GraphQLInputObjectType) QueryTraverser(graphql.analysis.QueryTraverser) GraphQLFieldDefinition(graphql.schema.GraphQLFieldDefinition) FragmentSpread(graphql.language.FragmentSpread) GraphQLInterfaceType(graphql.schema.GraphQLInterfaceType) GraphQLInputObjectField(graphql.schema.GraphQLInputObjectField) GraphQLUnionType(graphql.schema.GraphQLUnionType) GraphQLEnumValueDefinition(graphql.schema.GraphQLEnumValueDefinition) GraphQLNamedSchemaElement(graphql.schema.GraphQLNamedSchemaElement) GraphQLTypeUtil.unwrapNonNullAs(graphql.schema.GraphQLTypeUtil.unwrapNonNullAs) Directives(graphql.Directives) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) QueryVisitorFieldEnvironment(graphql.analysis.QueryVisitorFieldEnvironment) Type(graphql.language.Type) DirectiveInfo(graphql.schema.idl.DirectiveInfo) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) QueryVisitorFragmentSpreadEnvironment(graphql.analysis.QueryVisitorFragmentSpreadEnvironment) BigInteger(java.math.BigInteger) TypeName(graphql.language.TypeName) TypeResolver(graphql.schema.TypeResolver) GraphQLObjectType(graphql.schema.GraphQLObjectType) GraphQLDirective(graphql.schema.GraphQLDirective) GraphQLNamedOutputType(graphql.schema.GraphQLNamedOutputType) GraphQLNonNull(graphql.schema.GraphQLNonNull) ObjectField(graphql.language.ObjectField) GraphQLInputType(graphql.schema.GraphQLInputType) Set(java.util.Set) GraphQLArgument(graphql.schema.GraphQLArgument) String.format(java.lang.String.format) AstPrinter(graphql.language.AstPrinter) List(java.util.List) QueryVisitor(graphql.analysis.QueryVisitor) ArrayValue(graphql.language.ArrayValue) Optional(java.util.Optional) FragmentDefinition(graphql.language.FragmentDefinition) NonNullType(graphql.language.NonNullType) GraphQLEnumType(graphql.schema.GraphQLEnumType) ListType(graphql.language.ListType) AstTransformer(graphql.language.AstTransformer) ObjectValue(graphql.language.ObjectValue) GraphQLSchemaElement(graphql.schema.GraphQLSchemaElement) GraphQLCodeRegistry(graphql.schema.GraphQLCodeRegistry) GraphQLNamedType(graphql.schema.GraphQLNamedType) Node(graphql.language.Node) SchemaTransformer(graphql.schema.SchemaTransformer) TreeTransformerUtil.changeNode(graphql.util.TreeTransformerUtil.changeNode) GraphQLScalarType(graphql.schema.GraphQLScalarType) QueryVisitorFieldArgumentEnvironment(graphql.analysis.QueryVisitorFieldArgumentEnvironment) QueryVisitorFieldArgumentInputValue(graphql.analysis.QueryVisitorFieldArgumentInputValue) EnumValue(graphql.language.EnumValue) HashMap(java.util.HashMap) GraphQLType(graphql.schema.GraphQLType) ArrayList(java.util.ArrayList) Introspection(graphql.introspection.Introspection) LinkedHashMap(java.util.LinkedHashMap) Scalars(graphql.Scalars) Parser(graphql.parser.Parser) Definition(graphql.language.Definition) VariableReference(graphql.language.VariableReference) BiConsumer(java.util.function.BiConsumer) GraphQLSchema(graphql.schema.GraphQLSchema) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) QueryVisitorFieldArgumentValueEnvironment(graphql.analysis.QueryVisitorFieldArgumentValueEnvironment) LinkedHashSet(java.util.LinkedHashSet) NodeVisitorStub(graphql.language.NodeVisitorStub) SchemaGenerator.createdMockedSchema(graphql.schema.idl.SchemaGenerator.createdMockedSchema) ScalarInfo(graphql.schema.idl.ScalarInfo) CONTINUE(graphql.util.TraversalControl.CONTINUE) GraphQLArgument.newArgument(graphql.schema.GraphQLArgument.newArgument) Field(graphql.language.Field) GraphQLImplementingType(graphql.schema.GraphQLImplementingType) GraphQLTypeVisitorStub(graphql.schema.GraphQLTypeVisitorStub) SchemaUtil(graphql.schema.impl.SchemaUtil) AssertException(graphql.AssertException) Directive(graphql.language.Directive) Consumer(java.util.function.Consumer) Argument(graphql.language.Argument) Document(graphql.language.Document) TypeUtil(graphql.schema.idl.TypeUtil) VariableDefinition(graphql.language.VariableDefinition) GraphQLList(graphql.schema.GraphQLList) StringValue(graphql.language.StringValue) GraphQLTypeReference(graphql.schema.GraphQLTypeReference) GraphQLTypeUtil.unwrapNonNull(graphql.schema.GraphQLTypeUtil.unwrapNonNull) PublicApi(graphql.PublicApi) IntValue(graphql.language.IntValue) Assert.assertNotNull(graphql.Assert.assertNotNull) GraphQLTypeVisitor(graphql.schema.GraphQLTypeVisitor) GraphQLTypeUtil.unwrapOneAs(graphql.schema.GraphQLTypeUtil.unwrapOneAs) InlineFragment(graphql.language.InlineFragment) Collections(java.util.Collections) GraphQLTypeReference(graphql.schema.GraphQLTypeReference) GraphQLUnionType(graphql.schema.GraphQLUnionType) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) TypeResolver(graphql.schema.TypeResolver) ArrayList(java.util.ArrayList) GraphQLFieldDefinition(graphql.schema.GraphQLFieldDefinition) GraphQLInterfaceType(graphql.schema.GraphQLInterfaceType) GraphQLTypeVisitorStub(graphql.schema.GraphQLTypeVisitorStub) GraphQLSchemaElement(graphql.schema.GraphQLSchemaElement) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) GraphQLCodeRegistry(graphql.schema.GraphQLCodeRegistry) GraphQLNamedSchemaElement(graphql.schema.GraphQLNamedSchemaElement) GraphQLEnumType(graphql.schema.GraphQLEnumType) GraphQLEnumValueDefinition(graphql.schema.GraphQLEnumValueDefinition) GraphQLArgument(graphql.schema.GraphQLArgument) SchemaTransformer(graphql.schema.SchemaTransformer) GraphQLDirective(graphql.schema.GraphQLDirective) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) GraphQLSchema(graphql.schema.GraphQLSchema) GraphQLScalarType(graphql.schema.GraphQLScalarType) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) GraphQLInputObjectField(graphql.schema.GraphQLInputObjectField) GraphQLInputObjectType(graphql.schema.GraphQLInputObjectType) Value(graphql.language.Value) ArrayValue(graphql.language.ArrayValue) ObjectValue(graphql.language.ObjectValue) QueryVisitorFieldArgumentInputValue(graphql.analysis.QueryVisitorFieldArgumentInputValue) EnumValue(graphql.language.EnumValue) StringValue(graphql.language.StringValue) IntValue(graphql.language.IntValue) GraphQLObjectType(graphql.schema.GraphQLObjectType)

Example 4 with GraphQLAppliedDirectiveArgument

use of graphql.schema.GraphQLAppliedDirectiveArgument in project graphql-java by graphql-java.

the class Anonymizer method recordNewNamesForSchema.

public static Map<GraphQLNamedSchemaElement, String> recordNewNamesForSchema(GraphQLSchema schema) {
    AtomicInteger objectCounter = new AtomicInteger(1);
    AtomicInteger inputObjectCounter = new AtomicInteger(1);
    AtomicInteger inputObjectFieldCounter = new AtomicInteger(1);
    AtomicInteger fieldCounter = new AtomicInteger(1);
    AtomicInteger scalarCounter = new AtomicInteger(1);
    AtomicInteger directiveCounter = new AtomicInteger(1);
    AtomicInteger argumentCounter = new AtomicInteger(1);
    AtomicInteger interfaceCounter = new AtomicInteger(1);
    AtomicInteger unionCounter = new AtomicInteger(1);
    AtomicInteger enumCounter = new AtomicInteger(1);
    AtomicInteger enumValueCounter = new AtomicInteger(1);
    Map<GraphQLNamedSchemaElement, String> newNameMap = new LinkedHashMap<>();
    Map<String, String> directivesOriginalToNewNameMap = new HashMap<>();
    // DirectiveName.argumentName -> newArgumentName
    Map<String, String> seenArgumentsOnDirectivesMap = new HashMap<>();
    Map<String, List<GraphQLImplementingType>> interfaceToImplementations = new SchemaUtil().groupImplementationsForInterfacesAndObjects(schema);
    Consumer<GraphQLNamedSchemaElement> recordDirectiveName = (graphQLDirective) -> {
        String directiveName = graphQLDirective.getName();
        if (directivesOriginalToNewNameMap.containsKey(directiveName)) {
            newNameMap.put(graphQLDirective, directivesOriginalToNewNameMap.get(directiveName));
            return;
        }
        String newName = "Directive" + directiveCounter.getAndIncrement();
        newNameMap.put(graphQLDirective, newName);
        directivesOriginalToNewNameMap.put(directiveName, newName);
    };
    BiConsumer<GraphQLNamedSchemaElement, String> recordDirectiveArgumentName = (graphQLArgument, directiveArgumentKey) -> {
        if (seenArgumentsOnDirectivesMap.containsKey(directiveArgumentKey)) {
            newNameMap.put(graphQLArgument, seenArgumentsOnDirectivesMap.get(directiveArgumentKey));
            return;
        }
        String newName = "argument" + argumentCounter.getAndIncrement();
        newNameMap.put(graphQLArgument, newName);
        seenArgumentsOnDirectivesMap.put(directiveArgumentKey, newName);
    };
    GraphQLTypeVisitor visitor = new GraphQLTypeVisitorStub() {

        @Override
        public TraversalControl visitGraphQLArgument(GraphQLArgument graphQLArgument, TraverserContext<GraphQLSchemaElement> context) {
            String curName = graphQLArgument.getName();
            GraphQLSchemaElement parentNode = context.getParentNode();
            if (parentNode instanceof GraphQLDirective) {
                // if we already went over the argument for this directive name, no need to add new names
                String directiveArgumentKey = ((GraphQLDirective) parentNode).getName() + graphQLArgument.getName();
                recordDirectiveArgumentName.accept(graphQLArgument, directiveArgumentKey);
                return CONTINUE;
            }
            if (!(parentNode instanceof GraphQLFieldDefinition)) {
                String newName = "argument" + argumentCounter.getAndIncrement();
                newNameMap.put(graphQLArgument, newName);
                return CONTINUE;
            }
            GraphQLFieldDefinition fieldDefinition = (GraphQLFieldDefinition) parentNode;
            String fieldName = fieldDefinition.getName();
            GraphQLImplementingType implementingType = (GraphQLImplementingType) context.getParentContext().getParentNode();
            Set<GraphQLFieldDefinition> matchingInterfaceFieldDefinitions = getSameFields(fieldName, implementingType.getName(), interfaceToImplementations, schema);
            String newName;
            if (matchingInterfaceFieldDefinitions.size() == 0) {
                newName = "argument" + argumentCounter.getAndIncrement();
            } else {
                List<GraphQLArgument> matchingArgumentDefinitions = getMatchingArgumentDefinitions(curName, matchingInterfaceFieldDefinitions);
                if (matchingArgumentDefinitions.size() == 0) {
                    newName = "argument" + argumentCounter.getAndIncrement();
                } else {
                    if (newNameMap.containsKey(matchingArgumentDefinitions.get(0))) {
                        newName = newNameMap.get(matchingArgumentDefinitions.get(0));
                    } else {
                        newName = "argument" + argumentCounter.getAndIncrement();
                        for (GraphQLArgument argument : matchingArgumentDefinitions) {
                            newNameMap.put(argument, newName);
                        }
                    }
                }
            }
            newNameMap.put(graphQLArgument, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLAppliedDirectiveArgument(GraphQLAppliedDirectiveArgument graphQLArgument, TraverserContext<GraphQLSchemaElement> context) {
            GraphQLSchemaElement parentNode = context.getParentNode();
            if (parentNode instanceof GraphQLAppliedDirective) {
                // if we already went over the argument for this directive name, no need to add new names
                String directiveArgumentKey = ((GraphQLAppliedDirective) parentNode).getName() + graphQLArgument.getName();
                recordDirectiveArgumentName.accept(graphQLArgument, directiveArgumentKey);
            }
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLDirective(GraphQLDirective graphQLDirective, TraverserContext<GraphQLSchemaElement> context) {
            if (DirectiveInfo.isGraphqlSpecifiedDirective(graphQLDirective)) {
                return TraversalControl.ABORT;
            }
            recordDirectiveName.accept(graphQLDirective);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLAppliedDirective(GraphQLAppliedDirective graphQLAppliedDirective, TraverserContext<GraphQLSchemaElement> context) {
            if (DirectiveInfo.isGraphqlSpecifiedDirective(graphQLAppliedDirective.getName())) {
                return TraversalControl.ABORT;
            }
            recordDirectiveName.accept(graphQLAppliedDirective);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLInterfaceType(GraphQLInterfaceType graphQLInterfaceType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLInterfaceType)) {
                return TraversalControl.ABORT;
            }
            String newName = "Interface" + interfaceCounter.getAndIncrement();
            newNameMap.put(graphQLInterfaceType, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLEnumType(GraphQLEnumType graphQLEnumType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLEnumType)) {
                return TraversalControl.ABORT;
            }
            String newName = "Enum" + enumCounter.getAndIncrement();
            newNameMap.put(graphQLEnumType, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLEnumValueDefinition(GraphQLEnumValueDefinition enumValueDefinition, TraverserContext<GraphQLSchemaElement> context) {
            String newName = "EnumValue" + enumValueCounter.getAndIncrement();
            newNameMap.put(enumValueDefinition, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLFieldDefinition(GraphQLFieldDefinition graphQLFieldDefinition, TraverserContext<GraphQLSchemaElement> context) {
            String fieldName = graphQLFieldDefinition.getName();
            GraphQLImplementingType parentNode = (GraphQLImplementingType) context.getParentNode();
            Set<GraphQLFieldDefinition> sameFields = getSameFields(fieldName, parentNode.getName(), interfaceToImplementations, schema);
            String newName;
            if (sameFields.size() == 0) {
                newName = "field" + fieldCounter.getAndIncrement();
            } else {
                if (newNameMap.containsKey(sameFields.iterator().next())) {
                    newName = newNameMap.get(sameFields.iterator().next());
                } else {
                    newName = "field" + fieldCounter.getAndIncrement();
                    for (GraphQLFieldDefinition fieldDefinition : sameFields) {
                        newNameMap.put(fieldDefinition, newName);
                    }
                }
            }
            newNameMap.put(graphQLFieldDefinition, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLInputObjectField(GraphQLInputObjectField graphQLInputObjectField, TraverserContext<GraphQLSchemaElement> context) {
            String newName = "inputField" + inputObjectFieldCounter.getAndIncrement();
            newNameMap.put(graphQLInputObjectField, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLInputObjectType(GraphQLInputObjectType graphQLInputObjectType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLInputObjectType)) {
                return TraversalControl.ABORT;
            }
            String newName = "InputObject" + inputObjectCounter.getAndIncrement();
            newNameMap.put(graphQLInputObjectType, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLObjectType(GraphQLObjectType graphQLObjectType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLObjectType)) {
                return TraversalControl.ABORT;
            }
            String newName = "Object" + objectCounter.getAndIncrement();
            newNameMap.put(graphQLObjectType, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLScalarType(GraphQLScalarType graphQLScalarType, TraverserContext<GraphQLSchemaElement> context) {
            if (ScalarInfo.isGraphqlSpecifiedScalar(graphQLScalarType)) {
                return TraversalControl.ABORT;
            }
            String newName = "Scalar" + scalarCounter.getAndIncrement();
            newNameMap.put(graphQLScalarType, newName);
            return CONTINUE;
        }

        @Override
        public TraversalControl visitGraphQLUnionType(GraphQLUnionType graphQLUnionType, TraverserContext<GraphQLSchemaElement> context) {
            if (Introspection.isIntrospectionTypes(graphQLUnionType)) {
                return TraversalControl.ABORT;
            }
            String newName = "Union" + unionCounter.getAndIncrement();
            newNameMap.put(graphQLUnionType, newName);
            return CONTINUE;
        }
    };
    SchemaTransformer.transformSchema(schema, visitor);
    return newNameMap;
}
Also used : OperationDefinition(graphql.language.OperationDefinition) Value(graphql.language.Value) QueryVisitorInlineFragmentEnvironment(graphql.analysis.QueryVisitorInlineFragmentEnvironment) ValuesResolver(graphql.execution.ValuesResolver) GraphQLInputObjectType(graphql.schema.GraphQLInputObjectType) QueryTraverser(graphql.analysis.QueryTraverser) GraphQLFieldDefinition(graphql.schema.GraphQLFieldDefinition) FragmentSpread(graphql.language.FragmentSpread) GraphQLInterfaceType(graphql.schema.GraphQLInterfaceType) GraphQLInputObjectField(graphql.schema.GraphQLInputObjectField) GraphQLUnionType(graphql.schema.GraphQLUnionType) GraphQLEnumValueDefinition(graphql.schema.GraphQLEnumValueDefinition) GraphQLNamedSchemaElement(graphql.schema.GraphQLNamedSchemaElement) GraphQLTypeUtil.unwrapNonNullAs(graphql.schema.GraphQLTypeUtil.unwrapNonNullAs) Directives(graphql.Directives) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) QueryVisitorFieldEnvironment(graphql.analysis.QueryVisitorFieldEnvironment) Type(graphql.language.Type) DirectiveInfo(graphql.schema.idl.DirectiveInfo) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) QueryVisitorFragmentSpreadEnvironment(graphql.analysis.QueryVisitorFragmentSpreadEnvironment) BigInteger(java.math.BigInteger) TypeName(graphql.language.TypeName) TypeResolver(graphql.schema.TypeResolver) GraphQLObjectType(graphql.schema.GraphQLObjectType) GraphQLDirective(graphql.schema.GraphQLDirective) GraphQLNamedOutputType(graphql.schema.GraphQLNamedOutputType) GraphQLNonNull(graphql.schema.GraphQLNonNull) ObjectField(graphql.language.ObjectField) GraphQLInputType(graphql.schema.GraphQLInputType) Set(java.util.Set) GraphQLArgument(graphql.schema.GraphQLArgument) String.format(java.lang.String.format) AstPrinter(graphql.language.AstPrinter) List(java.util.List) QueryVisitor(graphql.analysis.QueryVisitor) ArrayValue(graphql.language.ArrayValue) Optional(java.util.Optional) FragmentDefinition(graphql.language.FragmentDefinition) NonNullType(graphql.language.NonNullType) GraphQLEnumType(graphql.schema.GraphQLEnumType) ListType(graphql.language.ListType) AstTransformer(graphql.language.AstTransformer) ObjectValue(graphql.language.ObjectValue) GraphQLSchemaElement(graphql.schema.GraphQLSchemaElement) GraphQLCodeRegistry(graphql.schema.GraphQLCodeRegistry) GraphQLNamedType(graphql.schema.GraphQLNamedType) Node(graphql.language.Node) SchemaTransformer(graphql.schema.SchemaTransformer) TreeTransformerUtil.changeNode(graphql.util.TreeTransformerUtil.changeNode) GraphQLScalarType(graphql.schema.GraphQLScalarType) QueryVisitorFieldArgumentEnvironment(graphql.analysis.QueryVisitorFieldArgumentEnvironment) QueryVisitorFieldArgumentInputValue(graphql.analysis.QueryVisitorFieldArgumentInputValue) EnumValue(graphql.language.EnumValue) HashMap(java.util.HashMap) GraphQLType(graphql.schema.GraphQLType) ArrayList(java.util.ArrayList) Introspection(graphql.introspection.Introspection) LinkedHashMap(java.util.LinkedHashMap) Scalars(graphql.Scalars) Parser(graphql.parser.Parser) Definition(graphql.language.Definition) VariableReference(graphql.language.VariableReference) BiConsumer(java.util.function.BiConsumer) GraphQLSchema(graphql.schema.GraphQLSchema) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) QueryVisitorFieldArgumentValueEnvironment(graphql.analysis.QueryVisitorFieldArgumentValueEnvironment) LinkedHashSet(java.util.LinkedHashSet) NodeVisitorStub(graphql.language.NodeVisitorStub) SchemaGenerator.createdMockedSchema(graphql.schema.idl.SchemaGenerator.createdMockedSchema) ScalarInfo(graphql.schema.idl.ScalarInfo) CONTINUE(graphql.util.TraversalControl.CONTINUE) GraphQLArgument.newArgument(graphql.schema.GraphQLArgument.newArgument) Field(graphql.language.Field) GraphQLImplementingType(graphql.schema.GraphQLImplementingType) GraphQLTypeVisitorStub(graphql.schema.GraphQLTypeVisitorStub) SchemaUtil(graphql.schema.impl.SchemaUtil) AssertException(graphql.AssertException) Directive(graphql.language.Directive) Consumer(java.util.function.Consumer) Argument(graphql.language.Argument) Document(graphql.language.Document) TypeUtil(graphql.schema.idl.TypeUtil) VariableDefinition(graphql.language.VariableDefinition) GraphQLList(graphql.schema.GraphQLList) StringValue(graphql.language.StringValue) GraphQLTypeReference(graphql.schema.GraphQLTypeReference) GraphQLTypeUtil.unwrapNonNull(graphql.schema.GraphQLTypeUtil.unwrapNonNull) PublicApi(graphql.PublicApi) IntValue(graphql.language.IntValue) Assert.assertNotNull(graphql.Assert.assertNotNull) GraphQLTypeVisitor(graphql.schema.GraphQLTypeVisitor) GraphQLTypeUtil.unwrapOneAs(graphql.schema.GraphQLTypeUtil.unwrapOneAs) InlineFragment(graphql.language.InlineFragment) Collections(java.util.Collections) GraphQLUnionType(graphql.schema.GraphQLUnionType) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) GraphQLFieldDefinition(graphql.schema.GraphQLFieldDefinition) GraphQLInterfaceType(graphql.schema.GraphQLInterfaceType) GraphQLTypeVisitorStub(graphql.schema.GraphQLTypeVisitorStub) LinkedHashMap(java.util.LinkedHashMap) GraphQLSchemaElement(graphql.schema.GraphQLSchemaElement) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) GraphQLNamedSchemaElement(graphql.schema.GraphQLNamedSchemaElement) List(java.util.List) ArrayList(java.util.ArrayList) GraphQLList(graphql.schema.GraphQLList) GraphQLEnumType(graphql.schema.GraphQLEnumType) GraphQLEnumValueDefinition(graphql.schema.GraphQLEnumValueDefinition) GraphQLArgument(graphql.schema.GraphQLArgument) GraphQLDirective(graphql.schema.GraphQLDirective) GraphQLImplementingType(graphql.schema.GraphQLImplementingType) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) GraphQLScalarType(graphql.schema.GraphQLScalarType) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SchemaUtil(graphql.schema.impl.SchemaUtil) GraphQLTypeVisitor(graphql.schema.GraphQLTypeVisitor) GraphQLInputObjectField(graphql.schema.GraphQLInputObjectField) GraphQLInputObjectType(graphql.schema.GraphQLInputObjectType) GraphQLObjectType(graphql.schema.GraphQLObjectType)

Example 5 with GraphQLAppliedDirectiveArgument

use of graphql.schema.GraphQLAppliedDirectiveArgument in project graphql-java by graphql-java.

the class SchemaPrinter method directiveString.

private String directiveString(GraphQLAppliedDirective directive) {
    if (!options.getIncludeSchemaElement().test(directive)) {
        return "";
    }
    if (!options.getIncludeDirective().test(directive.getName())) {
        // @deprecated is special - we always print it if something is deprecated
        if (!isDeprecatedDirective(directive)) {
            return "";
        }
    }
    StringBuilder sb = new StringBuilder();
    sb.append("@").append(directive.getName());
    Comparator<? super GraphQLSchemaElement> comparator = getComparator(GraphQLAppliedDirective.class, GraphQLAppliedDirectiveArgument.class);
    List<GraphQLAppliedDirectiveArgument> args = directive.getArguments();
    args = args.stream().filter(arg -> arg.getArgumentValue().isSet()).sorted(comparator).collect(toList());
    if (!args.isEmpty()) {
        sb.append("(");
        for (int i = 0; i < args.size(); i++) {
            GraphQLAppliedDirectiveArgument arg = args.get(i);
            String argValue = null;
            if (arg.hasSetValue()) {
                argValue = printAst(arg.getArgumentValue(), arg.getType());
            }
            if (!isNullOrEmpty(argValue)) {
                sb.append(arg.getName());
                sb.append(" : ");
                sb.append(argValue);
                if (i < args.size() - 1) {
                    sb.append(", ");
                }
            }
        }
        sb.append(")");
    }
    return sb.toString();
}
Also used : Arrays(java.util.Arrays) GraphqlTypeComparatorRegistry(graphql.schema.GraphqlTypeComparatorRegistry) GraphQLDirectiveContainer(graphql.schema.GraphQLDirectiveContainer) ValuesResolver(graphql.execution.ValuesResolver) GraphQLInputObjectType(graphql.schema.GraphQLInputObjectType) GraphQLFieldDefinition(graphql.schema.GraphQLFieldDefinition) GraphQLInterfaceType(graphql.schema.GraphQLInterfaceType) InputValueDefinition(graphql.language.InputValueDefinition) GraphQLInputObjectField(graphql.schema.GraphQLInputObjectField) GraphQLUnionType(graphql.schema.GraphQLUnionType) GraphQLEnumValueDefinition(graphql.schema.GraphQLEnumValueDefinition) GraphQLAppliedDirective(graphql.schema.GraphQLAppliedDirective) InputValueWithState(graphql.schema.InputValueWithState) EnumTypeDefinition(graphql.language.EnumTypeDefinition) Description(graphql.language.Description) EnumValueDefinition(graphql.language.EnumValueDefinition) Map(java.util.Map) DefaultGraphqlTypeComparatorRegistry(graphql.schema.DefaultGraphqlTypeComparatorRegistry) GraphQLObjectType(graphql.schema.GraphQLObjectType) PrintWriter(java.io.PrintWriter) GraphQLDirective(graphql.schema.GraphQLDirective) ObjectTypeDefinition(graphql.language.ObjectTypeDefinition) GraphQLNamedOutputType(graphql.schema.GraphQLNamedOutputType) Predicate(java.util.function.Predicate) GraphqlFieldVisibility(graphql.schema.visibility.GraphqlFieldVisibility) FieldDefinition(graphql.language.FieldDefinition) GraphQLInputType(graphql.schema.GraphQLInputType) TypeDefinition(graphql.language.TypeDefinition) GraphQLArgument(graphql.schema.GraphQLArgument) Collectors(java.util.stream.Collectors) Collectors.joining(java.util.stream.Collectors.joining) AstPrinter(graphql.language.AstPrinter) List(java.util.List) Stream(java.util.stream.Stream) InterfaceTypeDefinition(graphql.language.InterfaceTypeDefinition) GraphQLEnumType(graphql.schema.GraphQLEnumType) GraphqlTypeComparatorEnvironment(graphql.schema.GraphqlTypeComparatorEnvironment) GraphQLSchemaElement(graphql.schema.GraphQLSchemaElement) GraphQLNamedType(graphql.schema.GraphQLNamedType) GraphQLScalarType(graphql.schema.GraphQLScalarType) InputObjectTypeDefinition(graphql.language.InputObjectTypeDefinition) GraphQLType(graphql.schema.GraphQLType) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) UnionTypeDefinition(graphql.language.UnionTypeDefinition) GraphQLSchema(graphql.schema.GraphQLSchema) GraphQLTypeUtil(graphql.schema.GraphQLTypeUtil) DeprecatedDirective(graphql.Directives.DeprecatedDirective) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) Assert(graphql.Assert) DirectivesUtil(graphql.DirectivesUtil) ScalarTypeDefinition(graphql.language.ScalarTypeDefinition) EscapeUtil.escapeJsonString(graphql.util.EscapeUtil.escapeJsonString) DEFAULT_FIELD_VISIBILITY(graphql.schema.visibility.DefaultGraphqlFieldVisibility.DEFAULT_FIELD_VISIBILITY) Optional.ofNullable(java.util.Optional.ofNullable) StringWriter(java.io.StringWriter) GraphQLOutputType(graphql.schema.GraphQLOutputType) Document(graphql.language.Document) Collectors.toList(java.util.stream.Collectors.toList) PublicApi(graphql.PublicApi) Comparator(java.util.Comparator) GraphQLAppliedDirectiveArgument(graphql.schema.GraphQLAppliedDirectiveArgument) EscapeUtil.escapeJsonString(graphql.util.EscapeUtil.escapeJsonString)

Aggregations

GraphQLAppliedDirectiveArgument (graphql.schema.GraphQLAppliedDirectiveArgument)7 GraphQLArgument (graphql.schema.GraphQLArgument)6 GraphQLAppliedDirective (graphql.schema.GraphQLAppliedDirective)5 GraphQLDirective (graphql.schema.GraphQLDirective)5 ArrayList (java.util.ArrayList)5 PublicApi (graphql.PublicApi)4 ValuesResolver (graphql.execution.ValuesResolver)4 AstPrinter (graphql.language.AstPrinter)4 GraphQLObjectType (graphql.schema.GraphQLObjectType)4 GraphQLSchema (graphql.schema.GraphQLSchema)4 GraphQLSchemaElement (graphql.schema.GraphQLSchemaElement)4 GraphQLType (graphql.schema.GraphQLType)4 List (java.util.List)4 Assert.assertNotNull (graphql.Assert.assertNotNull)3 AssertException (graphql.AssertException)2 Directives (graphql.Directives)2 DirectivesUtil (graphql.DirectivesUtil)2 Scalars (graphql.Scalars)2 QueryTraverser (graphql.analysis.QueryTraverser)2 QueryVisitor (graphql.analysis.QueryVisitor)2