@elysiajs/swagger
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -91,6 +91,8 @@ "use strict"; | ||
}, | ||
paths: (0, utils_1.filterPaths)(schema, { | ||
excludeStaticFile, | ||
exclude: Array.isArray(exclude) ? exclude : [exclude] | ||
}), | ||
paths: { ...(0, utils_1.filterPaths)(schema, { | ||
excludeStaticFile, | ||
exclude: Array.isArray(exclude) ? exclude : [exclude] | ||
}), | ||
...documentation.paths | ||
}, | ||
components: { | ||
@@ -97,0 +99,0 @@ ...documentation.components, |
@@ -34,5 +34,5 @@ "use strict"; | ||
? cdn | ||
: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${version}/dist/browser/standalone.min.js`}"></script> | ||
: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${version}/dist/browser/standalone.min.js`}" crossorigin></script> | ||
</body> | ||
</html>`; | ||
exports.ScalarRender = ScalarRender; |
@@ -5,3 +5,10 @@ import type { HTTPMethod, LocalHook } from 'elysia'; | ||
export declare const toOpenAPIPath: (path: string) => string; | ||
export declare const mapProperties: (name: string, schema: TSchema | string | undefined, models: Record<string, TSchema>) => any[]; | ||
export declare const mapProperties: (name: string, schema: TSchema | string | undefined, models: Record<string, TSchema>) => { | ||
description: any; | ||
examples: any; | ||
schema: any; | ||
in: string; | ||
name: string; | ||
required: any; | ||
}[]; | ||
export declare const capitalize: (word: string) => string; | ||
@@ -8,0 +15,0 @@ export declare const generateOperationId: (method: string, paths: string) => string; |
@@ -23,7 +23,7 @@ "use strict"; | ||
return Object.entries(schema?.properties ?? []).map(([key, value]) => { | ||
const { type: valueType = undefined, ...rest } = value; | ||
const { type: valueType = undefined, description, examples, ...schemaKeywords } = value; | ||
return { | ||
// @ts-ignore | ||
...rest, | ||
schema: { type: valueType }, | ||
description, examples, | ||
schema: { type: valueType, ...schemaKeywords }, | ||
in: name, | ||
@@ -171,2 +171,3 @@ name: key, | ||
requestBody: { | ||
required: true, | ||
content: mapTypesResponse(contentTypes, typeof bodySchema === 'string' | ||
@@ -173,0 +174,0 @@ ? { |
@@ -88,6 +88,8 @@ import { SwaggerUIRender } from './swagger'; | ||
}, | ||
paths: filterPaths(schema, { | ||
excludeStaticFile, | ||
exclude: Array.isArray(exclude) ? exclude : [exclude] | ||
}), | ||
paths: { ...filterPaths(schema, { | ||
excludeStaticFile, | ||
exclude: Array.isArray(exclude) ? exclude : [exclude] | ||
}), | ||
...documentation.paths | ||
}, | ||
components: { | ||
@@ -94,0 +96,0 @@ ...documentation.components, |
@@ -28,4 +28,4 @@ import scalarElysiaTheme from './theme'; | ||
? cdn | ||
: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${version}/dist/browser/standalone.min.js`}"></script> | ||
: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${version}/dist/browser/standalone.min.js`}" crossorigin></script> | ||
</body> | ||
</html>`; |
@@ -5,3 +5,10 @@ import type { HTTPMethod, LocalHook } from 'elysia'; | ||
export declare const toOpenAPIPath: (path: string) => string; | ||
export declare const mapProperties: (name: string, schema: TSchema | string | undefined, models: Record<string, TSchema>) => any[]; | ||
export declare const mapProperties: (name: string, schema: TSchema | string | undefined, models: Record<string, TSchema>) => { | ||
description: any; | ||
examples: any; | ||
schema: any; | ||
in: string; | ||
name: string; | ||
required: any; | ||
}[]; | ||
export declare const capitalize: (word: string) => string; | ||
@@ -8,0 +15,0 @@ export declare const generateOperationId: (method: string, paths: string) => string; |
@@ -16,7 +16,7 @@ import { Kind } from '@sinclair/typebox'; | ||
return Object.entries(schema?.properties ?? []).map(([key, value]) => { | ||
const { type: valueType = undefined, ...rest } = value; | ||
const { type: valueType = undefined, description, examples, ...schemaKeywords } = value; | ||
return { | ||
// @ts-ignore | ||
...rest, | ||
schema: { type: valueType }, | ||
description, examples, | ||
schema: { type: valueType, ...schemaKeywords }, | ||
in: name, | ||
@@ -161,2 +161,3 @@ name: key, | ||
requestBody: { | ||
required: true, | ||
content: mapTypesResponse(contentTypes, typeof bodySchema === 'string' | ||
@@ -163,0 +164,0 @@ ? { |
{ | ||
"name": "@elysiajs/swagger", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Plugin for Elysia to auto-generate Swagger page", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -58,3 +58,3 @@ # @elysiajs/swagger | ||
## swagger | ||
Customize Swagger config, refers to [Swagger 2.0 config](https://swagger.io/specification/v2/) | ||
Customize Swagger config, refers to [Swagger 3.0.3 config](https://swagger.io/specification/v3/) | ||
@@ -61,0 +61,0 @@ ## path |
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
160537
4129