예제 #1
0
        public ParserModel(
            string name,
            OperationDefinitionNode operation,
            ComplexOutputTypeModel returnType,
            IReadOnlyList <FieldParserModel> fieldParsers)
        {
            Name         = name;
            Operation    = operation;
            ReturnType   = returnType;
            FieldParsers = fieldParsers;

            var leafTypes = new List <ILeafType>();

            foreach (FieldParserModel parser in fieldParsers)
            {
                foreach (ComplexOutputTypeModel model in parser.PossibleTypes)
                {
                    foreach (OutputFieldModel field in model.Fields)
                    {
                        if (field.Type.NamedType() is ILeafType leafType)
                        {
                            leafTypes.Add(leafType);
                        }
                    }
                }
            }

            LeafTypes = leafTypes;
        }
예제 #2
0
 public FieldParserModel(
     OperationDefinitionNode operation,
     FieldNode selection,
     Path path,
     ComplexOutputTypeModel returnType,
     IType fieldType,
     IReadOnlyList <ComplexOutputTypeModel> possibleTypes)
 {
     Operation     = operation;
     Selection     = selection;
     Path          = path;
     ReturnType    = returnType;
     FieldType     = fieldType;
     PossibleTypes = possibleTypes;
 }