Beispiel #1
0
        internal void Add(MethodInfo method, Dictionary <string, List <Attribute> > methodAttr)
        {
            var parameters = method.GetParameters().ToList();
            var doc        = _scope.XmlDocs.GetDoc(method);
            var operation  = new Operation
            {
                Description = doc?.Summary,
                Deprecated  = methodAttr.ContainsKey(OBSOLETE_ATTRIBUTE),
                Parameters  = parameters
                              .Select(p => ParameterGenerator.CreateParameter(p, _httpPath, _schemaGenerator, doc))
                              .ToList(),
                OperationId = GetOperationId(method),
                Responses   = GetResponses(method, methodAttr, doc).ToDictionary(r => r.Item1, r => r.Item2)
            };

            operation.Tags.Add(method.DeclaringType.Name.Replace("Controller", string.Empty).ToCamelCase());
            AddOperation(methodAttr, operation);
        }