Skip to content

Commit c726674

Browse files
authored
Merge branch 'main' into feat-swaggerui-options
2 parents b58f637 + 929c08d commit c726674

File tree

10 files changed

+271
-163
lines changed

10 files changed

+271
-163
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: './'
5+
schedule:
6+
interval: 'daily'
7+
8+
- package-ecosystem: 'github-actions'
9+
directory: './'
10+
schedule:
11+
interval: 'daily'

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Code CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
name: Build and test code
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup bun
17+
uses: oven-sh/setup-bun@v1
18+
with:
19+
bun-version: latest
20+
21+
- name: Install packages
22+
run: bun install
23+
24+
- name: Build code
25+
run: bun run build
26+
27+
- name: Test
28+
run: bun run test

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# 0.7.2 - 21 Sep 2023
2+
Bug fix:
3+
- Paths is undefined
4+
- Models is not showing
5+
6+
# 0.7.1 - 20 Sep 2023
7+
Bug fix:
8+
- Add openapi-types as dependencies
9+
- Fix `any` returned type
10+
11+
# 0.7.0 - 20 Sep 2023
12+
- Add support for Elysia 0.
13+
14+
# 0.7.0-beta.0 - 18 Sep 2023
15+
- Add support for Elysia 0.7
16+
117
# 0.6.2 - 11 Sep 2023
218
- Ship lodash.cloneDeep type
319

bun.lockb

655 Bytes
Binary file not shown.

example/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const app = new Elysia({
1010
documentation: {
1111
info: {
1212
title: 'Elysia',
13-
version: '0.6.10'
13+
version: '0.7.0'
1414
},
1515
tags: [
1616
{

example/plugin.ts

Lines changed: 101 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,103 @@
11
import { Elysia, t } from 'elysia'
22

3-
export const plugin = (app: Elysia) =>
4-
app.group(
5-
'/a',
6-
(app) =>
7-
app
8-
.model({
9-
sign: t.Object(
10-
{
11-
username: t.String(),
12-
password: t.String()
13-
},
14-
{
15-
description: 'Models for handling authentication'
16-
}
17-
),
18-
number: t.Number()
19-
})
20-
.get('/', ({ set }) => 'hi', {
21-
detail: {
22-
summary: 'Ping Pong',
23-
description: 'Lorem Ipsum Dolar',
24-
tags: ['Test']
25-
}
26-
})
27-
.get('/unpath/:id', ({ params: { id } }) => id, {
28-
params: t.Object({
29-
id: t.String({
30-
description: 'Extract value from path parameter'
31-
})
32-
}),
33-
detail: {
34-
deprecated: true
35-
}
36-
})
37-
.post('/json', ({ body }) => body, {
38-
type: 'json',
39-
body: 'sign',
40-
response: {
41-
200: 'sign'
42-
},
43-
detail: {
44-
summary: 'Using reference model'
45-
}
46-
})
47-
// .post(
48-
// '/json/:id',
49-
// ({ body, params: { id }, query: { name } }) => ({
50-
// ...body,
51-
// id
52-
// }),
53-
// {
54-
// transform({ params }) {
55-
// params.id = +params.id
56-
// },
57-
// schema: {
58-
// body: 'sign',
59-
// params: t.Object({
60-
// id: t.Number()
61-
// }),
62-
// response: {
63-
// 200: t.Object(
64-
// {
65-
// id: t.Number(),
66-
// username: t.String(),
67-
// password: t.String()
68-
// },
69-
// {
70-
// title: 'User',
71-
// description:
72-
// "Contains user's confidential metadata"
73-
// }
74-
// ),
75-
// 400: t.Object({
76-
// error: t.String()
77-
// })
78-
// },
79-
// detail: {
80-
// summary: 'Transform path parameter'
81-
// }
82-
// }
83-
// }
84-
// )
85-
.post('/file', ({ body: { file } }) => file, {
86-
body: t.Object({
87-
file: t.File({
88-
type: ['image/jpeg', 'image/'],
89-
minSize: '1k',
90-
maxSize: '5m'
91-
})
92-
}),
93-
response: t.File()
94-
})
95-
// .post('/files', ({ body: { files } }) => files[0], {
96-
// schema: {
97-
// body: t.Object({
98-
// files: t.Files({
99-
// type: 'image',
100-
// maxSize: '5m'
101-
// })
102-
// }),
103-
// response: t.File()
104-
// }
105-
// })
106-
)
3+
export const plugin = new Elysia({
4+
prefix: '/a'
5+
})
6+
.model({
7+
sign: t.Object(
8+
{
9+
username: t.String(),
10+
password: t.String()
11+
},
12+
{
13+
description: 'Models for handling authentication'
14+
}
15+
),
16+
number: t.Number()
17+
})
18+
.get('/', ({ set }) => 'hi', {
19+
detail: {
20+
summary: 'Ping Pong',
21+
description: 'Lorem Ipsum Dolar',
22+
tags: ['Test']
23+
}
24+
})
25+
.get('/unpath/:id', ({ params: { id } }) => id, {
26+
params: t.Object({
27+
id: t.String({
28+
description: 'Extract value from path parameter'
29+
})
30+
}),
31+
detail: {
32+
deprecated: true
33+
}
34+
})
35+
.post('/json', ({ body }) => body, {
36+
type: 'json',
37+
body: 'sign',
38+
response: {
39+
200: 'sign'
40+
},
41+
detail: {
42+
summary: 'Using reference model'
43+
}
44+
})
45+
// .post(
46+
// '/json/:id',
47+
// ({ body, params: { id }, query: { name } }) => ({
48+
// ...body,
49+
// id
50+
// }),
51+
// {
52+
// transform({ params }) {
53+
// params.id = +params.id
54+
// },
55+
// schema: {
56+
// body: 'sign',
57+
// params: t.Object({
58+
// id: t.Number()
59+
// }),
60+
// response: {
61+
// 200: t.Object(
62+
// {
63+
// id: t.Number(),
64+
// username: t.String(),
65+
// password: t.String()
66+
// },
67+
// {
68+
// title: 'User',
69+
// description:
70+
// "Contains user's confidential metadata"
71+
// }
72+
// ),
73+
// 400: t.Object({
74+
// error: t.String()
75+
// })
76+
// },
77+
// detail: {
78+
// summary: 'Transform path parameter'
79+
// }
80+
// }
81+
// }
82+
// )
83+
.post('/file', ({ body: { file } }) => file, {
84+
body: t.Object({
85+
file: t.File({
86+
type: ['image/jpeg', 'image/'],
87+
minSize: '1k',
88+
maxSize: '5m'
89+
})
90+
}),
91+
response: t.File()
92+
})
93+
// .post('/files', ({ body: { files } }) => files[0], {
94+
// schema: {
95+
// body: t.Object({
96+
// files: t.Files({
97+
// type: 'image',
98+
// maxSize: '5m'
99+
// })
100+
// }),
101+
// response: t.File()
102+
// }
103+
// })

package.json

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
{
2-
"name": "@elysiajs/swagger",
3-
"version": "0.6.2",
4-
"description": "Plugin for Elysia to auto-generate Swagger page",
5-
"author": {
6-
"name": "saltyAom",
7-
"url": "https://github.com/SaltyAom",
8-
"email": "[email protected]"
9-
},
10-
"main": "./dist/index.js",
11-
"exports": {
12-
"bun": "./dist/index.js",
13-
"node": "./dist/cjs/index.js",
14-
"require": "./dist/cjs/index.js",
15-
"import": "./dist/index.js",
16-
"default": "./dist/index.js"
17-
},
18-
"types": "./src/index.ts",
19-
"keywords": [
20-
"elysia",
21-
"swagger"
22-
],
23-
"homepage": "https://github.com/elysiajs/elysia-swagger",
24-
"repository": {
25-
"type": "git",
26-
"url": "https://github.com/elysiajs/elysia-swagger"
27-
},
28-
"bugs": "https://github.com/elysiajs/elysia-swagger/issues",
29-
"license": "MIT",
30-
"scripts": {
31-
"dev": "bun run --watch example/index.ts",
32-
"test": "bun test && npm run test:node",
33-
"test:node": "npm install --prefix ./test/node/cjs/ && npm install --prefix ./test/node/esm/ && node ./test/node/cjs/index.js && node ./test/node/esm/index.js",
34-
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
35-
"release": "npm run build && npm run test && npm publish --access public"
36-
},
37-
"peerDependencies": {
38-
"elysia": ">= 0.6.7"
39-
},
40-
"devDependencies": {
41-
"@types/node": "^20.1.4",
42-
"bun-types": "^0.7.0",
43-
"elysia": "^0.6.20",
44-
"eslint": "^8.40.0",
45-
"rimraf": "4.3",
46-
"typescript": "^5.0.4"
47-
},
48-
"dependencies": {
49-
"@types/lodash.clonedeep": "^4.5.7",
50-
"@types/swagger-ui": "^3.52.0",
51-
"lodash.clonedeep": "^4.5.0"
52-
}
2+
"name": "@elysiajs/swagger",
3+
"version": "0.7.2",
4+
"description": "Plugin for Elysia to auto-generate Swagger page",
5+
"author": {
6+
"name": "saltyAom",
7+
"url": "https://github.com/SaltyAom",
8+
"email": "[email protected]"
9+
},
10+
"main": "./dist/index.js",
11+
"exports": {
12+
"bun": "./dist/index.js",
13+
"node": "./dist/cjs/index.js",
14+
"require": "./dist/cjs/index.js",
15+
"import": "./dist/index.js",
16+
"default": "./dist/index.js"
17+
},
18+
"types": "./src/index.ts",
19+
"keywords": [
20+
"elysia",
21+
"swagger"
22+
],
23+
"homepage": "https://github.com/elysiajs/elysia-swagger",
24+
"repository": {
25+
"type": "git",
26+
"url": "https://github.com/elysiajs/elysia-swagger"
27+
},
28+
"bugs": "https://github.com/elysiajs/elysia-swagger/issues",
29+
"license": "MIT",
30+
"scripts": {
31+
"dev": "bun run --watch example/index.ts",
32+
"test": "bun test && npm run test:node",
33+
"test:node": "npm install --prefix ./test/node/cjs/ && npm install --prefix ./test/node/esm/ && node ./test/node/cjs/index.js && node ./test/node/esm/index.js",
34+
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
35+
"release": "npm run build && npm run test && npm publish --access public"
36+
},
37+
"peerDependencies": {
38+
"elysia": ">= 0.7.0"
39+
},
40+
"devDependencies": {
41+
"@types/node": "^20.1.4",
42+
"bun-types": "^0.7.0",
43+
"elysia": "0.7.5",
44+
"eslint": "^8.40.0",
45+
"rimraf": "4.3",
46+
"typescript": "^5.0.4"
47+
},
48+
"dependencies": {
49+
"@types/lodash.clonedeep": "^4.5.7",
50+
"lodash.clonedeep": "^4.5.0",
51+
"openapi-types": "^12.1.3"
52+
}
5353
}

0 commit comments

Comments
 (0)