blog/elysia-14 #622
Replies: 4 comments
-
❤️🔥❤️🔥❤️🔥 |
Beta Was this translation helpful? Give feedback.
0 replies
-
👌👏🚀 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Elysia cha is super cute 🥺 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I tried the import {openapi} from '@elysiajs/openapi'
import {Elysia} from 'elysia'
import {z} from 'zod'
const app = new Elysia().use(openapi()).post('/', ({body}) => body, {
body: z.object({
name: z.literal('Lilith').describe('thing'),
}),
response: {
200: z.object({
name: z.literal('Lilith'),
}),
418: z.object({
error: z.literal("I'm a teapot"),
}),
},
})
console.log(
await app
.handle(new Request('http://localhost/openapi/json'))
.then((res) => res.json().then((spec) => JSON.stringify(spec.paths, null, 2))),
) The output: {
"openapi": "3.0.3",
"info": {
"title": "Elysia Documentation",
"description": "Development documentation",
"version": "0.0.0"
},
"paths": {
"/": {
"post": {
"responses": {}, // <<<--- EMPTY
"operationId": "postIndex"
}
}
},
"components": {
"schemas": {}
}
} Environment and versions:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
blog/elysia-14
Support for Standard Validator. Macro with schema, extension, and OpenAPI detail. Lifecycle type soundness. Improve type inference performance by 10%.
https://elysiajs.com/blog/elysia-14
Beta Was this translation helpful? Give feedback.
All reactions