mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2026-06-01 21:35:21 +00:00
🎉 feat: add swagger and documentation
This commit is contained in:
+26
-7
@@ -27,8 +27,11 @@ const app = new Elysia()
|
||||
})
|
||||
.get('/unpath/:id', ({ params: { id } }) => id, {
|
||||
schema: {
|
||||
params: t.Object({
|
||||
id: t.String({ description: 'ID to get' })
|
||||
}),
|
||||
detail: {
|
||||
deprecated: false
|
||||
deprecated: true
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -41,16 +44,32 @@ const app = new Elysia()
|
||||
{
|
||||
schema: {
|
||||
body: 'sign',
|
||||
response: t.Object({
|
||||
username: t.String(),
|
||||
password: t.String(),
|
||||
id: t.String()
|
||||
})
|
||||
response: {
|
||||
200: t.Object(
|
||||
{
|
||||
username: t.String({
|
||||
title: 'A'
|
||||
}),
|
||||
password: t.String(),
|
||||
id: t.String()
|
||||
},
|
||||
{
|
||||
description: 'A',
|
||||
title: 'A'
|
||||
}
|
||||
),
|
||||
400: t.Object({
|
||||
error: t.String()
|
||||
})
|
||||
},
|
||||
detail: {
|
||||
summary: 'A'
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
.get('/unpath/:id/:name', ({ params: { id } }) => id)
|
||||
.post('/json', ({ body }) => '1', {
|
||||
.post('/json', ({ body }) => body, {
|
||||
schema: {
|
||||
body: 'sign',
|
||||
response: 'sign'
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
"@types/swagger-ui-dist": "^3.30.1",
|
||||
"bun-types": "^0.5.0",
|
||||
"eslint": "^8.26.0",
|
||||
"elysia": "^0.2.0-rc.0",
|
||||
"elysia": "../elysia",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user