Openapi 3.0 nSwag C#服务器-文件上载
我有以下问题: 我的C#服务器存根是使用OpenApi 3.0使用nSwag(13.10.6.0)生成的Openapi 3.0 nSwag C#服务器-文件上载,c#,openapi,nswag,C#,Openapi,Nswag,我有以下问题: 我的C#服务器存根是使用OpenApi 3.0使用nSwag(13.10.6.0)生成的 /images/upload: post: requestBody: content: image/*: schema: type: string format: binary responses: '200':
/images/upload:
post:
requestBody:
content:
image/*:
schema:
type: string
format: binary
responses:
'200':
description: Uploaded
tags:
- image
这将生成以下代码:
System.Threading.Tasks.Task UploadAsync(Microsoft.AspNetCore.Http.iform文件体)代码>
但这并不使用原始文件作为参数,而是使用多部分/表单数据
然后我试了一下:
/images/upload:
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
responses:
'200':
description: Uploaded
tags:
- image
这将产生以下结果:
System.Threading.Tasks.Task UploadAsync(FileParameter文件)代码>
这导致了错误:
Could not create an instance of type 'Hub.Build.Api.FileParameter'. Model bound complex types must not be abstract or value types and must have a parameterless constructor. Record types must have a single primary constructor. Alternatively, give the 'body' parameter a non-null default value.