public void Apply(Operation operation, OperationFilterContext context) { var controllerActionDescriptor = context.ApiDescription.ActionDescriptor as ControllerActionDescriptor; if (controllerActionDescriptor == null) { return; } var commentId = XmlCommentsIdHelper.GetCommentIdForMethod(controllerActionDescriptor.MethodInfo); var methodNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId)); if (methodNode == null) { return; } var summaryNode = methodNode.SelectSingleNode(SummaryXPath); if (summaryNode != null) { operation.Summary = XmlCommentsTextHelper.Humanize(summaryNode.InnerXml); } var remarksNode = methodNode.SelectSingleNode(RemarksXPath); if (remarksNode != null) { operation.Description = XmlCommentsTextHelper.Humanize(remarksNode.InnerXml); } ApplyParamComments(operation, methodNode, context); ApplyResponseComments(operation, methodNode); }
public void Apply(Operation operation, OperationFilterContext context) { var controllerActionDescriptor = context.ApiDescription.ActionDescriptor as ControllerActionDescriptor; if (controllerActionDescriptor == null) { return; } var commentId = XmlCommentsIdHelper.GetCommentIdForMethod(controllerActionDescriptor.MethodInfo); var methodNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, commentId)); if (methodNode != null) { ApplyMethodXmlToOperation(operation, methodNode); ApplyParamsXmlToActionParameters(operation.Parameters, methodNode, context.ApiDescription); ApplyResponsesXmlToResponses(operation.Responses, methodNode.Select(ResponsesXPath)); } // Special handling for parameters that are bound to model properties ApplyPropertiesXmlToPropertyParameters(operation.Parameters, context.ApiDescription); }