🎉 feat: add swagger and documentation

This commit is contained in:
saltyaom
2023-01-24 01:54:37 +07:00
parent 376c7e4efd
commit a6b7d1f598
3 changed files with 27 additions and 8 deletions
BIN
View File
Binary file not shown.
+26 -7
View File
@@ -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
View File
@@ -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": {