private void ParseObject(string key, IDictionary <string, Newtonsoft.JsonV4.Schema.JsonSchema> schema, IDictionary <string, ApiObject> objects, IDictionary <string, ApiEnum> enums, Newtonsoft.JsonV4.Schema.JsonSchema parentSchema, string baseClass = null)
        {
            var obj = new ApiObject
            {
                Name       = NetNamingMapper.GetObjectName(key),
                Properties = ParseSchema(schema, objects, enums, parentSchema),
                BaseClass  = baseClass
            };

            // Avoid duplicated keys and names
            if (objects.ContainsKey(key) || objects.Any(o => o.Value.Name == obj.Name) ||
                otherObjects.ContainsKey(key) || otherObjects.Any(o => o.Value.Name == obj.Name) ||
                schemaObjects.ContainsKey(key) || schemaObjects.Any(o => o.Value.Name == obj.Name) ||
                !obj.Properties.Any())
            {
                if (UniquenessHelper.HasSameProperties(obj, objects, key, otherObjects, schemaObjects))
                {
                    return;
                }

                obj.Name = UniquenessHelper.GetUniqueName(objects, obj.Name, otherObjects, schemaObjects);
                key      = UniquenessHelper.GetUniqueKey(objects, key, otherObjects);
            }

            objects.Add(key, obj);
        }
        private string ParseObject(string key, JsonSchema schema, IDictionary <string, ApiObject> objects, IDictionary <string, ApiEnum> enums)
        {
            var propertiesSchemas = schema.Properties;

            var obj = new ApiObject
            {
                Name       = NetNamingMapper.GetObjectName(key),
                Properties = ParseSchema(propertiesSchemas, objects, enums)
            };

            AdditionalProperties(obj.Properties, schema);

            if (!obj.Properties.Any())
            {
                return(null);
            }

            // Avoid duplicated keys and names or no properties
            if (objects.ContainsKey(key) || objects.Any(o => o.Value.Name == obj.Name) ||
                otherObjects.ContainsKey(key) || otherObjects.Any(o => o.Value.Name == obj.Name) ||
                schemaObjects.ContainsKey(key) || schemaObjects.Any(o => o.Value.Name == obj.Name))
            {
                if (UniquenessHelper.HasSameProperties(obj, objects, key, otherObjects, schemaObjects))
                {
                    return(key);
                }

                obj.Name = UniquenessHelper.GetUniqueName(objects, obj.Name, otherObjects, schemaObjects);
                key      = UniquenessHelper.GetUniqueKey(objects, key, otherObjects);
            }

            objects.Add(key, obj);
            return(key);
        }