Ejemplo n.º 1
0
        private bool GenerateServices()
        {
            Service service = new Service ();

            foreach (string path in swaggerDocument.paths.Keys)
            {

                PathItem pathItem = swaggerDocument.paths [path];

                foreach (var verb in pathItem.GetOperations().Keys)
                {
                    var operation = pathItem.GetOperations () [verb];

                    var methodGroup = operation.GetMethodGroup();
                    var methodName = operation.GetMethodName();

                    ServiceOperation serviceOperation = new ServiceOperation () {
                        Path = path,
                        MethodName = methodName,
                        HttpMethod = verb
                    };

                    service.Add (methodGroup, serviceOperation);

                }

            }
            return true;
        }
Ejemplo n.º 2
0
        public void Add(string methodGroup, ServiceOperation operation)
        {
            if (methodGroup == null)
                methodGroup = "";

            if (!Operations.ContainsKey (methodGroup)) {
                Operations.Add (methodGroup, new List<ServiceOperation> ());
            }

            var methods = Operations [methodGroup];

            methods.Add (operation);
        }