private ApiObject GetRequestApiObjectByName(string schema)
        {
            var type = RamlTypesHelper.ExtractType(schema.ToLowerInvariant());

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

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

            return(null);
        }
示例#2
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));
        }