@elysiajs/swagger
Advanced tools
Comparing version 0.6.2 to 0.7.0-beta.0
import { type Elysia } from 'elysia'; | ||
import type { ElysiaSwaggerConfig } from './types'; | ||
export declare const swagger: <Path extends string = "/swagger">({ documentation, version, excludeStaticFile, path, exclude }?: ElysiaSwaggerConfig<Path>) => (app: Elysia) => Elysia<"", { | ||
store: {}; | ||
request: {}; | ||
schema: {}; | ||
error: {}; | ||
meta: { | ||
schema: {}; | ||
defs: {}; | ||
exposed: {}; | ||
}; | ||
}>; | ||
export declare const swagger: <Path extends string = "/swagger">({ documentation, version, excludeStaticFile, path, exclude }?: ElysiaSwaggerConfig<Path>) => (app: Elysia<any, any, any, any, any, any>) => Elysia<any, any, any, any, any, any>; | ||
export default swagger; |
@@ -54,3 +54,3 @@ "use strict"; | ||
}); | ||
}).route('GET', `${path}/json`, () => { | ||
}).get(`${path}/json`, () => { | ||
const routes = app.routes; | ||
@@ -65,3 +65,3 @@ if (routes.length !== totalRoutes) { | ||
path: route.path, | ||
models: app.meta.defs, | ||
models: app.definitions, | ||
contentType: route.hooks.type | ||
@@ -89,3 +89,3 @@ }); | ||
schemas: { | ||
...app.meta.defs, | ||
...app.definitions, | ||
...documentation.components?.schemas | ||
@@ -92,0 +92,0 @@ } |
@@ -13,3 +13,3 @@ import type { HTTPMethod, LocalHook } from 'elysia'; | ||
method: HTTPMethod; | ||
hook?: LocalHook<any, any> | undefined; | ||
hook?: LocalHook<any, any>; | ||
models: Record<string, TSchema>; | ||
@@ -16,0 +16,0 @@ }) => void; |
@@ -97,2 +97,4 @@ "use strict"; | ||
if (typeof value === 'string') { | ||
if (!models[value]) | ||
return; | ||
const { type, properties, required, ...rest } = models[value]; | ||
@@ -99,0 +101,0 @@ responseSchema[key] = { |
import { type Elysia } from 'elysia'; | ||
import type { ElysiaSwaggerConfig } from './types'; | ||
export declare const swagger: <Path extends string = "/swagger">({ documentation, version, excludeStaticFile, path, exclude }?: ElysiaSwaggerConfig<Path>) => (app: Elysia) => Elysia<"", { | ||
store: {}; | ||
request: {}; | ||
schema: {}; | ||
error: {}; | ||
meta: { | ||
schema: {}; | ||
defs: {}; | ||
exposed: {}; | ||
}; | ||
}>; | ||
export declare const swagger: <Path extends string = "/swagger">({ documentation, version, excludeStaticFile, path, exclude }?: ElysiaSwaggerConfig<Path>) => (app: Elysia<any, any, any, any, any, any>) => Elysia<any, any, any, any, any, any>; | ||
export default swagger; |
@@ -51,3 +51,3 @@ import { filterPaths, registerSchemaPath } from './utils'; | ||
}); | ||
}).route('GET', `${path}/json`, () => { | ||
}).get(`${path}/json`, () => { | ||
const routes = app.routes; | ||
@@ -62,3 +62,3 @@ if (routes.length !== totalRoutes) { | ||
path: route.path, | ||
models: app.meta.defs, | ||
models: app.definitions, | ||
contentType: route.hooks.type | ||
@@ -86,3 +86,3 @@ }); | ||
schemas: { | ||
...app.meta.defs, | ||
...app.definitions, | ||
...documentation.components?.schemas | ||
@@ -89,0 +89,0 @@ } |
@@ -13,3 +13,3 @@ import type { HTTPMethod, LocalHook } from 'elysia'; | ||
method: HTTPMethod; | ||
hook?: LocalHook<any, any> | undefined; | ||
hook?: LocalHook<any, any>; | ||
models: Record<string, TSchema>; | ||
@@ -16,0 +16,0 @@ }) => void; |
@@ -87,2 +87,4 @@ import { Kind } from '@sinclair/typebox'; | ||
if (typeof value === 'string') { | ||
if (!models[value]) | ||
return; | ||
const { type, properties, required, ...rest } = models[value]; | ||
@@ -89,0 +91,0 @@ responseSchema[key] = { |
102
package.json
{ | ||
"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", | ||
"lodash.clonedeep": "^4.5.0" | ||
} | ||
} | ||
"name": "@elysiajs/swagger", | ||
"version": "0.7.0-beta.0", | ||
"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-beta.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.1.4", | ||
"bun-types": "^0.7.0", | ||
"elysia": "0.7.0-beta.0", | ||
"eslint": "^8.40.0", | ||
"rimraf": "4.3", | ||
"typescript": "^5.0.4" | ||
}, | ||
"dependencies": { | ||
"@types/lodash.clonedeep": "^4.5.7", | ||
"lodash.clonedeep": "^4.5.0" | ||
} | ||
} |
@@ -29,3 +29,3 @@ import { type Elysia, type InternalRoute } from 'elysia' | ||
) => | ||
(app: Elysia) => { | ||
(app: Elysia<any, any, any, any, any, any>) => { | ||
const schema = {} | ||
@@ -78,3 +78,3 @@ let totalRoutes = 0 | ||
) | ||
}).route('GET', `${path}/json`, () => { | ||
}).get(`${path}/json`, () => { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
@@ -87,3 +87,3 @@ // @ts-ignore | ||
routes.forEach((route: InternalRoute<any>) => { | ||
routes.forEach((route: InternalRoute) => { | ||
registerSchemaPath({ | ||
@@ -94,3 +94,4 @@ schema, | ||
path: route.path, | ||
models: app.meta.defs, | ||
// @ts-ignore | ||
models: app.definitions, | ||
contentType: route.hooks.type | ||
@@ -119,3 +120,4 @@ }) | ||
schemas: { | ||
...app.meta.defs, | ||
// @ts-ignore | ||
...app.definitions, | ||
...documentation.components?.schemas | ||
@@ -122,0 +124,0 @@ } |
@@ -145,2 +145,4 @@ import type { HTTPMethod, LocalHook } from 'elysia' | ||
if (typeof value === 'string') { | ||
if(!models[value]) return | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
@@ -147,0 +149,0 @@ const { type, properties, required, ...rest } = models[ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42849
1072