public void Apply(OpenApiOperation operation, OperationFilterContext context) { if (context.MethodInfo == null) { return; } // If method is from a constructed generic type, look for comments from the generic type method var targetMethod = context.MethodInfo.DeclaringType.IsConstructedGenericType ? GetGenericTypeMethodOrNullFor(context.MethodInfo) : context.MethodInfo; if (targetMethod == null) { return; } var memberName = XmlCommentsMemberNameHelper.GetMemberNameForMethod(targetMethod); var methodNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, memberName)); 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); }
public void Apply(Operation operation, OperationFilterContext context) { var controllerActionDescriptor = context.ApiDescription.ActionDescriptor as ControllerActionDescriptor; if (controllerActionDescriptor == null) { return; } var memberName = XmlCommentsMemberNameHelper.GetMemberNameForMethod(controllerActionDescriptor.MethodInfo); var methodNode = _xmlNavigator.SelectSingleNode(string.Format(MemberXPath, memberName)); 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); }