multipart/form-data
Opened this issue · 1 comments
Stono commented
Hi,
This is an extension of the closed question: #69
I'm trying to migrate away from the nestjs
swagger annotations to using zod instead, which on the whole is working - apart from multipart-form.
So previously I had:
export class ImageClassificationRequest {
@ApiProperty({
enum: availableClassificationModels,
type: String,
description: 'The model to use for image classification'
})
public model!: KnownImageClassificationModel
@ApiProperty({
type: 'string',
format: 'binary'
})
public image!: string
}
In swagger I get a file input:
However if i try and use binary format string with zod:
const binarySchema = extendApi(z.string(), {
format: 'binary'
})
export class ImageClassificationRequest extends createZodDto(
z.strictObject({
model: classificationModelsZodType.describe(
'The model to use for image classification'
),
image: binarySchema.describe('The image to classify')
})
) {}
Swagger just becomes a string:
Any help would be appreciated!
ooxx5626 commented
The same question!