【发布时间】:2021-12-30 16:17:59
【问题描述】:
我的天蓝色函数有以下 OpenApi 注释:
using Hl7.Fhir.Model;
[FunctionName("FunctionName")]
[OpenApiOperation(operationId: "OpId", tags: new[] { "Tag" }, Description = "Description to be filled.")]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiRequestBody("text/json", typeof(ProjectModel), Required = true)]
[ApiExplorerSettings(GroupName = "GpName")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, bodyType: typeof(ClassLibraryModel), contentType: "application/json", Description = "The OK response")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "v1.1/apiendpoint")] HttpRequest req,
ILogger log)
{ }
在[OpenApiResponseWithBody] 中,如果我将typeof 与项目本身中的模型一起使用,则会毫无问题地显示出招摇的用户界面。但是,当我使用在顶部使用 using 语句 using Hl7.Fhir.Model 导入的不同模型时,应用程序就会崩溃。任何想法为什么会这样?任何帮助将不胜感激。
没有异常细节,应用程序只是崩溃了。
【问题讨论】:
-
您是否尝试过使用
application/json而不是text/json。另外,您的模型中是否有任何循环引用?你能提供你的模型吗?
标签: c# asp.net-core azure-functions swagger-ui openapi