From 4aa3936754697df842c43cf29a6b0e257e67c1fe Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Wed, 20 Apr 2022 11:10:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=82=E6=AD=A5=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E8=BF=94=E5=9B=9E=E6=A8=A1=E5=9E=8B=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiDefinistions/ApiResponseTypeModelProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Falcon.SugarApi/ApiDefinistions/ApiResponseTypeModelProvider.cs b/Falcon.SugarApi/ApiDefinistions/ApiResponseTypeModelProvider.cs index 917cf0e..fdb8346 100644 --- a/Falcon.SugarApi/ApiDefinistions/ApiResponseTypeModelProvider.cs +++ b/Falcon.SugarApi/ApiDefinistions/ApiResponseTypeModelProvider.cs @@ -28,8 +28,8 @@ namespace Falcon.SugarApi.ApiDefinistions } var art = action.ActionMethod.ReturnType; Type returnType = - art.IsGenericType && art.IsAssignableFrom(typeof(Task<>)) ? art.GenericTypeArguments[0].GetGenericArguments()[0] : - art; + art.IsGenericType && art.GetGenericTypeDefinition() == typeof(Task<>) ? + art.GenericTypeArguments[0] : art; action.Filters.Add(new ProducesResponseTypeAttribute(returnType, StatusCodes.Status200OK)); action.Filters.Add(new ProducesResponseTypeAttribute(typeof(ExceptionModel), StatusCodes.Status400BadRequest)); }