-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
My swaggerfile accepts a parameter of type "multipart/form-data". I generate my client class like:
$ react-query-swagger /tanstack /input:http://localhost:5103/swagger/hubapi-v1/swagger.json /output:src/api/QueryClient.ts /template:fetchThe generated code contains the following method in QueryClient.ts (default output file):
uploadTaskAttachment(taskId: number, uploadTaskAttachmentRequest: Blob): Promise<UploadTaskAttachmentResponse> {
let url_ = this.baseUrl + "/api/tasks/{taskId}/attachments/upload";
...which is valid.
However, the generated "Query.ts" file contains an import of the Blob-type, which is invalid code, as "Types" does not contain the definition of Blob. Blob is a standard type that should not be ex nor imported.
import * as Types from '../QueryClient';
...
type UploadTaskAttachment__MutationParameters = UploadTaskAttachmentQueryParameters & {
uploadTaskAttachmentRequest: Types.Blob;
}This may be an issue in NSwag but i'm not sure. Maybe i have another problem in my swagger file. Any hints would be helpful, thanks.
It only happens with multipart/form-data. Other content-types result in (proper) application/json-requests.
swagger json
"/api/tasks/{taskId}/attachments/upload": {
"post": {
"tags": [
"Api"
],
"summary": "Upload an attachment file for a task",
"operationId": "UploadTaskAttachment",
"parameters": [
{
"name": "taskId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"x-name": "UploadTaskAttachmentRequest",
"description": "",
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/UploadTaskAttachmentRequest"
}
}
},
"required": true,
"x-position": 1
},
... Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels