コード例 #1
0
        private ApiObject GetRequestApiObjectByParametrizedName(Operation method, EndPoint 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);
        }
コード例 #2
0
        private string GetReturnTypeFromParameter(Operation method, EndPoint 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);
        }