示例#1
0
        public override GraphQLNamedType BeginVisitNamedType(
            GraphQLNamedType typeCondition)
        {
            {
                Tracker.EnterNamedType?.Invoke(typeCondition);
            }

            return(base.BeginVisitNamedType(typeCondition));
        }
        public void SetUp()
        {
            dynamic variables = new ExpandoObject();

            variables.scalarIntVariable = "1";

            this.intNamedType     = GetIntNamedType();
            this.schemaRepository = Substitute.For <ISchemaRepository>();
            this.variableResolver = new VariableResolver(variables, this.schemaRepository, this.GetVariableDefinitions());
        }
示例#3
0
        public void SetUp()
        {
            dynamic variables = new ExpandoObject();

            variables.scalarIntVariable = "1";

            this.intNamedType     = GetIntNamedType();
            this.typeTranslator   = Substitute.For <ITypeTranslator>();
            this.variableResolver = new VariableResolver(variables, this.typeTranslator, this.GetVariableDefinitions());
        }
示例#4
0
        protected virtual GraphQLBaseType GetOutputTypeFromNamedType(GraphQLNamedType type)
        {
            var inputType = this.schemaRepository.GetSchemaInputTypeByName(type.Name.Value);

            if (inputType != null)
            {
                return(null);
            }

            return(this.schemaRepository.GetSchemaOutputTypeByName(type.Name.Value));
        }
示例#5
0
        public override GraphQLNamedType BeginVisitNamedType(GraphQLNamedType namedType)
        {
            var typeName = namedType.Name.Value;
            var type     = this.GetTypeFromSchema(typeName);

            if (type == null)
            {
                this.Errors.Add(
                    new GraphQLException(this.ComposeErrorMessage(typeName), new[] { namedType }));
            }

            return(base.BeginVisitNamedType(namedType));
        }
示例#6
0
        protected TypeSyntax GetCSharpTypeFromGraphQLNamedType(GraphQLNamedType type, IEnumerable <ASTNode> allDefinitions, bool nullable = true)
        {
            var cSharpType = this.config.GetCSharpTypeFromGraphQLType(type.Name.Value, nullable);

            if (cSharpType != null)
            {
                return(cSharpType);
            }

            var enumTypeFromSchema = allDefinitions
                                     .Where(e => e.Kind == ASTNodeKind.EnumTypeDefinition)
                                     .Cast <GraphQLEnumTypeDefinition>()
                                     .SingleOrDefault(e => e.Name.Value == type.Name.Value);

            if (enumTypeFromSchema != null)
            {
                return(nullable
                    ? SyntaxFactory.NullableType(SyntaxFactory.ParseTypeName(type.Name.Value))
                    : SyntaxFactory.ParseTypeName(type.Name.Value));
            }

            return(SyntaxFactory.ParseTypeName(type.Name.Value));
        }
示例#7
0
 public virtual GraphQLNamedType BeginVisitNamedType(GraphQLNamedType typeCondition) => typeCondition;
        public NamedType NamedType(GraphQLNamedType source)
        {
            var type = new NamedType(Name(source.Name)).WithLocation(source, _body);

            return(type);
        }
示例#9
0
 protected virtual GraphQLBaseType GetInputTypeFromNamedType(GraphQLNamedType type)
 {
     return(this.schemaRepository.GetSchemaInputTypeByName(type.Name.Value));
 }