-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat-swaggerui-options
- Loading branch information
Showing
10 changed files
with
271 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'npm' | ||
directory: './' | ||
schedule: | ||
interval: 'daily' | ||
|
||
- package-ecosystem: 'github-actions' | ||
directory: './' | ||
schedule: | ||
interval: 'daily' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Code CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
name: Build and test code | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install packages | ||
run: bun install | ||
|
||
- name: Build code | ||
run: bun run build | ||
|
||
- name: Test | ||
run: bun run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,103 @@ | ||
import { Elysia, t } from 'elysia' | ||
|
||
export const plugin = (app: Elysia) => | ||
app.group( | ||
'/a', | ||
(app) => | ||
app | ||
.model({ | ||
sign: t.Object( | ||
{ | ||
username: t.String(), | ||
password: t.String() | ||
}, | ||
{ | ||
description: 'Models for handling authentication' | ||
} | ||
), | ||
number: t.Number() | ||
}) | ||
.get('/', ({ set }) => 'hi', { | ||
detail: { | ||
summary: 'Ping Pong', | ||
description: 'Lorem Ipsum Dolar', | ||
tags: ['Test'] | ||
} | ||
}) | ||
.get('/unpath/:id', ({ params: { id } }) => id, { | ||
params: t.Object({ | ||
id: t.String({ | ||
description: 'Extract value from path parameter' | ||
}) | ||
}), | ||
detail: { | ||
deprecated: true | ||
} | ||
}) | ||
.post('/json', ({ body }) => body, { | ||
type: 'json', | ||
body: 'sign', | ||
response: { | ||
200: 'sign' | ||
}, | ||
detail: { | ||
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('/file', ({ body: { file } }) => file, { | ||
body: t.Object({ | ||
file: t.File({ | ||
type: ['image/jpeg', 'image/'], | ||
minSize: '1k', | ||
maxSize: '5m' | ||
}) | ||
}), | ||
response: t.File() | ||
}) | ||
// .post('/files', ({ body: { files } }) => files[0], { | ||
// schema: { | ||
// body: t.Object({ | ||
// files: t.Files({ | ||
// type: 'image', | ||
// maxSize: '5m' | ||
// }) | ||
// }), | ||
// response: t.File() | ||
// } | ||
// }) | ||
) | ||
export const plugin = new Elysia({ | ||
prefix: '/a' | ||
}) | ||
.model({ | ||
sign: t.Object( | ||
{ | ||
username: t.String(), | ||
password: t.String() | ||
}, | ||
{ | ||
description: 'Models for handling authentication' | ||
} | ||
), | ||
number: t.Number() | ||
}) | ||
.get('/', ({ set }) => 'hi', { | ||
detail: { | ||
summary: 'Ping Pong', | ||
description: 'Lorem Ipsum Dolar', | ||
tags: ['Test'] | ||
} | ||
}) | ||
.get('/unpath/:id', ({ params: { id } }) => id, { | ||
params: t.Object({ | ||
id: t.String({ | ||
description: 'Extract value from path parameter' | ||
}) | ||
}), | ||
detail: { | ||
deprecated: true | ||
} | ||
}) | ||
.post('/json', ({ body }) => body, { | ||
type: 'json', | ||
body: 'sign', | ||
response: { | ||
200: 'sign' | ||
}, | ||
detail: { | ||
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('/file', ({ body: { file } }) => file, { | ||
body: t.Object({ | ||
file: t.File({ | ||
type: ['image/jpeg', 'image/'], | ||
minSize: '1k', | ||
maxSize: '5m' | ||
}) | ||
}), | ||
response: t.File() | ||
}) | ||
// .post('/files', ({ body: { files } }) => files[0], { | ||
// schema: { | ||
// body: t.Object({ | ||
// files: t.Files({ | ||
// type: 'image', | ||
// maxSize: '5m' | ||
// }) | ||
// }), | ||
// response: t.File() | ||
// } | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
{ | ||
"name": "@elysiajs/swagger", | ||
"version": "0.6.2", | ||
"description": "Plugin for Elysia to auto-generate Swagger page", | ||
"author": { | ||
"name": "saltyAom", | ||
"url": "https://github.com/SaltyAom", | ||
"email": "saltyaom@gmail.com" | ||
}, | ||
"main": "./dist/index.js", | ||
"exports": { | ||
"bun": "./dist/index.js", | ||
"node": "./dist/cjs/index.js", | ||
"require": "./dist/cjs/index.js", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"types": "./src/index.ts", | ||
"keywords": [ | ||
"elysia", | ||
"swagger" | ||
], | ||
"homepage": "https://github.com/elysiajs/elysia-swagger", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/elysiajs/elysia-swagger" | ||
}, | ||
"bugs": "https://github.com/elysiajs/elysia-swagger/issues", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "bun run --watch example/index.ts", | ||
"test": "bun test && npm run test:node", | ||
"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", | ||
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", | ||
"release": "npm run build && npm run test && npm publish --access public" | ||
}, | ||
"peerDependencies": { | ||
"elysia": ">= 0.6.7" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.1.4", | ||
"bun-types": "^0.7.0", | ||
"elysia": "^0.6.20", | ||
"eslint": "^8.40.0", | ||
"rimraf": "4.3", | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@types/lodash.clonedeep": "^4.5.7", | ||
"@types/swagger-ui": "^3.52.0", | ||
"lodash.clonedeep": "^4.5.0" | ||
} | ||
"name": "@elysiajs/swagger", | ||
"version": "0.7.2", | ||
"description": "Plugin for Elysia to auto-generate Swagger page", | ||
"author": { | ||
"name": "saltyAom", | ||
"url": "https://github.com/SaltyAom", | ||
"email": "saltyaom@gmail.com" | ||
}, | ||
"main": "./dist/index.js", | ||
"exports": { | ||
"bun": "./dist/index.js", | ||
"node": "./dist/cjs/index.js", | ||
"require": "./dist/cjs/index.js", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"types": "./src/index.ts", | ||
"keywords": [ | ||
"elysia", | ||
"swagger" | ||
], | ||
"homepage": "https://github.com/elysiajs/elysia-swagger", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/elysiajs/elysia-swagger" | ||
}, | ||
"bugs": "https://github.com/elysiajs/elysia-swagger/issues", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "bun run --watch example/index.ts", | ||
"test": "bun test && npm run test:node", | ||
"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", | ||
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", | ||
"release": "npm run build && npm run test && npm publish --access public" | ||
}, | ||
"peerDependencies": { | ||
"elysia": ">= 0.7.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.1.4", | ||
"bun-types": "^0.7.0", | ||
"elysia": "0.7.5", | ||
"eslint": "^8.40.0", | ||
"rimraf": "4.3", | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@types/lodash.clonedeep": "^4.5.7", | ||
"lodash.clonedeep": "^4.5.0", | ||
"openapi-types": "^12.1.3" | ||
} | ||
} |
Oops, something went wrong.