Open
Description
I'm using the example from https://elysiajs.com/eden/treaty/parameters.html#file-upload
import { Elysia, t } from "elysia";
import swagger from "@elysiajs/swagger";
const app = new Elysia()
.post(
"/image",
({ body: { image, title } }) => {
console.info(title, image);
},
{
body: t.Object({
title: t.String(),
image: t.Files(),
}),
}
)
.use(swagger())
.listen(3001);
console.log(`🦊 Elysia is running at http://${app.server?.hostname}:${app.server?.port}/swagger`);
How can I restrict the openapi content type to just multipart/form-data
? Note: I tried parse: "multipart/form-data"
and nothing changed
Currently it generates the following json, notice the content
below
{
"openapi": "3.0.3",
"info": {
"title": "Elysia Documentation",
"description": "Development documentation",
"version": "0.0.0"
},
"paths": {
"/image": {
"post": {
"parameters": [],
"operationId": "postImage",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"image": {
"elysiaMeta": "Files",
"default": "Files",
"type": "array",
"items": {
"default": "Files",
"type": "string",
"format": "binary"
}
}
},
"required": [
"title",
"image"
]
}
},
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"image": {
"elysiaMeta": "Files",
"default": "Files",
"type": "array",
"items": {
"default": "Files",
"type": "string",
"format": "binary"
}
}
},
"required": [
"title",
"image"
]
}
},
"text/plain": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"image": {
"elysiaMeta": "Files",
"default": "Files",
"type": "array",
"items": {
"default": "Files",
"type": "string",
"format": "binary"
}
}
},
"required": [
"title",
"image"
]
}
}
}
},
"responses": {
"200": {}
}
}
}
},
"components": {
"schemas": {}
}
}
Found the issue
Lines 154 to 158 in 65b20fc
The issue is that the type
doesn't exist on LocalHook
anymore, it was replaced by parse
Metadata
Metadata
Assignees
Labels
No labels