@vercube/schema 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +23 -2
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ interface SchemaDecoratorOptions extends Omit<RouteConfig, 'method' | 'path'> {}
|
|
|
13
13
|
* @param {SchemaDecoratorOptions} params - The schema options for the route.
|
|
14
14
|
* @returns {Function} - The decorator function.
|
|
15
15
|
*/
|
|
16
|
-
declare function Schema(params: SchemaDecoratorOptions): Function;
|
|
16
|
+
export declare function Schema(params: SchemaDecoratorOptions): Function;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/Types/SchemaPluginOptions.d.ts
|
|
19
19
|
/**
|
|
@@ -69,7 +69,7 @@ interface SchemaPluginOptions {
|
|
|
69
69
|
*
|
|
70
70
|
* @see {@link https://vercube.dev} for full documentation
|
|
71
71
|
*/
|
|
72
|
-
declare class SchemaPlugin extends BasePlugin<SchemaPluginOptions> {
|
|
72
|
+
export declare class SchemaPlugin extends BasePlugin<SchemaPluginOptions> {
|
|
73
73
|
/**
|
|
74
74
|
* The name of the plugin.
|
|
75
75
|
* @override
|
|
@@ -84,4 +84,4 @@ declare class SchemaPlugin extends BasePlugin<SchemaPluginOptions> {
|
|
|
84
84
|
use(app: App, options?: SchemaPluginOptions): void | Promise<void>;
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
|
-
export {
|
|
87
|
+
export { type SchemaPluginOptions, type SchemaScalarOptions, z };
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { OpenAPIRegistry, OpenApiGeneratorV3, extendZodWithOpenApi } from "@aste
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { BaseDecorator, Identity, Inject, createDecorator } from "@vercube/di";
|
|
4
4
|
import defu, { defu as defu$1 } from "defu";
|
|
5
|
-
import { BasePlugin, Controller, Get } from "@vercube/core";
|
|
5
|
+
import { BasePlugin, Controller, Get, IntrospectionRegistry } from "@vercube/core";
|
|
6
6
|
import { renderApiReference } from "@scalar/client-side-rendering";
|
|
7
7
|
//#region src/Resolvers/SchemaBodyResolver.ts
|
|
8
8
|
/**
|
|
@@ -45,11 +45,25 @@ var SchemaRegistry = class {
|
|
|
45
45
|
*/
|
|
46
46
|
fRegistry = new OpenAPIRegistry();
|
|
47
47
|
/**
|
|
48
|
+
* Bumped on every registration, so introspection can cache the generated
|
|
49
|
+
* document and know when it went stale.
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
fRevision = 1;
|
|
53
|
+
/**
|
|
54
|
+
* Revision of the registry contents.
|
|
55
|
+
* @returns The current revision.
|
|
56
|
+
*/
|
|
57
|
+
get revision() {
|
|
58
|
+
return this.fRevision;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
48
61
|
* Registers a route configuration with the registry.
|
|
49
62
|
* @param cfg - The route configuration to register.
|
|
50
63
|
*/
|
|
51
64
|
register(cfg) {
|
|
52
65
|
this.fRegistry.registerPath(cfg);
|
|
66
|
+
this.fRevision++;
|
|
53
67
|
}
|
|
54
68
|
/**
|
|
55
69
|
* Generates OpenAPI components from the registered schemas.
|
|
@@ -68,7 +82,7 @@ var SchemaRegistry = class {
|
|
|
68
82
|
}
|
|
69
83
|
};
|
|
70
84
|
//#endregion
|
|
71
|
-
//#region \0@oxc-project+runtime@0.
|
|
85
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/decorate.js
|
|
72
86
|
function __decorate(decorators, target, key, desc) {
|
|
73
87
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
74
88
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -209,6 +223,13 @@ var SchemaPlugin = class extends BasePlugin {
|
|
|
209
223
|
app.container.bindInstance($SchemaPluginOptions, mergedOptions);
|
|
210
224
|
app.container.bind(SchemaRegistry);
|
|
211
225
|
app.container.bind(SchemaController);
|
|
226
|
+
const registry = app.container.get(SchemaRegistry);
|
|
227
|
+
app.container.getOptional(IntrospectionRegistry)?.register({
|
|
228
|
+
id: "openapi",
|
|
229
|
+
title: "OpenAPI",
|
|
230
|
+
revision: () => registry.revision,
|
|
231
|
+
describe: () => registry.generateSchema()
|
|
232
|
+
});
|
|
212
233
|
}
|
|
213
234
|
};
|
|
214
235
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/schema",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Schema (swagger) module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@asteasolutions/zod-to-openapi": "9.1.0",
|
|
31
|
-
"@scalar/client-side-rendering": "0.
|
|
31
|
+
"@scalar/client-side-rendering": "0.4.5",
|
|
32
32
|
"@standard-schema/spec": "1.1.0",
|
|
33
|
+
"@vercube/core": "1.2.2",
|
|
34
|
+
"@vercube/di": "1.2.2",
|
|
33
35
|
"defu": "6.1.7",
|
|
34
|
-
"zod": "4.
|
|
35
|
-
"@vercube/di": "1.2.1",
|
|
36
|
-
"@vercube/core": "1.2.1"
|
|
36
|
+
"zod": "4.6.5"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|