vona-module-a-openapi 5.0.37 → 5.0.39
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/.metadata/index.d.ts +34 -2
- package/dist/bean/bean.openapi.d.ts +7 -0
- package/dist/config/locale/en-us.d.ts +4 -0
- package/dist/config/locale/zh-cn.d.ts +4 -0
- package/dist/index.js +99 -52
- package/dist/lib/schema/v/helpers.d.ts +1 -0
- package/dist/lib/schema/v.d.ts +2 -1
- package/dist/service/openapi.d.ts +5 -4
- package/package.json +3 -3
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/** bean: begin */
|
|
2
|
+
export * from '../bean/bean.openapi.ts';
|
|
3
|
+
import 'vona';
|
|
4
|
+
declare module 'vona' {
|
|
5
|
+
}
|
|
6
|
+
declare module 'vona-module-a-openapi' {
|
|
7
|
+
interface BeanOpenapi {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** bean: end */
|
|
11
|
+
/** bean: begin */
|
|
12
|
+
import type { BeanOpenapi } from '../bean/bean.openapi.ts';
|
|
13
|
+
import 'vona';
|
|
14
|
+
declare module 'vona' {
|
|
15
|
+
interface IBeanRecordGlobal {
|
|
16
|
+
'openapi': BeanOpenapi;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** bean: end */
|
|
1
20
|
/** service: begin */
|
|
2
21
|
export * from '../service/openapi.ts';
|
|
3
22
|
import 'vona';
|
|
@@ -55,17 +74,26 @@ export interface IModuleSummerCache {
|
|
|
55
74
|
/** config: begin */
|
|
56
75
|
export * from '../config/config.ts';
|
|
57
76
|
import type { config } from '../config/config.ts';
|
|
58
|
-
|
|
77
|
+
export declare const locales: {
|
|
78
|
+
'en-us': {
|
|
79
|
+
ZodErrorRequired: string;
|
|
80
|
+
};
|
|
81
|
+
'zh-cn': {
|
|
82
|
+
ZodErrorRequired: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/** locale: end */
|
|
59
86
|
/** main: begin */
|
|
60
87
|
export * from '../main.ts';
|
|
61
88
|
/** main: end */
|
|
62
89
|
/** scope: begin */
|
|
63
|
-
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig } from 'vona';
|
|
90
|
+
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig, type TypeModuleLocales, type TypeLocaleBase } from 'vona';
|
|
64
91
|
export declare class ScopeModuleAOpenapi extends BeanScopeBase {
|
|
65
92
|
}
|
|
66
93
|
export interface ScopeModuleAOpenapi {
|
|
67
94
|
util: BeanScopeUtil;
|
|
68
95
|
config: TypeModuleConfig<typeof config>;
|
|
96
|
+
locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;
|
|
69
97
|
service: IModuleService;
|
|
70
98
|
summerCache: IModuleSummerCache;
|
|
71
99
|
}
|
|
@@ -80,5 +108,9 @@ declare module 'vona' {
|
|
|
80
108
|
interface IBeanScopeConfig {
|
|
81
109
|
'a-openapi': ReturnType<typeof config>;
|
|
82
110
|
}
|
|
111
|
+
interface IBeanScopeLocale {
|
|
112
|
+
'a-openapi': (typeof locales)[TypeLocaleBase];
|
|
113
|
+
}
|
|
83
114
|
}
|
|
115
|
+
export declare function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): `a-openapi::${K}`;
|
|
84
116
|
/** scope: end */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Constructable } from 'vona';
|
|
2
|
+
import type { IOpenapiObject } from 'vona-module-a-openapiutils';
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
export declare class BeanOpenapi extends BeanBase {
|
|
5
|
+
generateJsonOfClass<K extends keyof IOpenapiObject>(schemaClass: Constructable, version?: K): Promise<IOpenapiObject[K]>;
|
|
6
|
+
generateJsonOfClasses<K extends keyof IOpenapiObject>(schemaClasses: Constructable[], version?: K): Promise<IOpenapiObject[K]>;
|
|
7
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,20 @@
|
|
|
1
1
|
import { registerMappedClassMetadataKey, appMetadata, appResource, cast, deepExtend, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanSimple, BeanScopeBase, useApp, beanFullNameFromOnionName } from 'vona';
|
|
2
|
-
import
|
|
2
|
+
import { OpenAPIRegistry, OpenApiGeneratorV3, OpenApiGeneratorV31 } from '@cabloy/zod-to-openapi';
|
|
3
|
+
import { Bean, Service, Scope } from 'vona-module-a-bean';
|
|
4
|
+
import { SymbolDecoratorRule, SymbolOpenApiOptions } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { z } from 'zod';
|
|
3
6
|
import { isEmptyObject, isClass, isNil } from '@cabloy/utils';
|
|
7
|
+
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
8
|
+
import * as ModuleInfo from '@cabloy/module-info';
|
|
4
9
|
import { toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
10
|
+
import { translateError } from '@cabloy/zod-errors-custom';
|
|
5
11
|
import { getInnerTypeName, coerceWithNil } from '@cabloy/zod-query';
|
|
6
|
-
import { OpenApiGeneratorV3, OpenApiGeneratorV31, OpenAPIRegistry } from '@cabloy/zod-to-openapi';
|
|
7
|
-
import { Service, Scope } from 'vona-module-a-bean';
|
|
8
12
|
import { Caching } from 'vona-module-a-caching';
|
|
9
|
-
import { SymbolDecoratorRule, SymbolOpenApiOptions } from 'vona-module-a-openapiutils';
|
|
10
13
|
import { SymbolRequestMappingHandler } from 'vona-module-a-web';
|
|
11
|
-
import { z } from 'zod';
|
|
12
|
-
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
13
14
|
import { SummerCache, BeanSummerCacheBase } from 'vona-module-a-summer';
|
|
14
15
|
import 'openapi3-ts/oas30';
|
|
15
16
|
import 'openapi3-ts/oas31';
|
|
16
17
|
|
|
17
|
-
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
18
|
-
var a = {};
|
|
19
|
-
return Object.keys(n).forEach(function (i) {
|
|
20
|
-
a[i] = n[i];
|
|
21
|
-
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = true), a = r.slice().reverse().reduce(function (r, n) {
|
|
22
|
-
return n(i, e, r) || r;
|
|
23
|
-
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function bodySchemaWrapperDefault(bodySchema) {
|
|
27
|
-
return z.object({
|
|
28
|
-
code: z.string(),
|
|
29
|
-
message: z.string(),
|
|
30
|
-
data: bodySchema
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
18
|
function getTargetDecoratorRules(target, disableRegisterMetadata) {
|
|
35
19
|
if (!disableRegisterMetadata) {
|
|
36
20
|
registerMappedClassMetadataKey(target, SymbolDecoratorRule, {
|
|
@@ -191,6 +175,52 @@ function _createSchemaObject(rules, options) {
|
|
|
191
175
|
return schema;
|
|
192
176
|
}
|
|
193
177
|
|
|
178
|
+
var _dec$3, _dec2$3, _class$3;
|
|
179
|
+
let BeanOpenapi = (_dec$3 = Bean(), _dec2$3 = BeanInfo({
|
|
180
|
+
module: "a-openapi"
|
|
181
|
+
}), _dec$3(_class$3 = _dec2$3(_class$3 = class BeanOpenapi extends BeanBase {
|
|
182
|
+
// need not cache
|
|
183
|
+
async generateJsonOfClass(schemaClass, version = 'V31') {
|
|
184
|
+
return await this.generateJsonOfClasses([schemaClass], version);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// need not cache
|
|
188
|
+
async generateJsonOfClasses(schemaClasses, version = 'V31') {
|
|
189
|
+
const registry = new OpenAPIRegistry();
|
|
190
|
+
// schema: independent
|
|
191
|
+
let counter = 0;
|
|
192
|
+
for (const schemaClass of schemaClasses) {
|
|
193
|
+
const schema = $schema(schemaClass);
|
|
194
|
+
let beanFullName = appResource.getBeanFullName(schemaClass);
|
|
195
|
+
if (!beanFullName) {
|
|
196
|
+
beanFullName = `${schemaClass.name}_${counter++}`;
|
|
197
|
+
}
|
|
198
|
+
registry.register(beanFullName, schema);
|
|
199
|
+
}
|
|
200
|
+
const generator = version === 'V30' ? new OpenApiGeneratorV3(registry.definitions) : new OpenApiGeneratorV31(registry.definitions);
|
|
201
|
+
const apiObj = generator.generateDocument(this.scope.config.generateDocument[version]);
|
|
202
|
+
this.scope.service.openapi.translate(apiObj, 'rest');
|
|
203
|
+
return apiObj;
|
|
204
|
+
}
|
|
205
|
+
}) || _class$3) || _class$3);
|
|
206
|
+
|
|
207
|
+
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
208
|
+
var a = {};
|
|
209
|
+
return Object.keys(n).forEach(function (i) {
|
|
210
|
+
a[i] = n[i];
|
|
211
|
+
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = true), a = r.slice().reverse().reduce(function (r, n) {
|
|
212
|
+
return n(i, e, r) || r;
|
|
213
|
+
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function bodySchemaWrapperDefault(bodySchema) {
|
|
217
|
+
return z.object({
|
|
218
|
+
code: z.string(),
|
|
219
|
+
message: z.string(),
|
|
220
|
+
data: bodySchema
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
194
224
|
const SymbolRouteHandlersArgumentsMeta = Symbol('SymbolRouteHandlersArgumentsMeta');
|
|
195
225
|
const SymbolRouteHandlersArgumentsValue = Symbol('SymbolRouteHandlersArgumentsValue');
|
|
196
226
|
|
|
@@ -221,7 +251,7 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
221
251
|
const registry = this._collectRegistry();
|
|
222
252
|
const generator = version === 'V30' ? new OpenApiGeneratorV3(registry.definitions) : new OpenApiGeneratorV31(registry.definitions);
|
|
223
253
|
const apiObj = generator.generateDocument(this.scope.config.generateDocument[version]);
|
|
224
|
-
this.
|
|
254
|
+
this.translate(apiObj, 'api');
|
|
225
255
|
return apiObj;
|
|
226
256
|
}
|
|
227
257
|
async generateJsonOfControllerAction(controller, actionKey, version = 'V31') {
|
|
@@ -231,34 +261,10 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
231
261
|
this._collectController(registry, beanOptions.module, controller, actionKey);
|
|
232
262
|
const generator = version === 'V30' ? new OpenApiGeneratorV3(registry.definitions) : new OpenApiGeneratorV31(registry.definitions);
|
|
233
263
|
const apiObj = generator.generateDocument(this.scope.config.generateDocument[version]);
|
|
234
|
-
this.
|
|
264
|
+
this.translate(apiObj, 'rest');
|
|
235
265
|
return apiObj;
|
|
236
266
|
}
|
|
237
|
-
|
|
238
|
-
// need not cache
|
|
239
|
-
async generateJsonOfClass(schemaClass, version = 'V31') {
|
|
240
|
-
return await this.generateJsonOfClasses([schemaClass], version);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// need not cache
|
|
244
|
-
async generateJsonOfClasses(schemaClasses, version = 'V31') {
|
|
245
|
-
const registry = new OpenAPIRegistry();
|
|
246
|
-
// schema: independent
|
|
247
|
-
let counter = 0;
|
|
248
|
-
for (const schemaClass of schemaClasses) {
|
|
249
|
-
const schema = $schema(schemaClass);
|
|
250
|
-
let beanFullName = appResource.getBeanFullName(schemaClass);
|
|
251
|
-
if (!beanFullName) {
|
|
252
|
-
beanFullName = `${schemaClass.name}_${counter++}`;
|
|
253
|
-
}
|
|
254
|
-
registry.register(beanFullName, schema);
|
|
255
|
-
}
|
|
256
|
-
const generator = version === 'V30' ? new OpenApiGeneratorV3(registry.definitions) : new OpenApiGeneratorV31(registry.definitions);
|
|
257
|
-
const apiObj = generator.generateDocument(this.scope.config.generateDocument[version]);
|
|
258
|
-
this._translate(apiObj, 'rest');
|
|
259
|
-
return apiObj;
|
|
260
|
-
}
|
|
261
|
-
_translate(apiObj, generateJsonScene) {
|
|
267
|
+
translate(apiObj, generateJsonScene) {
|
|
262
268
|
// paths
|
|
263
269
|
if (apiObj.paths) {
|
|
264
270
|
for (const key in apiObj.paths) {
|
|
@@ -294,6 +300,8 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
294
300
|
schema.description = schema.title;
|
|
295
301
|
delete schema.title;
|
|
296
302
|
}
|
|
303
|
+
// errorMessage
|
|
304
|
+
this._translateErrorMessages(schema);
|
|
297
305
|
// properties
|
|
298
306
|
const properties = cast(schema).properties;
|
|
299
307
|
if (properties && typeof properties === 'object') {
|
|
@@ -308,6 +316,23 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
308
316
|
this._translateSchema(items, generateJsonScene);
|
|
309
317
|
}
|
|
310
318
|
}
|
|
319
|
+
_translateErrorMessages(obj) {
|
|
320
|
+
if (!obj.errorMessage) return;
|
|
321
|
+
for (const key in obj.errorMessage) {
|
|
322
|
+
let error = obj.errorMessage[key];
|
|
323
|
+
if (typeof error === 'function') {
|
|
324
|
+
error = error();
|
|
325
|
+
}
|
|
326
|
+
const scope = Object.assign({}, obj);
|
|
327
|
+
if (!isNil(obj.minLength)) scope.minimum = obj.minLength;
|
|
328
|
+
if (!isNil(obj.exclusiveMinimum)) scope.minimum = obj.exclusiveMinimum;
|
|
329
|
+
if (!isNil(obj.maxLength)) scope.maximum = obj.maxLength;
|
|
330
|
+
if (!isNil(obj.exclusiveMaximum)) scope.maximum = obj.exclusiveMaximum;
|
|
331
|
+
obj.errorMessage[key] = translateError((text, ...args) => {
|
|
332
|
+
return this.app.meta.text(text, ...args);
|
|
333
|
+
}, error, scope);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
311
336
|
_translateStrings(obj, keys) {
|
|
312
337
|
for (const key of keys) {
|
|
313
338
|
this._translateString(obj, key);
|
|
@@ -604,6 +629,14 @@ function config(_app) {
|
|
|
604
629
|
};
|
|
605
630
|
}
|
|
606
631
|
|
|
632
|
+
var locale_en_us = {
|
|
633
|
+
ZodErrorRequired: 'Required'
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
var locale_zh_cn = {
|
|
637
|
+
ZodErrorRequired: '必填项'
|
|
638
|
+
};
|
|
639
|
+
|
|
607
640
|
function schemaRefCustomAdapter(_app) {
|
|
608
641
|
const registry = new OpenAPIRegistry();
|
|
609
642
|
const generator31 = new OpenApiGeneratorV31(registry.definitions);
|
|
@@ -638,12 +671,25 @@ class Main extends BeanSimple {
|
|
|
638
671
|
}
|
|
639
672
|
|
|
640
673
|
var _dec, _dec2, _class;
|
|
674
|
+
const locales = {
|
|
675
|
+
'en-us': locale_en_us,
|
|
676
|
+
'zh-cn': locale_zh_cn
|
|
677
|
+
};
|
|
641
678
|
let ScopeModuleAOpenapi = (_dec = Scope(), _dec2 = BeanInfo({
|
|
642
679
|
module: "a-openapi"
|
|
643
680
|
}), _dec(_class = _dec2(_class = class ScopeModuleAOpenapi extends BeanScopeBase {}) || _class) || _class);
|
|
644
|
-
|
|
681
|
+
function $locale(key) {
|
|
682
|
+
return `a-openapi::${key}`;
|
|
683
|
+
}
|
|
645
684
|
/** scope: end */
|
|
646
685
|
|
|
686
|
+
function schemaRequired(params) {
|
|
687
|
+
params = params || $locale('ZodErrorRequired');
|
|
688
|
+
return function (schema) {
|
|
689
|
+
schema._zod.def.error = z.util.normalizeParams(params).error;
|
|
690
|
+
return schema;
|
|
691
|
+
};
|
|
692
|
+
}
|
|
647
693
|
function schemaEmail(params) {
|
|
648
694
|
return function (_schema) {
|
|
649
695
|
return z.email(params);
|
|
@@ -890,6 +936,7 @@ const v = {
|
|
|
890
936
|
strictObject: schemaStrictObject,
|
|
891
937
|
looseObject: schemaLooseObject,
|
|
892
938
|
// helpers
|
|
939
|
+
required: schemaRequired,
|
|
893
940
|
email: schemaEmail,
|
|
894
941
|
url: schemaUrl,
|
|
895
942
|
uuid: schemaUuid,
|
|
@@ -1028,4 +1075,4 @@ const OrderBusinessBase = 1000;
|
|
|
1028
1075
|
const OrderUnknownBase = 10000;
|
|
1029
1076
|
const OrderMaxBase = 100000;
|
|
1030
1077
|
|
|
1031
|
-
export { $schema, $schemaLazy, Api, Main, OrderBusinessBase, OrderCoreBase, OrderMaxBase, OrderUnknownBase, ScopeModuleAOpenapi, ServiceOpenapi, SummerCacheJson, SymbolRouteHandlersArgumentsMeta, SymbolRouteHandlersArgumentsValue, SymbolSchemaDynamicRefId, addSchemaDynamic, bodySchemaWrapperDefault, config, getSchemaDynamic, getSchemasDynamic, getTargetDecoratorRuleColumns, getTargetDecoratorRuleColumnsMap, getTargetDecoratorRules, makeSchemaLike, makeSchemaLikes, mergeFieldOpenapiMetadata, mergeFieldsOpenapiMetadata, prepareClassType, schemaRefCustomAdapter, v };
|
|
1078
|
+
export { $locale, $schema, $schemaLazy, Api, BeanOpenapi, Main, OrderBusinessBase, OrderCoreBase, OrderMaxBase, OrderUnknownBase, ScopeModuleAOpenapi, ServiceOpenapi, SummerCacheJson, SymbolRouteHandlersArgumentsMeta, SymbolRouteHandlersArgumentsValue, SymbolSchemaDynamicRefId, addSchemaDynamic, bodySchemaWrapperDefault, config, getSchemaDynamic, getSchemasDynamic, getTargetDecoratorRuleColumns, getTargetDecoratorRuleColumnsMap, getTargetDecoratorRules, locales, makeSchemaLike, makeSchemaLikes, mergeFieldOpenapiMetadata, mergeFieldsOpenapiMetadata, prepareClassType, schemaRefCustomAdapter, v };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ISerializerTransformRecord, TypeSerializerTransformGetter } from 'vona-module-a-serialization';
|
|
2
2
|
import type { ISchemaObjectExtensionFieldCaptcha } from '../../../types/captcha.ts';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
export declare function schemaRequired(params?: string | z.core.$ZodStringParams): (schema: z.ZodType) => z.ZodType;
|
|
4
5
|
export declare function schemaEmail(params?: string | z.core.$ZodEmailParams): (_schema: z.ZodString) => z.ZodEmail;
|
|
5
6
|
export declare function schemaUrl(params?: string | z.core.$ZodURLParams): (_schema: z.ZodString) => z.ZodURL;
|
|
6
7
|
export declare function schemaUuid(params?: string | z.core.$ZodUUIDParams): (_schema: z.ZodString) => z.ZodUUID;
|
package/dist/lib/schema/v.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { schemaBigNumber, schemaCaptcha, schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex, schemaSerializerExclude, schemaSerializerGetter, schemaSerializerSensitive, schemaSerializerTransform, schemaTableIdentity, schemaToLowerCase, schemaToUpperCase, schemaTrim, schemaUppercase, schemaUrl, schemaUuid } from './v/helpers.ts';
|
|
1
|
+
import { schemaBigNumber, schemaCaptcha, schemaEmail, schemaIPv4, schemaIPv6, schemaLowercase, schemaMax, schemaMin, schemaRegex, schemaRequired, schemaSerializerExclude, schemaSerializerGetter, schemaSerializerSensitive, schemaSerializerTransform, schemaTableIdentity, schemaToLowerCase, schemaToUpperCase, schemaTrim, schemaUppercase, schemaUrl, schemaUuid } from './v/helpers.ts';
|
|
2
2
|
import { schemaDescription, schemaExample, schemaOpenapi, schemaTitle } from './v/openapi.ts';
|
|
3
3
|
import { schemaArray, schemaDefault, schemaLazy, schemaLooseObject, schemaObject, schemaOptional, schemaStrictObject } from './v/system.ts';
|
|
4
4
|
import { schemaZodRefine, schemaZodTransform } from './v/zod.ts';
|
|
@@ -10,6 +10,7 @@ export declare const v: {
|
|
|
10
10
|
optional: typeof schemaOptional;
|
|
11
11
|
strictObject: typeof schemaStrictObject;
|
|
12
12
|
looseObject: typeof schemaLooseObject;
|
|
13
|
+
required: typeof schemaRequired;
|
|
13
14
|
email: typeof schemaEmail;
|
|
14
15
|
url: typeof schemaUrl;
|
|
15
16
|
uuid: typeof schemaUuid;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import type { OpenAPIObject as OpenAPIObject30 } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { OpenAPIObject as OpenAPIObject31 } from 'openapi3-ts/oas31';
|
|
1
3
|
import type { Constructable } from 'vona';
|
|
2
|
-
import type { IOpenapiObject } from 'vona-module-a-openapiutils';
|
|
4
|
+
import type { IOpenapiObject, TypeGenerateJsonScene } from 'vona-module-a-openapiutils';
|
|
3
5
|
import { BeanBase } from 'vona';
|
|
4
6
|
export declare class ServiceOpenapi extends BeanBase {
|
|
5
7
|
protected generateJsonCacheKey(args: any[], prop: string): string;
|
|
6
8
|
protected generateJsonOfControllerActionCacheKey(args: any[], prop: string): string;
|
|
7
9
|
generateJson<K extends keyof IOpenapiObject>(version?: K): Promise<IOpenapiObject[K]>;
|
|
8
10
|
generateJsonOfControllerAction<K extends keyof IOpenapiObject>(controller: Constructable, actionKey: string, version?: K): Promise<IOpenapiObject[K]>;
|
|
9
|
-
|
|
10
|
-
generateJsonOfClasses<K extends keyof IOpenapiObject>(schemaClasses: Constructable[], version?: K): Promise<IOpenapiObject[K]>;
|
|
11
|
-
private _translate;
|
|
11
|
+
translate(apiObj: OpenAPIObject30 | OpenAPIObject31, generateJsonScene: TypeGenerateJsonScene): void;
|
|
12
12
|
private _translateSchema;
|
|
13
|
+
private _translateErrorMessages;
|
|
13
14
|
private _translateStrings;
|
|
14
15
|
private _translateString;
|
|
15
16
|
private _collectRegistry;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-module-a-openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.39",
|
|
5
5
|
"title": "a-openapi",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"static"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@cabloy/zod-openapi": "^1.0.
|
|
38
|
+
"@cabloy/zod-openapi": "^1.0.3",
|
|
39
39
|
"@cabloy/zod-query": "^2.0.1",
|
|
40
|
-
"@cabloy/zod-to-openapi": "^8.1.
|
|
40
|
+
"@cabloy/zod-to-openapi": "^8.1.4",
|
|
41
41
|
"@zhennann/currency": "^2.0.0",
|
|
42
42
|
"openapi3-ts": "^4.5.0",
|
|
43
43
|
"zod": "^4.1.5"
|