mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2025-12-06 00:36:10 +00:00
feat: add schema examples
This commit is contained in:
@@ -44,7 +44,7 @@ export const plugin = new Elysia({
|
||||
})
|
||||
.post(
|
||||
'/json/:id',
|
||||
({ body, params: { id }, query: { name } }) => ({
|
||||
({ body, params: { id }, query: { name, email, } }) => ({
|
||||
...body,
|
||||
id
|
||||
}),
|
||||
@@ -53,6 +53,22 @@ export const plugin = new Elysia({
|
||||
params: t.Object({
|
||||
id: t.Numeric()
|
||||
}),
|
||||
query: t.Object({
|
||||
name: t.String(),
|
||||
email: t.String({
|
||||
description: 'sample email description',
|
||||
format: 'email',
|
||||
examples: ['test@test.com']
|
||||
}),
|
||||
birthday: t.String({
|
||||
description: 'sample birthday description',
|
||||
pattern: '\\d{4}-\\d{2}-\\d{2}',
|
||||
minLength: 10,
|
||||
maxLength: 10,
|
||||
examples: ['2024-01-01']
|
||||
}),
|
||||
gender: t.Union([t.Literal('M'), t.Literal('F')])
|
||||
}),
|
||||
response: {
|
||||
200: t.Object(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user