public static BaseOutputClass ParseRequestBody(DocumentRequestBody requestBody, List <BaseOutputClass> baseOutputClasses)
        {
            if (requestBody == null)
            {
                return(null);
            }
            var request = requestBody.Content["application/json"];

            if (request != null && request.Schema != null)
            {
                return(ClassFactory.GetClassDefinition(request.Schema, baseOutputClasses));
            }
            return(null);
        }
Esempio n. 2
0
 internal BaseOutputClass CreateDefinitionWithDeep(DocumentSchema schema, List <BaseOutputClass> list)
 {
     if (schema.Enum != null)
     {
         return(ClassFactory.GetClassDefinition(schema));
     }
     else
     {
         //create class
         var @class = new OutputClass()
         {
         };
         @class.SetType(schema);
         @class.SetProperties(this, list, schema);
         @class.SetInnerClass(this, list, schema);
         return(@class);
     }
 }
        public static List <OutputServiceActionParameter> ParseParameters(List <DocumentParameter> parameters, List <BaseOutputClass> baseOutputClasses)
        {
            var list = new List <OutputServiceActionParameter>();

            if (parameters != null && parameters.Count > 0)
            {
                foreach (var parameter in parameters)
                {
                    list.Add(new OutputServiceActionParameter()
                    {
                        Name     = parameter.Name,
                        Required = parameter.Required,
                        Class    = ClassFactory.GetClassDefinition(parameter.Schema, baseOutputClasses)
                    });
                }
            }
            return(list);
        }
        public static List <OutputResponse> ParseResponses(Dictionary <string, DocumentResponse> responses, List <BaseOutputClass> baseOutputClasses)
        {
            var list = new List <OutputResponse>();

            foreach (var response in responses)
            {
                if (response.Value.Content != null)
                {
                    var schema = response.Value.Content["application/json"].Schema;
                    var item   = new OutputResponse()
                    {
                        Code  = Int32.Parse(response.Key),
                        Class = ClassFactory.GetClassDefinition(schema, baseOutputClasses)
                    };
                    list.Add(item);
                }
            }

            return(list);
        }