private ApiObject GetRequestApiObjectByParametrizedName(Method method, Resource resource, string schema, string fullUrl)
        {
            var type = schemaParameterParser.Parse(schema, resource, method, fullUrl);

            if (schemaObjects.Any(o => o.Key.ToLower() == type.ToLowerInvariant()))
            {
                return(schemaObjects.First(o => o.Key.ToLower() == type.ToLowerInvariant()).Value);
            }

            if (schemaObjects.Values.Any(o => o.Name.ToLower() == type.ToLowerInvariant()))
            {
                return(schemaObjects.Values.First(o => o.Name.ToLower() == type.ToLowerInvariant()));
            }

            if (schemaRequestObjects.Any(o => o.Key.ToLower() == type.ToLowerInvariant()))
            {
                return(schemaRequestObjects.First(o => o.Key.ToLower() == type.ToLowerInvariant()).Value);
            }

            if (schemaRequestObjects.Values.Any(o => o.Name.ToLower() == type.ToLowerInvariant()))
            {
                return(schemaRequestObjects.Values.First(o => o.Name.ToLower() == type.ToLowerInvariant()));
            }

            return(null);
        }
        private string GetReturnTypeFromParameter(Method method, Resource resource, MimeType mimeType, string fullUrl, string returnType)
        {
            var type = schemaParameterParser.Parse(mimeType.Schema, resource, method, fullUrl);

            if (schemaObjects.Values.Any(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant()))
            {
                var apiObject = schemaObjects.Values
                                .First(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant());
                return(GetTypeFromApiObject(apiObject));
            }


            if (schemaResponseObjects.Values.Any(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant()))
            {
                var apiObject = schemaResponseObjects.Values
                                .First(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant());
                return(GetTypeFromApiObject(apiObject));
            }

            return(returnType);
        }
        private string GetNamedReturnType(Method method, Resource resource, MimeType mimeType, IDictionary <string, ApiObject> schemaResponseObjects)
        {
            var returnType = string.Empty;

            if (mimeType.Schema.Contains("<<") && mimeType.Schema.Contains(">>"))
            {
                var type = schemaParameterParser.Parse(mimeType.Schema, resource, method);
                if (schemaResponseObjects.Values.Any(o => o.Properties.Any() && o.Name.ToLowerInvariant() == type))
                {
                    var apiObject = schemaResponseObjects.Values.First(o => o.Properties.Any() && o.Name.ToLowerInvariant() == type);
                    returnType = apiObject.IsArray ? apiObject.Name + "[]" : apiObject.Name;
                }
            }
            else if (!mimeType.Schema.Contains("<") && !mimeType.Schema.Contains("{"))
            {
                var type = mimeType.Schema.ToLowerInvariant();
                if (schemaResponseObjects.Values.Any(o => o.Properties.Any() && o.Name.ToLowerInvariant() == type))
                {
                    var apiObject = schemaResponseObjects.Values.First(o => o.Properties.Any() && o.Name.ToLowerInvariant() == type);
                    returnType = apiObject.IsArray ? apiObject.Name + "[]" : apiObject.Name;
                }
            }
            return(returnType);
        }
        private string GetReturnTypeFromParameter(Method method, Resource resource, string fullUrl, string schema)
        {
            var type = schemaParameterParser.Parse(schema, resource, method, fullUrl);

            if (schemaObjects.Values.Any(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant()))
            {
                var apiObject = schemaObjects.Values
                                .First(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant());
                return(RamlTypesHelper.GetTypeFromApiObject(apiObject));
            }


            if (schemaResponseObjects.Values.Any(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant()))
            {
                var apiObject = schemaResponseObjects.Values
                                .First(o => o.Name.ToLowerInvariant() == type.ToLowerInvariant());
                return(RamlTypesHelper.GetTypeFromApiObject(apiObject));
            }

            return(string.Empty);
        }