Skip to content

Support for File Upload #1214

Open
Open
@kollolsb

Description

@kollolsb

Description

In OpenAPI 3.0 we can describe the schema for files uploaded directly or as multipart:

      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                orderId:
                  type: integer
                userId:
                  type: integer
                file:
                  type: string
                  format: binary

The binary format indicates a File type object. However, the typescript interface generated by the library sets this property to string:

{
...
 /** Format: binary */
 file: string
}

Proposal

The type of the property should be set to File:

{
...
 /** Format: binary */
 file: File
}

NOTE: For reference the openapi-generator for typescript correctly sets the type to File but doesn't support OpenAPI 3.0

Checklist

Similar to #1123

Metadata

Metadata

Assignees

Labels

PRs welcomePRs are welcome to solve this issue!enhancementNew feature or requestopenapi-tsRelevant to the openapi-typescript library

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions