mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2025-12-06 00:36:10 +00:00
🎉 feat: 0.8.5
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { Elysia } from 'elysia'
|
||||
import { Elysia, InternalRoute } from 'elysia'
|
||||
import { swagger } from '../src/index'
|
||||
import { plugin } from './plugin'
|
||||
import { registerSchemaPath } from '../src/utils'
|
||||
|
||||
const app = new Elysia()
|
||||
.use(
|
||||
swagger({
|
||||
provider: 'scalar',
|
||||
documentation: {
|
||||
info: {
|
||||
title: 'Elysia Scalar',
|
||||
|
||||
@@ -42,44 +42,40 @@ export const plugin = new Elysia({
|
||||
summary: 'Using reference model'
|
||||
}
|
||||
})
|
||||
// .post(
|
||||
// '/json/:id',
|
||||
// ({ body, params: { id }, query: { name } }) => ({
|
||||
// ...body,
|
||||
// id
|
||||
// }),
|
||||
// {
|
||||
// transform({ params }) {
|
||||
// params.id = +params.id
|
||||
// },
|
||||
// schema: {
|
||||
// body: 'sign',
|
||||
// params: t.Object({
|
||||
// id: t.Number()
|
||||
// }),
|
||||
// response: {
|
||||
// 200: t.Object(
|
||||
// {
|
||||
// id: t.Number(),
|
||||
// username: t.String(),
|
||||
// password: t.String()
|
||||
// },
|
||||
// {
|
||||
// title: 'User',
|
||||
// description:
|
||||
// "Contains user's confidential metadata"
|
||||
// }
|
||||
// ),
|
||||
// 400: t.Object({
|
||||
// error: t.String()
|
||||
// })
|
||||
// },
|
||||
// detail: {
|
||||
// summary: 'Transform path parameter'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
.post(
|
||||
'/json/:id',
|
||||
({ body, params: { id }, query: { name } }) => ({
|
||||
...body,
|
||||
id
|
||||
}),
|
||||
{
|
||||
body: 'sign',
|
||||
params: t.Object({
|
||||
id: t.Numeric()
|
||||
}),
|
||||
response: {
|
||||
200: t.Object(
|
||||
{
|
||||
id: t.Number(),
|
||||
username: t.String(),
|
||||
password: t.String()
|
||||
},
|
||||
{
|
||||
title: 'User',
|
||||
description: "Contains user's confidential metadata"
|
||||
}
|
||||
),
|
||||
418: t.Array(
|
||||
t.Object({
|
||||
error: t.String()
|
||||
})
|
||||
),
|
||||
},
|
||||
detail: {
|
||||
summary: 'Complex JSON'
|
||||
}
|
||||
}
|
||||
)
|
||||
.post('/file', ({ body: { file } }) => file, {
|
||||
type: 'formdata',
|
||||
body: t.Object({
|
||||
|
||||
Reference in New Issue
Block a user