vona-module-a-openapi 5.0.28 → 5.0.29

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { registerMappedClassMetadataKey, appMetadata, appResource, cast, deepExtend, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanSimple, BeanScopeBase } from 'vona';
1
+ import { registerMappedClassMetadataKey, appMetadata, appResource, cast, deepExtend, BeanInfo, BeanBase, LocaleModuleNameSeparator, HttpStatus, BeanSimple, BeanScopeBase, useApp } from 'vona';
2
2
  import { OpenApiGeneratorV3, OpenApiGeneratorV31, OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
3
3
  import * as ModuleInfo from '@cabloy/module-info';
4
4
  import { isClass, isEmptyObject, isNil } from '@cabloy/utils';
@@ -837,8 +837,16 @@ function schemaMax(max, message) {
837
837
  };
838
838
  }
839
839
  function schemaTableIdentity() {
840
+ const app = useApp();
841
+ const ormConfig = app.util.getModuleConfigRaw('a-orm');
842
+ const _identityType = ormConfig?.table.identityType ?? 'string';
840
843
  return function (_schema) {
841
- return z.union([z.string(), z.number()]);
844
+ if (_identityType === 'string') {
845
+ return z.string();
846
+ } else if (_identityType === 'number') {
847
+ return z.number();
848
+ }
849
+ throw new Error('not support');
842
850
  };
843
851
  }
844
852
  function schemaBigNumber() {
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.28",
4
+ "version": "5.0.29",
5
5
  "title": "a-openapi",
6
6
  "vonaModule": {
7
7
  "capabilities": {