@elysiajs/swagger
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,12 +0,51 @@ | ||
import { type Elysia } from 'elysia'; | ||
/// <reference types="bun-types" /> | ||
import { type Elysia, SCHEMA } from 'elysia'; | ||
import type { OpenAPIV2 } from 'openapi-types'; | ||
import type { ElysiaSwaggerConfig } from './types'; | ||
export declare const swagger: ({ swagger, excludeStaticFile, path, exclude }?: ElysiaSwaggerConfig) => (app: Elysia) => Elysia<import("elysia").ElysiaInstance<{ | ||
store: {}; | ||
export declare const swagger: <Path extends string = "/swagger">({ swagger, excludeStaticFile, path, exclude }?: ElysiaSwaggerConfig<Path>) => (app: Elysia) => Elysia<import("elysia").ElysiaInstance<{ | ||
store: Record<typeof SCHEMA, {}>; | ||
request: {}; | ||
schema: {}; | ||
}> & import("elysia").ElysiaInstance<{ | ||
store: {}; | ||
}> & { | ||
request: {}; | ||
store: Record<typeof SCHEMA, {}> & Record<typeof SCHEMA, Record<Path, Record<"GET", Omit<import("elysia").TypedSchemaToRoute<import("elysia/dist/types").MergeSchema<{}, {}>>, "params"> & { | ||
params: Record<import("elysia/dist/types").ExtractPath<Path>, string>; | ||
} & { | ||
response: void; | ||
}>>> & Record<typeof SCHEMA, Record<`${Path}/static/swagger-initializer.js`, Record<"GET", Omit<import("elysia").TypedSchemaToRoute<import("elysia/dist/types").MergeSchema<{}, {}>>, "params"> & { | ||
params: Record<import("elysia/dist/types").ExtractPath<`${Path}/static/swagger-initializer.js`>, string>; | ||
} & { | ||
response: Response; | ||
}>>> & Record<typeof SCHEMA, Record<`${Path}/json`, Record<"GET", Omit<import("elysia").TypedSchemaToRoute<import("elysia/dist/types").MergeSchema<{}, {}>>, "params"> & { | ||
params: Record<import("elysia/dist/types").ExtractPath<`${Path}/json`>, string>; | ||
} & { | ||
response: { | ||
paths: Record<string, any>; | ||
info: { | ||
title: string; | ||
description: string; | ||
termsOfService?: string | undefined; | ||
contact?: OpenAPIV2.ContactObject | undefined; | ||
license?: OpenAPIV2.LicenseObject | undefined; | ||
version: string; | ||
}; | ||
basePath?: string | undefined; | ||
consumes?: OpenAPIV2.MimeTypes | undefined; | ||
definitions?: OpenAPIV2.DefinitionsObject | undefined; | ||
externalDocs?: OpenAPIV2.ExternalDocumentationObject | undefined; | ||
host?: string | undefined; | ||
parameters?: OpenAPIV2.ParametersDefinitionsObject | undefined; | ||
produces?: OpenAPIV2.MimeTypes | undefined; | ||
responses?: OpenAPIV2.ResponsesDefinitionsObject | undefined; | ||
schemes?: string[] | undefined; | ||
security?: OpenAPIV2.SecurityRequirementObject[] | undefined; | ||
securityDefinitions?: OpenAPIV2.SecurityDefinitionsObject | undefined; | ||
swagger?: string | undefined; | ||
tags?: OpenAPIV2.TagObject[] | undefined; | ||
'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[] | undefined; | ||
'x-express-openapi-validation-strict'?: boolean | undefined; | ||
}; | ||
}>>>; | ||
schema: {}; | ||
}>>; | ||
}>; | ||
export default swagger; |
import type { OpenAPIV2 } from "openapi-types"; | ||
export interface ElysiaSwaggerConfig { | ||
export interface ElysiaSwaggerConfig<Path extends string = '/swagger'> { | ||
swagger?: Partial<OpenAPIV2.Document>; | ||
excludeStaticFile?: boolean; | ||
path?: string; | ||
path?: Path; | ||
exclude?: string | RegExp | (string | RegExp)[]; | ||
} |
{ | ||
"name": "@elysiajs/swagger", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Plugin for Elysia to auto-generate Swagger page", | ||
@@ -36,3 +36,3 @@ "author": { | ||
"peerDependencies": { | ||
"elysia": ">= 0.1.0-rc.5" | ||
"elysia": ">= 0.1.0" | ||
}, | ||
@@ -44,7 +44,7 @@ "devDependencies": { | ||
"eslint": "^8.26.0", | ||
"elysia": "^0.1.0-rc.5", | ||
"elysia": "^0.1.0", | ||
"typescript": "^4.8.4" | ||
}, | ||
"dependencies": { | ||
"@elysiajs/static": "0.1.0-rc.1", | ||
"@elysiajs/static": "0.1.0", | ||
"openapi-types": "^12.0.2", | ||
@@ -51,0 +51,0 @@ "swagger-ui-dist": "^4.15.5" |
@@ -24,12 +24,12 @@ import { type Elysia, SCHEMA } from 'elysia' | ||
export const swagger = | ||
( | ||
<Path extends string = '/swagger'>( | ||
{ | ||
swagger = {}, | ||
excludeStaticFile = true, | ||
path = '/swagger', | ||
path = '/swagger' as Path, | ||
exclude = [] | ||
}: ElysiaSwaggerConfig = { | ||
}: ElysiaSwaggerConfig<Path> = { | ||
swagger: {}, | ||
excludeStaticFile: true, | ||
path: '/swagger', | ||
path: '/swagger' as Path, | ||
exclude: [] | ||
@@ -63,3 +63,2 @@ } | ||
}, | ||
// @ts-ignore | ||
paths: filterPaths(context.store[SCHEMA], { | ||
@@ -66,0 +65,0 @@ excludeStaticFile, |
import type { OpenAPIV2 } from "openapi-types" | ||
export interface ElysiaSwaggerConfig { | ||
export interface ElysiaSwaggerConfig<Path extends string = '/swagger'> { | ||
/** | ||
@@ -21,3 +21,3 @@ * Customize Swagger config, refers to Swagger 2.0 config | ||
*/ | ||
path?: string | ||
path?: Path | ||
/** | ||
@@ -24,0 +24,0 @@ * Paths to exclude from Swagger endpoint |
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
16400
331
+ Added@elysiajs/static@0.1.0(transitive)
- Removed@elysiajs/static@0.1.0-rc.1(transitive)
Updated@elysiajs/static@0.1.0