vona-module-a-openapi 5.0.58 → 5.0.60
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.js +1 -14
- package/dist/service/openapi.d.ts +0 -2
- package/dist/types/rest.d.ts +5 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BeanInfo, BeanBase, appResource, beanFullNameFromOnionName, cast,
|
|
1
|
+
import { BeanInfo, BeanBase, appResource, beanFullNameFromOnionName, cast, appMetadata, BeanSimple, BeanScopeBase } from 'vona';
|
|
2
2
|
import { OpenAPIRegistry, OpenApiGeneratorV3, OpenApiGeneratorV31 } from '@cabloy/zod-to-openapi';
|
|
3
3
|
import { Bean, Service, Scope } from 'vona-module-a-bean';
|
|
4
4
|
import { Caching } from 'vona-module-a-caching';
|
|
@@ -108,7 +108,6 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
108
108
|
const pathObj = apiObj.paths[key];
|
|
109
109
|
for (const method in pathObj) {
|
|
110
110
|
const methodObj = pathObj[method];
|
|
111
|
-
this._translateStrings(methodObj, ['description', 'summary']);
|
|
112
111
|
// parameters
|
|
113
112
|
for (const parameterObj of methodObj.parameters || []) {
|
|
114
113
|
this._translateSchema(parameterObj.schema, generateJsonScene);
|
|
@@ -143,7 +142,6 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
// schema
|
|
146
|
-
this._translateStrings(schema, ['title', 'description']);
|
|
147
145
|
if (generateJsonScene === 'api' && !schema.description && schema.title) {
|
|
148
146
|
schema.description = schema.title;
|
|
149
147
|
delete schema.title;
|
|
@@ -181,17 +179,6 @@ let ServiceOpenapi = (_dec$2 = Service(), _dec2$2 = BeanInfo({
|
|
|
181
179
|
}, error, scope);
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
|
-
_translateStrings(obj, keys) {
|
|
185
|
-
for (const key of keys) {
|
|
186
|
-
this._translateString(obj, key);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
_translateString(obj, key) {
|
|
190
|
-
if (!obj) return;
|
|
191
|
-
if (obj[key] && obj[key].includes(LocaleModuleNameSeparator)) {
|
|
192
|
-
obj[key] = this.app.meta.text(obj[key]);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
182
|
collectRegistry() {
|
|
196
183
|
const registry = new OpenAPIRegistry();
|
|
197
184
|
// securitySchemes
|
|
@@ -9,8 +9,6 @@ export declare class ServiceOpenapi extends BeanBase {
|
|
|
9
9
|
translate(apiObj: OpenAPIObject30 | OpenAPIObject31, generateJsonScene: TypeGenerateJsonScene): void;
|
|
10
10
|
private _translateSchema;
|
|
11
11
|
private _translateErrorMessages;
|
|
12
|
-
private _translateStrings;
|
|
13
|
-
private _translateString;
|
|
14
12
|
collectRegistry(): OpenAPIRegistry;
|
|
15
13
|
collectController(registry: OpenAPIRegistry, moduleName: string, controller: Constructable, actionKey?: string): void;
|
|
16
14
|
private _registerControllerAction;
|
package/dist/types/rest.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ZodOpenAPIMetadata } from '@cabloy/zod-to-openapi';
|
|
2
2
|
import type { CurrencyOptions } from '@zhennann/currency';
|
|
3
|
+
import type { ILocaleMagic } from 'vona';
|
|
3
4
|
import type { IOpenApiOptions } from 'vona-module-a-openapiutils';
|
|
4
5
|
import type { z } from 'zod';
|
|
5
6
|
import type { TypeResourceActionRowRecordRender } from './actions.ts';
|
|
@@ -30,7 +31,10 @@ declare module 'openapi3-ts/oas31' {
|
|
|
30
31
|
export type TypeFieldRenderComponent = (keyof IComponentRecord) | (keyof TypeResourceActionRowRecordRender) | 'text' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'image' | 'file' | 'color' | 'password' | 'email' | 'url';
|
|
31
32
|
export type TypeFieldRenderComponentProvider = (keyof IComponentRecord) | (keyof TypeResourceActionRowRecordRender) | 'input' | 'textarea' | 'select';
|
|
32
33
|
export type TypeSchemaScene = 'table' | 'form';
|
|
33
|
-
export type TypeOpenapiMetadata<T extends z.ZodType = z.ZodType> = Partial<ZodOpenAPIMetadata<z.input<T
|
|
34
|
+
export type TypeOpenapiMetadata<T extends z.ZodType = z.ZodType> = Omit<Partial<ZodOpenAPIMetadata<z.input<T>>>, 'title' | 'description'> & {
|
|
35
|
+
title?: string | ILocaleMagic;
|
|
36
|
+
description?: string | ILocaleMagic;
|
|
37
|
+
};
|
|
34
38
|
export type TypeEntityOptionsFields<T extends {}, More extends string | undefined = never> = {
|
|
35
39
|
[key in ((keyof T) | (More extends string ? More : never))]?: TypeOpenapiMetadata | z.ZodType;
|
|
36
40
|
};
|
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.60",
|
|
5
5
|
"title": "a-openapi",
|
|
6
6
|
"vonaModule": {
|
|
7
7
|
"capabilities": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@cabloy/zod-openapi": "^1.0.
|
|
38
|
+
"@cabloy/zod-openapi": "^1.0.8",
|
|
39
39
|
"@cabloy/zod-query": "^2.0.4",
|
|
40
|
-
"@cabloy/zod-to-openapi": "^8.1.
|
|
40
|
+
"@cabloy/zod-to-openapi": "^8.1.5",
|
|
41
41
|
"@zhennann/currency": "^2.0.0",
|
|
42
42
|
"openapi3-ts": "^4.5.0",
|
|
43
43
|
"zod": "^4.1.13"
|