private IEnumerable <NormalizationApiOperationParameter> ParseParameters(dynamic op)
        {
            if (!op.ContainsKey("parameters"))
            {
                goto NoMoreParameters;
            }

            foreach (var paramObj in op.parameters)
            {
                if (!OperationParameterFilter(paramObj))
                {
                    continue;
                }
                if (!paramObj.ContainsKey("paramType"))
                {
                    continue;
                }

                var param = new NormalizationApiOperationParameter();
                param.CopyFrom(SimpleNormalizationApiDataType.ParseFromJObject(paramObj));

                param.AllowsMultiple = paramObj.ContainsKey("allowMultiple") && (bool)paramObj.allowMultiple;
                param.Description    = paramObj.ContainsKey("description") ? (string)paramObj.description : string.Empty;
                param.Name           = paramObj.ContainsKey("name") ? (string)paramObj.name : string.Empty;
                param.ParameterType  = GetParamType(paramObj);
                param.IsRequired     = paramObj.ContainsKey("required") && (bool)paramObj.required;

                yield return(param);
            }

NoMoreParameters:
            ;
        }
Пример #2
0
 private ParameterDefinition NormalizeParameterDefinition(NormalizationApiOperationParameter normalParam)
 {
     return(new ParameterDefinition(normalParam.AsMetadata())
     {
         DataType = normalParam.AsDataType(),
         IsRequired = normalParam.IsRequired,
         IsVariadic = normalParam.AllowsMultiple,
         Name = normalParam.Name.MapDataTypeName(),
         Type = normalParam.ParameterType
     });
 }
        private IEnumerable<NormalizationApiOperationParameter> ParseParameters(dynamic op)
        {
            if (!op.ContainsKey("parameters")) { goto NoMoreParameters; }

            foreach (var paramObj in op.parameters)
            {
                if (!OperationParameterFilter(paramObj)) continue;
                if (!paramObj.ContainsKey("paramType")) continue;

                var param = new NormalizationApiOperationParameter();
                param.CopyFrom(SimpleNormalizationApiDataType.ParseFromJObject(paramObj));

                param.AllowsMultiple = paramObj.ContainsKey("allowMultiple") && (bool) paramObj.allowMultiple;
                param.Description = paramObj.ContainsKey("description") ? (string) paramObj.description : string.Empty;
                param.Name = paramObj.ContainsKey("name") ? (string) paramObj.name : string.Empty;
                param.ParameterType = GetParamType(paramObj);
                param.IsRequired = paramObj.ContainsKey("required") && (bool) paramObj.required;

                yield return param;
            }

            NoMoreParameters:
            ;
        }
Пример #4
0
 private ParameterDefinition NormalizeParameterDefinition(NormalizationApiOperationParameter normalParam)
 {
     return new ParameterDefinition(normalParam.AsMetadata())
     {
         DataType = normalParam.AsDataType(),
         IsRequired = normalParam.IsRequired,
         IsVariadic = normalParam.AllowsMultiple,
         Name = normalParam.Name.MapDataTypeName(),
         Type = normalParam.ParameterType
     };
 }