private ApiObject ParseMap(RamlType ramlType, string key)
        {
            var name = NetNamingMapper.GetObjectName(key ?? ramlType.Name);
            var type = ramlType.Object.Properties.First().Value.Type;

            if (ramlType.Object.Properties.First().Value.Object != null && ramlType.Object.Properties.First().Value.Type == "object")
            {
                var itemName     = name + "Item";
                var nestedObject = ParseObject(itemName, ramlType.Object.Properties.First().Value);
                type = nestedObject.Name;
                schemaObjects.Add(itemName, nestedObject);
            }

            type = RamlTypesHelper.DecodeRaml1Type(type);

            if (NetTypeMapper.IsPrimitiveType(type))
            {
                type = NetTypeMapper.Map(type);
            }

            return(new ApiObject
            {
                Type = name,
                Name = name,
                BaseClass = "Dictionary<string," + type + ">",
                Description = ramlType.Description,
                Example = GetExample(ramlType.Example, ramlType.Examples),
                Properties = new Property[0],
                IsMap = true
            });
        }
        private string GetScalarType(RamlType ramlType)
        {
            var type = NetTypeMapper.GetNetType(ramlType.Scalar.Type, ramlType.Scalar.Format);

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

            if (!ramlTypes.ContainsKey(ramlType.Scalar.Type))
            {
                return("object");
            }

            var subRamlType = ramlTypes[ramlType.Scalar.Type];

            if (subRamlType.Scalar == null)
            {
                return(NetNamingMapper.GetObjectName(ramlType.Scalar.Type));
            }

            type = GetScalarType(subRamlType);
            if (type != null)
            {
                return(type);
            }

            throw new InvalidOperationException("Cannot determine type of scalar " + ramlType.Name);
        }
Beispiel #3
0
        private void ParseProperties(IDictionary <string, ApiObject> objects, ICollection <Property> props, IDictionary <string, JsonSchema> properties)
        {
            if (properties == null)
            {
                return;
            }

            foreach (var property in properties)
            {
                if (property.Value.Type == null || property.Value.Type == JsonSchemaType.Null ||
                    property.Value.Type == JsonSchemaType.None)
                {
                    continue;
                }

                var key = property.Key;
                if (string.IsNullOrWhiteSpace(key))
                {
                    key = GetUniqueName(props);
                }

                var prop = new Property
                {
                    Name        = NetNamingMapper.GetPropertyName(key),
                    Type        = NetTypeMapper.Map(property.Value.Type),
                    Description = property.Value.Description
                };

                ParseComplexTypes(objects, property.Value, prop, property, key);
                props.Add(prop);
            }
        }
Beispiel #4
0
        protected void CleanProperties(IDictionary <string, ApiObject> apiObjects)
        {
            var keys            = apiObjects.Keys.ToList();
            var apiObjectsCount = keys.Count - 1;

            for (var i = apiObjectsCount; i >= 0; i--)
            {
                var apiObject = apiObjects[keys[i]];
                var count     = apiObject.Properties.Count;
                for (var index = count - 1; index >= 0; index--)
                {
                    var prop = apiObject.Properties[index];
                    var type = prop.Type;
                    if (!string.IsNullOrWhiteSpace(type) && IsCollectionType(type))
                    {
                        type = CollectionTypeHelper.GetBaseType(type);
                    }

                    if (prop.IsAdditionalProperties)
                    {
                        continue;
                    }

                    if (!NetTypeMapper.IsPrimitiveType(type) && schemaResponseObjects.All(o => o.Value.Name != type) &&
                        schemaRequestObjects.All(o => o.Value.Name != type) &&
                        enums.All(e => e.Value.Name != type.TrimEnd('?')) &&
                        schemaObjects.All(o => o.Value.Name != type))
                    {
                        apiObject.Properties.Remove(prop);
                    }
                }
            }
        }
        public static IList <Property> ConvertHeadersToProperties(IEnumerable <Parameter> headers)
        {
            var properties = new List <Property>();

            if (headers == null)
            {
                return(properties);
            }

            foreach (var header in headers)
            {
                var description = ParserHelpers.RemoveNewLines(header.Description);

                var type       = NetTypeMapper.Map(header.Type);
                var typeSuffix = (type == "string" || header.Required ? "" : "?");

                properties.Add(new Property
                {
                    Type         = type + typeSuffix,
                    Name         = NetNamingMapper.GetPropertyName(header.DisplayName),
                    OriginalName = header.DisplayName,
                    Description  = description,
                    Example      = header.Example,
                    Required     = header.Required
                });
            }
            return(properties);
        }
        protected void CleanProperties(IDictionary <string, ApiObject> apiObjects)
        {
            var keys            = apiObjects.Keys.ToList();
            var apiObjectsCount = keys.Count - 1;

            for (var i = apiObjectsCount; i >= 0; i--)
            {
                var apiObject = apiObjects[keys[i]];
                var count     = apiObject.Properties.Count;
                for (var index = count - 1; index >= 0; index--)
                {
                    var prop = apiObject.Properties[index];
                    var type = prop.Type;
                    if (!string.IsNullOrWhiteSpace(type) && type.EndsWith("[]"))
                    {
                        type = type.Substring(0, type.Length - 2);
                    }

                    if (!NetTypeMapper.IsPrimitiveType(type) && schemaResponseObjects.All(o => o.Value.Name != type) && schemaRequestObjects.All(o => o.Value.Name != type))
                    {
                        apiObject.Properties.Remove(prop);
                    }
                }
                if (!apiObject.Properties.Any())
                {
                    apiObjects.Remove(keys[i]);
                }
            }
        }
        private ApiObject ParseArray(string key, RamlType ramlType)
        {
            var typeOfArray = GetTypeOfArray(key, ramlType);

            var baseType = CollectionTypeHelper.GetBaseType(typeOfArray);

            if (!NetTypeMapper.IsPrimitiveType(baseType) &&
                ramlType.Array.Items != null && ramlType.Array.Items.Type == "object")
            {
                if (baseType == typeOfArray)
                {
                    baseType = typeOfArray + "Item";
                }

                baseType = NetNamingMapper.GetObjectName(baseType);

                var itemType = ParseNestedType(ramlType.Array.Items, baseType);
                schemaObjects.Add(baseType, itemType);
                typeOfArray = CollectionTypeHelper.GetCollectionType(baseType);
            }

            return(new ApiObject
            {
                IsArray = true,
                Name = NetNamingMapper.GetObjectName(key),
                Description = ramlType.Description,
                Example = ramlType.Example,
                Type = typeOfArray
            });
        }
        public static string DecodeRaml1Type(string type)
        {
            // TODO: can I handle this better ?
            if (type.Contains("(") || type.Contains("|"))
            {
                return("object");
            }

            if (type.EndsWith("[][]")) // array of arrays
            {
                var strippedType = type.Substring(0, type.Length - 4);
                if (NetTypeMapper.Map(strippedType) == null)
                {
                    strippedType = NetNamingMapper.GetObjectName(strippedType);
                }

                var decodeRaml1Type = CollectionTypeHelper.GetCollectionType(CollectionTypeHelper.GetCollectionType(strippedType));
                return(decodeRaml1Type);
            }

            if (type.EndsWith("[]")) // array
            {
                var strippedType = type.Substring(0, type.Length - 2);

                if (NetTypeMapper.Map(strippedType) == null)
                {
                    strippedType = NetNamingMapper.GetObjectName(strippedType);
                }

                var decodeRaml1Type = CollectionTypeHelper.GetCollectionType(strippedType);
                return(decodeRaml1Type);
            }

            if (type.EndsWith("{}")) // Map
            {
                var subtype = type.Substring(0, type.Length - 2);
                var netType = NetTypeMapper.Map(subtype);
                if (netType != null)
                {
                    return("IDictionary<string, " + netType + ">");
                }

                return("IDictionary<string, " + NetNamingMapper.GetObjectName(subtype) + ">");
            }

            if (CollectionTypeHelper.IsCollection(type))
            {
                return(type);
            }

            return(NetNamingMapper.GetObjectName(type));
        }
Beispiel #9
0
        private IEnumerable <GeneratorParameter> MatchParameters(IDictionary <string, Parameter> parentUriParameters, GeneratorParameter[] urlParameters)
        {
            var parameters = new List <GeneratorParameter>();

            foreach (var param in urlParameters)
            {
                if (parentUriParameters.ContainsKey(param.Name))
                {
                    param.Type        = NetTypeMapper.Map(parentUriParameters[param.Name].Type);
                    param.Description = parentUriParameters[param.Name].Description;
                }
                parameters.Add(param);
            }
            return(parameters);
        }
Beispiel #10
0
        private IList <Property> ParseSchema(IDictionary <string, Newtonsoft.JsonV4.Schema.JsonSchema> schema, IDictionary <string, ApiObject> objects)
        {
            var props = new List <Property>();

            foreach (var kv in schema)
            {
                var prop = new Property
                {
                    Name        = NetNamingMapper.GetPropertyName(kv.Key),
                    Type        = NetTypeMapper.Map(kv.Value.Type),
                    Description = kv.Value.Description
                };
                ParseComplexTypes(objects, kv.Value, prop, kv);
                props.Add(prop);
            }
            return(props);
        }
Beispiel #11
0
        private void ParseArray(IDictionary <string, ApiObject> objects, Newtonsoft.JsonV4.Schema.JsonSchema schema, Property prop, KeyValuePair <string, Newtonsoft.JsonV4.Schema.JsonSchema> property)
        {
            var netType = NetTypeMapper.Map(schema.Items.First().Type);

            if (netType != null)
            {
                prop.Type = netType + "[]";
            }
            else
            {
                prop.Type = NetNamingMapper.GetObjectName(property.Key) + "[]";
                foreach (var item in schema.Items)
                {
                    ParseObject(property.Key, item.Properties, objects);
                }
            }
        }
        private static string GetTypeOfArray(string key, RamlType ramlType)
        {
            if (!string.IsNullOrWhiteSpace(ramlType.Type))
            {
                var pureType = ramlType.Type.EndsWith("[]") ? ramlType.Type.Substring(0, ramlType.Type.Length - 2) : ramlType.Type;

                if (pureType != "array" && pureType != "object")
                {
                    if (NetTypeMapper.IsPrimitiveType(pureType))
                    {
                        pureType = NetTypeMapper.Map(pureType);
                    }
                    else
                    {
                        pureType = NetNamingMapper.GetObjectName(pureType);
                    }

                    return(CollectionTypeHelper.GetCollectionType(pureType));
                }
            }
            if (!string.IsNullOrWhiteSpace(ramlType.Array.Items.Type))
            {
                if (ramlType.Array.Items.Type != "object")
                {
                    var netType = ramlType.Array.Items.Type;
                    if (NetTypeMapper.IsPrimitiveType(netType))
                    {
                        netType = NetTypeMapper.Map(netType);
                    }
                    else
                    {
                        netType = NetNamingMapper.GetObjectName(netType);
                    }

                    return(CollectionTypeHelper.GetCollectionType(netType));
                }
            }

            if (!string.IsNullOrWhiteSpace(ramlType.Array.Items.Name))
            {
                return(CollectionTypeHelper.GetCollectionType(NetNamingMapper.GetObjectName(ramlType.Array.Items.Name)));
            }

            return(NetNamingMapper.GetObjectName(key));
        }
        private string GetPropertyType(RamlType prop, KeyValuePair <string, RamlType> kv)
        {
            if (string.IsNullOrWhiteSpace(prop.Type))
            {
                return("string");
            }

            if (prop.Type == "object" || (prop.Scalar.Enum != null && prop.Scalar.Enum.Any()))
            {
                return(NetNamingMapper.GetPropertyName(kv.Key));
            }

            var propertyType = NetTypeMapper.GetNetType(prop.Scalar.Type, prop.Scalar.Format);

            if (propertyType != null)
            {
                if (!prop.Required && !prop.Scalar.Required && propertyType != "string" && prop.Type != "file")
                {
                    return(propertyType + "?");
                }

                return(propertyType);
            }

            if (schemaObjects.ContainsKey(prop.Type))
            {
                var obj = schemaObjects[prop.Type];
                if (obj.IsScalar)
                {
                    return(obj.Properties.First().Type);
                }

                return(obj.Type);
            }

            if (enums.ContainsKey(prop.Type))
            {
                return(prop.Type);
            }


            return("object");
        }
Beispiel #14
0
        public IEnumerable <GeneratorParameter> GetUriParameters(Resource resource, string url)
        {
            var parameters = resource.BaseUriParameters
                             .Select(p => new GeneratorParameter {
                Name = p.Key, Type = NetTypeMapper.Map(p.Value.Type), Description = p.Value.Description
            })
                             .ToList();

            parameters.AddRange(resource.UriParameters
                                .Select(p => new GeneratorParameter {
                Name = p.Key, Type = NetTypeMapper.Map(p.Value.Type), Description = p.Value.Description
            })
                                .ToList());

            var urlParameters = ExtractParametersFromUrl(url).ToArray();

            parameters.AddRange(urlParameters.Where(up => parameters.All(p => up.Name != p.Name)).ToArray());
            return(parameters);
        }
        public static IList <Property> ConvertParametersToProperties(IEnumerable <KeyValuePair <string, Parameter> > parameters)
        {
            var properties = new List <Property>();

            foreach (var parameter in parameters)
            {
                var description = ParserHelpers.RemoveNewLines(parameter.Value.Description);

                properties.Add(new Property
                {
                    Type =
                        NetTypeMapper.Map(parameter.Value.Type) +
                        (NetTypeMapper.Map(parameter.Value.Type) == "string" || parameter.Value.Required ? "" : "?"),
                    Name        = NetNamingMapper.GetPropertyName(parameter.Key),
                    Description = description,
                    Example     = parameter.Value.Example,
                    Required    = parameter.Value.Required
                });
            }
            return(properties);
        }
Beispiel #16
0
        private void ParseProperties(IDictionary <string, ApiObject> objects, IList <Property> props, IDictionary <string, Newtonsoft.JsonV4.Schema.JsonSchema> properties)
        {
            foreach (var property in properties)
            {
                if (property.Value.Type == null || property.Value.Type == Newtonsoft.JsonV4.Schema.JsonSchemaType.Null ||
                    property.Value.Type == Newtonsoft.JsonV4.Schema.JsonSchemaType.None)
                {
                    continue;
                }

                var prop = new Property
                {
                    Name        = NetNamingMapper.GetPropertyName(property.Key),
                    Type        = NetTypeMapper.Map(property.Value.Type),
                    Description = property.Value.Description
                };

                ParseComplexTypes(objects, property.Value, prop, property);
                props.Add(prop);
            }
        }
        public IEnumerable <GeneratorParameter> GetUriParameters(Resource resource, string url, IDictionary <string, Parameter> parentUriParameters)
        {
            var parameters = resource.BaseUriParameters
                             .Select(p => new GeneratorParameter {
                Name = p.Key, Type = NetTypeMapper.GetNetType(p.Value.Type, p.Value.Format), Description = p.Value.Description
            })
                             .ToList();

            parameters.AddRange(resource.UriParameters
                                .Select(p => new GeneratorParameter {
                Name = p.Key, Type = GetParameterType(p), Description = p.Value.Description
            })
                                .ToList());

            var urlParameters        = ExtractParametersFromUrl(url).ToArray();
            var distincUrlParameters = urlParameters.Where(up => parameters.All(p => up.Name != p.Name)).ToArray();

            var matchedParameters = MatchParameters(parentUriParameters, distincUrlParameters);

            parameters.AddRange(matchedParameters);
            return(parameters);
        }
        private string GetParameterType(KeyValuePair <string, Parameter> parameter)
        {
            var parameterType = NetTypeMapper.GetNetType(parameter.Value.Type, parameter.Value.Format);

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

            if (schemaObjects.ContainsKey(parameter.Value.Type))
            {
                var schemaObject = schemaObjects[parameter.Value.Type];
                if (schemaObject.IsScalar)
                {
                    return(schemaObject.Properties.First().Type);
                }

                return(schemaObject.Type);
            }

            return("object");
        }
        private ApiObject ParseArray(string key, RamlType ramlType)
        {
            var typeOfArray = GetTypeOfArray(key, ramlType);

            var baseType = CollectionTypeHelper.GetBaseType(typeOfArray);

            if (!NetTypeMapper.IsPrimitiveType(baseType) &&
                ramlType.Array.Items != null && ramlType.Array.Items.Type == "object")
            {
                if (baseType == typeOfArray)
                {
                    baseType = typeOfArray + "Item";
                }

                baseType = NetNamingMapper.GetObjectName(baseType);

                var itemType = ParseNestedType(ramlType.Array.Items, baseType);
                if (schemaObjects.ContainsKey(baseType) && !UniquenessHelper.HasSameProperties(itemType, schemaObjects, baseType, emptyDic, emptyDic))
                {
                    baseType      = UniquenessHelper.GetUniqueName(schemaObjects, baseType, emptyDic, emptyDic);
                    itemType.Name = baseType;
                }
                if (!schemaObjects.ContainsKey(baseType))
                {
                    schemaObjects.Add(baseType, itemType);
                }

                typeOfArray = CollectionTypeHelper.GetCollectionType(baseType);
            }

            return(new ApiObject
            {
                IsArray = true,
                Name = NetNamingMapper.GetObjectName(key),
                Description = ramlType.Description,
                Example = ramlType.Example,
                Type = typeOfArray
            });
        }
Beispiel #20
0
        private string GetType(Parameter param)
        {
            if (param.Type == null)
            {
                return("string");
            }

            if (NetTypeMapper.IsPrimitiveType(param.Type))
            {
                return(NetTypeMapper.GetNetType(param.Type, param.Format) +
                       (NetTypeMapper.GetNetType(param.Type, param.Format) == "string" || param.Required ? "" : "?"));
            }

            var pureType = RamlTypesHelper.ExtractType(param.Type);

            if (schemaObjects.ContainsKey(pureType))
            {
                var apiObject = schemaObjects[pureType];
                return(RamlTypesHelper.GetTypeFromApiObject(apiObject));
            }

            return(RamlTypesHelper.DecodeRaml1Type(param.Type));
        }
Beispiel #21
0
        public static IList <Property> ConvertHeadersToProperties(IDictionary <string, Parameter> headers)
        {
            var properties = new List <Property>();

            if (headers == null)
            {
                return(properties);
            }

            foreach (var header in headers)
            {
                var description = ParserHelpers.RemoveNewLines(header.Value.Description);

                var type       = "string";
                var typeSuffix = "";
                if (header.Value.Type != null && header.Value.Type.Contains("|"))
                {
                    type = "object";
                }
                else
                {
                    type       = NetTypeMapper.GetNetType(header.Value.Type, header.Value.Format);
                    typeSuffix = (type == "string" || header.Value.Required ? "" : "?");
                }

                properties.Add(new Property
                {
                    Type         = type + typeSuffix,
                    Name         = NetNamingMapper.GetPropertyName(header.Key),
                    OriginalName = header.Value.DisplayName,
                    Description  = description,
                    Example      = header.Value.Example,
                    Required     = header.Value.Required
                });
            }
            return(properties);
        }
 private static string GetType(Parameter param)
 {
     return(param.Type == null ? "string" : (
                NetTypeMapper.Map(param.Type) +
                (NetTypeMapper.Map(param.Type) == "string" || param.Required ? "" : "?")));
 }
        private string DecodeRequestRaml1Type(string type)
        {
            // TODO: can I handle this better ?
            if (type.Contains("(") || type.Contains("|"))
            {
                return("string");
            }

            if (type.EndsWith("[][]")) // array of arrays
            {
                var subtype = type.Substring(0, type.Length - 4);
                if (NetTypeMapper.IsPrimitiveType(subtype))
                {
                    subtype = NetTypeMapper.Map(subtype);
                }
                else
                {
                    subtype = NetNamingMapper.GetObjectName(subtype);
                }

                return(CollectionTypeHelper.GetCollectionType(CollectionTypeHelper.GetCollectionType(subtype)));
            }

            if (type.EndsWith("[]")) // array
            {
                var subtype = type.Substring(0, type.Length - 2);

                if (NetTypeMapper.IsPrimitiveType(subtype))
                {
                    subtype = NetTypeMapper.Map(subtype);
                }
                else
                {
                    subtype = NetNamingMapper.GetObjectName(subtype);
                }


                return(CollectionTypeHelper.GetCollectionType(subtype));
            }

            if (type.EndsWith("{}")) // Map
            {
                var subtype = type.Substring(0, type.Length - 2);
                var netType = NetTypeMapper.Map(subtype);
                if (!string.IsNullOrWhiteSpace(netType))
                {
                    return("IDictionary<string, " + netType + ">");
                }

                var apiObject = GetRequestApiObjectByName(subtype);
                if (apiObject != null)
                {
                    return("IDictionary<string, " + RamlTypesHelper.GetTypeFromApiObject(apiObject) + ">");
                }

                return("IDictionary<string, object>");
            }

            if (NetTypeMapper.IsPrimitiveType(type))
            {
                return(NetTypeMapper.Map(type));
            }

            if (CollectionTypeHelper.IsCollection(type))
            {
                return(type);
            }

            return(NetNamingMapper.GetObjectName(type));
        }
        private IList <Property> GetProperties(IDictionary <string, RamlType> properties)
        {
            var props = new List <Property>();

            foreach (var kv in properties)
            {
                var prop = kv.Value;
                if (prop.Scalar != null)
                {
                    var newProp = GetPropertyFromScalar(prop, kv);
                    props.Add(newProp);
                    continue;
                }
                if (prop.Object != null)
                {
                    var name = NetNamingMapper.GetPropertyName(kv.Key);
                    if (!schemaObjects.ContainsKey(name) && !schemaObjects.ContainsKey(prop.Type))
                    {
                        var newApiObject = GetApiObjectFromObject(prop, name);
                        schemaObjects.Add(name, newApiObject);
                        props.Add(new Property {
                            Name = name, Type = name, Required = prop.Required, OriginalName = kv.Key.TrimEnd('?')
                        });
                    }
                    else
                    {
                        ApiObject apiObject;
                        if (schemaObjects.ContainsKey(prop.Type))
                        {
                            apiObject = schemaObjects[prop.Type];
                        }
                        else
                        {
                            apiObject = schemaObjects[name];
                        }

                        props.Add(new Property {
                            Name = name, Type = apiObject.Name, Required = prop.Required, OriginalName = kv.Key.TrimEnd('?')
                        });
                    }

                    continue;
                }
                if (prop.Array != null)
                {
                    var name = NetNamingMapper.GetPropertyName(kv.Key);
                    var type = kv.Value.Type;
                    if (kv.Value.Array.Items != null)
                    {
                        if (NetTypeMapper.IsPrimitiveType(kv.Value.Array.Items.Type))
                        {
                            type = CollectionTypeHelper.GetCollectionType(NetTypeMapper.Map(kv.Value.Array.Items.Type));
                        }
                        else
                        {
                            var obj = ParseArray(kv.Key, kv.Value);
                            // type = CollectionTypeHelper.GetCollectionType(obj.Type);
                            type = obj.Type;
                        }
                    }
                    if (type.EndsWith("[]"))
                    {
                        type = type.Substring(0, type.Length - 2);
                        if (!NetTypeMapper.IsPrimitiveType(type))
                        {
                            type = NetNamingMapper.GetObjectName(type);
                        }

                        type = CollectionTypeHelper.GetCollectionType(type);
                    }

                    props.Add(new Property {
                        Name = name, Type = type, Required = prop.Required, OriginalName = kv.Key.TrimEnd('?')
                    });
                }
            }
            return(props);
        }
        private IList <Property> GetProperties(IDictionary <string, RamlType> properties, string className)
        {
            var props = new List <Property>();

            foreach (var kv in properties)
            {
                var prop = kv.Value;
                if (prop.Scalar != null)
                {
                    var newProp = GetPropertyFromScalar(prop, kv, className);
                    props.Add(newProp);
                    continue;
                }
                if (prop.Object != null)
                {
                    var name = NetNamingMapper.GetPropertyName(kv.Key);
                    if (!schemaObjects.ContainsKey(name) && !schemaObjects.ContainsKey(prop.Type))
                    {
                        var newApiObject = GetApiObjectFromObject(prop, name);
                        if (schemaObjects.ContainsKey(name) && !UniquenessHelper.HasSameProperties(newApiObject, schemaObjects, name, emptyDic, emptyDic))
                        {
                            name = UniquenessHelper.GetUniqueName(schemaObjects, name, emptyDic, emptyDic);
                            newApiObject.Name = name;
                        }
                        if (!schemaObjects.ContainsKey(name))
                        {
                            schemaObjects.Add(name, newApiObject);
                        }
                        props.Add(new Property(className)
                        {
                            Name = name, Type = name, Required = prop.Required, OriginalName = kv.Key.TrimEnd('?')
                        });
                    }
                    else
                    {
                        ApiObject apiObject;
                        if (schemaObjects.ContainsKey(prop.Type))
                        {
                            apiObject = schemaObjects[prop.Type];
                        }
                        else
                        {
                            apiObject = schemaObjects[name];
                        }

                        props.Add(new Property(className)
                        {
                            Name = name, Type = apiObject.Name, Required = prop.Required, OriginalName = kv.Key.TrimEnd('?')
                        });
                    }

                    continue;
                }
                if (prop.Array != null)
                {
                    var name = NetNamingMapper.GetPropertyName(kv.Key);
                    var type = kv.Value.Type;
                    if (kv.Value.Array.Items != null)
                    {
                        if (kv.Value.Array.Items.Object == null && NetTypeMapper.IsPrimitiveType(kv.Value.Array.Items.Type))
                        {
                            type = CollectionTypeHelper.GetCollectionType(NetTypeMapper.Map(kv.Value.Array.Items.Type));
                        }
                        else
                        {
                            var obj = ParseArray(kv.Key, kv.Value);
                            // type = CollectionTypeHelper.GetCollectionType(obj.Type);
                            type = obj.Type;
                        }
                    }
                    if (type.EndsWith("[]"))
                    {
                        type = type.Substring(0, type.Length - 2);
                        if (!NetTypeMapper.IsPrimitiveType(type))
                        {
                            type = NetNamingMapper.GetObjectName(type);
                        }

                        type = CollectionTypeHelper.GetCollectionType(type);
                    }

                    props.Add(new Property(className)
                    {
                        Name = name, Type = type, Required = prop.Required, OriginalName = kv.Key.TrimEnd('?')
                    });
                }
                if (!string.IsNullOrWhiteSpace(prop.Type))
                {
                    var newProp = new Property(className)
                    {
                        Type         = NetNamingMapper.GetObjectName(kv.Key),
                        Name         = NetNamingMapper.GetPropertyName(kv.Key),
                        Required     = prop.Required,
                        Example      = prop.Example,
                        Description  = prop.Description,
                        OriginalName = kv.Key.TrimEnd('?')
                    };
                    props.Add(newProp);
                    continue;
                }
            }
            return(props);
        }