🎉 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
+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'