Esempio n. 1
0
 private SchemaInfo(ISchemaEntity schema, string typeName, IReadOnlyList <FieldInfo> fields, Names names)
 {
     Schema        = schema;
     ContentType   = names[typeName];
     DataFlatType  = names[$"{typeName}FlatDataDto"];
     DataInputType = names[$"{typeName}DataInputDto"];
     ResultType    = names[$"{typeName}ResultDto"];
     DataType      = names[$"{typeName}DataDto"];
     DisplayName   = schema.DisplayName();
     Fields        = fields;
     TypeName      = typeName;
 }
Esempio n. 2
0
 private FieldInfo(IField field, string fieldName, string typeName, IReadOnlyList <FieldInfo> fields, Names names)
 {
     DisplayName        = field.DisplayName();
     Field              = field;
     Fields             = fields;
     FieldName          = fieldName;
     LocalizedType      = names[$"{typeName}Dto"];
     LocalizedInputType = names[$"{typeName}InputDto"];
     NestedInputType    = names[$"{typeName}ChildInputDto"];
     NestedType         = names[$"{typeName}ChildDto"];
     UnionType          = names[$"{typeName}UnionDto"];
 }
Esempio n. 3
0
        internal static FieldInfo Build(IRootField rootField, string fieldName, string typeName, Names names)
        {
            var fields = EmptyFields;

            if (rootField is IArrayField arrayField && arrayField.Fields.Count > 0)
            {
                var fieldNames = new Names();

                fields = new List <FieldInfo>(arrayField.Fields.Count);

                foreach (var field in arrayField.Fields)
                {
                    fields.Add(new FieldInfo(field, fieldNames[field], $"{typeName}{field.TypeName()}", EmptyFields, names));
                }
            }

            return(new FieldInfo(rootField, fieldName, typeName, fields, names));
        }
Esempio n. 4
0
        internal static FieldInfo Build(IRootField rootField, string typeName, Names names, Names parentNames)
        {
            var fieldInfos = EmptyFields;

            if (rootField is IArrayField arrayField)
            {
                var fieldNames = new Names();

                fieldInfos = new List <FieldInfo>(arrayField.Fields.Count);

                foreach (var nestedField in arrayField.Fields.ForApi())
                {
                    fieldInfos.Add(new FieldInfo(
                                       nestedField,
                                       names[$"{typeName}{nestedField.TypeName()}"],
                                       names,
                                       fieldNames,
                                       EmptyFields));
                }
            }

            return(new FieldInfo(rootField, typeName, names, parentNames, fieldInfos));
        }