@tsed/schema 8.33.0 → 8.35.0
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/lib/esm/compat.js +8 -0
- package/lib/esm/components/index.js +37 -27
- package/lib/esm/components/{default → mappers/default}/anyMapper.js +5 -5
- package/lib/esm/components/{default → mappers/default}/classMapper.js +5 -5
- package/lib/esm/components/{default → mappers/default}/discriminatorMappingMapper.js +3 -3
- package/lib/esm/components/{default → mappers/default}/enumsMapper.js +2 -2
- package/lib/esm/components/{default → mappers/default}/genericsMapper.js +7 -6
- package/lib/esm/components/{default → mappers/default}/inheritedClassMapper.js +3 -3
- package/lib/esm/components/{default → mappers/default}/lazyRefMapper.js +3 -3
- package/lib/esm/components/{default → mappers/default}/mapMapper.js +2 -2
- package/lib/esm/components/{default → mappers/default}/nextMapper.js +16 -16
- package/lib/esm/components/{default → mappers/default}/nullableMapper.js +3 -3
- package/lib/esm/components/{default → mappers/default}/objectMapper.js +4 -4
- package/lib/esm/components/mappers/default/ofMapper.js +9 -0
- package/lib/esm/components/{default → mappers/default}/requiredMapper.js +3 -3
- package/lib/esm/components/{default → mappers/default}/schemaMapper.js +11 -6
- package/lib/esm/components/mappers/open-spec/discriminatorMappingMapper.js +8 -0
- package/lib/esm/components/mappers/open-spec/enumsMapper.js +12 -0
- package/lib/esm/components/{open-spec → mappers/open-spec}/generate.js +3 -4
- package/lib/esm/components/{open-spec → mappers/open-spec}/nullableMapper.js +3 -4
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationInFilesMapper.js +2 -2
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationInParameterMapper.js +3 -3
- package/lib/esm/components/mappers/open-spec/operationInParametersMapper.js +5 -0
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationInQueryMapper.js +3 -3
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationMapper.js +4 -4
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationMediaMapper.js +2 -2
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationRequestBodyMapper.js +4 -4
- package/lib/esm/components/{open-spec → mappers/open-spec}/operationResponseMapper.js +2 -2
- package/lib/esm/components/{open-spec → mappers/open-spec}/pathsMapper.js +10 -10
- package/lib/esm/{domain → components/stores}/JsonClassStore.js +8 -13
- package/lib/esm/{domain → components/stores}/JsonMethodStore.js +33 -28
- package/lib/esm/{domain → components/stores}/JsonParameterStore.js +14 -18
- package/lib/esm/{domain → components/stores}/JsonPropertyStore.js +15 -18
- package/lib/esm/components/types/arrayType.js +15 -0
- package/lib/esm/components/types/classType.js +8 -0
- package/lib/esm/components/types/genericType.js +8 -0
- package/lib/esm/components/types/mapType.js +15 -0
- package/lib/esm/components/types/primitiveType.js +21 -0
- package/lib/esm/components/types/setType.js +12 -0
- package/lib/esm/decorators/class/discriminatorValue.js +1 -1
- package/lib/esm/decorators/collections/collectionOf.js +2 -2
- package/lib/esm/decorators/collections/maxItems.js +1 -1
- package/lib/esm/decorators/collections/maxProperties.js +1 -1
- package/lib/esm/decorators/collections/minItems.js +1 -1
- package/lib/esm/decorators/collections/minProperties.js +1 -1
- package/lib/esm/decorators/collections/uniqueItems.js +1 -1
- package/lib/esm/decorators/common/defaultMsg.js +1 -1
- package/lib/esm/decorators/common/discriminatorKey.js +1 -1
- package/lib/esm/decorators/common/enum.js +1 -1
- package/lib/esm/decorators/common/exclusiveMaximum.js +1 -1
- package/lib/esm/decorators/common/exclusiveMinimum.js +1 -1
- package/lib/esm/decorators/common/format.js +1 -1
- package/lib/esm/decorators/common/jsonEntityFn.js +2 -2
- package/lib/esm/decorators/common/maxLength.js +1 -1
- package/lib/esm/decorators/common/maximum.js +1 -1
- package/lib/esm/decorators/common/minLength.js +1 -1
- package/lib/esm/decorators/common/minimum.js +1 -1
- package/lib/esm/decorators/common/multipleOf.js +1 -1
- package/lib/esm/decorators/common/name.js +1 -1
- package/lib/esm/decorators/common/nullable.js +2 -2
- package/lib/esm/decorators/common/pattern.js +1 -1
- package/lib/esm/decorators/common/required.js +1 -1
- package/lib/esm/decorators/common/requiredGroups.js +1 -1
- package/lib/esm/decorators/common/typeError.js +1 -1
- package/lib/esm/decorators/config/jsonEntityComponent.js +3 -2
- package/lib/esm/decorators/generics/genericOf.js +2 -2
- package/lib/esm/decorators/generics/generics.js +2 -3
- package/lib/esm/decorators/operations/consumes.js +1 -1
- package/lib/esm/decorators/operations/deprecated.js +1 -1
- package/lib/esm/decorators/operations/header.js +1 -1
- package/lib/esm/decorators/operations/in.js +5 -6
- package/lib/esm/decorators/operations/inFile.js +2 -2
- package/lib/esm/decorators/operations/operation.js +1 -1
- package/lib/esm/decorators/operations/produces.js +1 -1
- package/lib/esm/decorators/operations/publish.js +1 -1
- package/lib/esm/decorators/operations/returns.js +4 -4
- package/lib/esm/decorators/operations/route.js +1 -1
- package/lib/esm/decorators/operations/security.js +1 -1
- package/lib/esm/decorators/operations/subscribe.js +1 -1
- package/lib/esm/decorators/operations/tags.js +1 -1
- package/lib/esm/domain/DecoratorContext.js +2 -2
- package/lib/esm/domain/JsonEntityStore.js +7 -41
- package/lib/esm/domain/JsonLazyRef.js +1 -1
- package/lib/esm/domain/JsonMap.js +1 -1
- package/lib/esm/domain/JsonOperation.js +1 -1
- package/lib/esm/domain/JsonParameter.js +3 -3
- package/lib/esm/domain/JsonRequestBody.js +1 -1
- package/lib/esm/domain/JsonResponse.js +2 -2
- package/lib/esm/domain/JsonSchema.js +94 -131
- package/lib/esm/domain/index.js +26 -0
- package/lib/esm/{utils/getJsonSchema.js → fn/compile.js} +20 -7
- package/lib/esm/fn/enums.js +1 -1
- package/lib/esm/fn/from.js +32 -9
- package/lib/esm/fn/generic.js +9 -0
- package/lib/esm/fn/index.js +25 -4
- package/lib/esm/fn/lazyRef.js +3 -3
- package/lib/esm/fn/oas/compileSpec.js +9 -0
- package/lib/esm/{utils → fn/oas}/generateSpec.js +2 -2
- package/lib/esm/{utils → fn/oas}/getSpec.js +4 -4
- package/lib/esm/{utils → fn/oas}/getSpecType.js +1 -1
- package/lib/esm/{utils → fn/oas}/mapOpenSpec.js +1 -1
- package/lib/esm/hooks/alterOneOf.js +1 -1
- package/lib/esm/index.js +59 -48
- package/lib/esm/registries/JsonEntitiesContainer.js +38 -0
- package/lib/esm/registries/JsonSchemaMapperContainer.js +10 -1
- package/lib/esm/registries/JsonTypesContainer.js +18 -0
- package/lib/esm/utils/generics.js +15 -2
- package/lib/esm/utils/getInheritedStores.js +1 -1
- package/lib/esm/utils/getJsonType.js +2 -2
- package/lib/esm/utils/getOperationsRoutes.js +3 -3
- package/lib/esm/utils/getOperationsStores.js +4 -4
- package/lib/esm/utils/getPropertiesStores.js +2 -2
- package/lib/esm/utils/ref.js +2 -2
- package/lib/types/compat.d.ts +17 -0
- package/lib/types/components/index.d.ts +37 -27
- package/lib/types/components/{default → mappers/default}/anyMapper.d.ts +1 -1
- package/lib/types/components/mappers/default/classMapper.d.ts +3 -0
- package/lib/types/components/{default → mappers/default}/discriminatorMappingMapper.d.ts +2 -2
- package/lib/types/components/mappers/default/enumsMapper.d.ts +3 -0
- package/lib/types/components/{default → mappers/default}/genericsMapper.d.ts +2 -2
- package/lib/types/components/{default → mappers/default}/inheritedClassMapper.d.ts +1 -1
- package/lib/types/components/mappers/default/lazyRefMapper.d.ts +3 -0
- package/lib/types/components/{default → mappers/default}/mapMapper.d.ts +1 -1
- package/lib/types/components/{default → mappers/default}/nextMapper.d.ts +2 -2
- package/lib/types/components/{default → mappers/default}/nullableMapper.d.ts +1 -1
- package/lib/types/components/{default → mappers/default}/objectMapper.d.ts +1 -1
- package/lib/types/components/mappers/default/ofMapper.d.ts +3 -0
- package/lib/types/components/mappers/default/requiredMapper.d.ts +3 -0
- package/lib/types/components/mappers/default/schemaMapper.d.ts +3 -0
- package/lib/types/components/mappers/open-spec/enumsMapper.d.ts +3 -0
- package/lib/types/components/mappers/open-spec/generate.d.ts +1 -0
- package/lib/types/components/mappers/open-spec/nullableMapper.d.ts +3 -0
- package/lib/types/components/{open-spec → mappers/open-spec}/operationInParameterMapper.d.ts +3 -3
- package/lib/types/components/mappers/open-spec/operationInParametersMapper.d.ts +3 -0
- package/lib/types/components/mappers/open-spec/operationMapper.d.ts +3 -0
- package/lib/types/components/mappers/open-spec/operationMediaMapper.d.ts +3 -0
- package/lib/types/components/mappers/open-spec/operationRequestBodyMapper.d.ts +3 -0
- package/lib/types/components/mappers/open-spec/operationResponseMapper.d.ts +3 -0
- package/lib/types/components/{open-spec → mappers/open-spec}/pathsMapper.d.ts +1 -1
- package/lib/types/{domain → components/stores}/JsonClassStore.d.ts +4 -4
- package/lib/types/{domain → components/stores}/JsonMethodStore.d.ts +33 -19
- package/lib/types/{domain → components/stores}/JsonParameterStore.d.ts +9 -5
- package/lib/types/{domain → components/stores}/JsonPropertyStore.d.ts +7 -4
- package/lib/types/components/types/arrayType.d.ts +2 -0
- package/lib/types/components/types/classType.d.ts +2 -0
- package/lib/types/components/types/genericType.d.ts +2 -0
- package/lib/types/components/types/mapType.d.ts +2 -0
- package/lib/types/components/types/primitiveType.d.ts +2 -0
- package/lib/types/components/types/setType.d.ts +2 -0
- package/lib/types/decorators/common/any.d.ts +1 -1
- package/lib/types/decorators/common/examples.d.ts +1 -1
- package/lib/types/decorators/common/format.d.ts +1 -1
- package/lib/types/decorators/common/ignore.d.ts +1 -1
- package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
- package/lib/types/decorators/config/jsonEntityComponent.d.ts +2 -1
- package/lib/types/decorators/generics/genericOf.d.ts +1 -1
- package/lib/types/decorators/operations/header.d.ts +1 -1
- package/lib/types/decorators/operations/in.d.ts +1 -2
- package/lib/types/decorators/operations/location.d.ts +1 -1
- package/lib/types/decorators/operations/redirect.d.ts +1 -1
- package/lib/types/decorators/operations/returns.d.ts +3 -3
- package/lib/types/decorators/operations/status.d.ts +1 -1
- package/lib/types/domain/Generics.d.ts +6 -0
- package/lib/types/domain/JsonEntityStore.d.ts +8 -19
- package/lib/types/domain/JsonLazyRef.d.ts +1 -1
- package/lib/types/domain/JsonMap.d.ts +1 -1
- package/lib/types/domain/JsonMedia.d.ts +1 -1
- package/lib/types/domain/JsonOperation.d.ts +2 -2
- package/lib/types/domain/JsonOperationRoute.d.ts +3 -3
- package/lib/types/domain/JsonParameter.d.ts +3 -3
- package/lib/types/domain/JsonRequestBody.d.ts +1 -1
- package/lib/types/domain/JsonResponse.d.ts +1 -1
- package/lib/types/domain/JsonSchema.d.ts +28 -22
- package/lib/types/{interfaces → domain}/JsonSchemaOptions.d.ts +14 -6
- package/lib/types/domain/__fixtures__/inspectOperationsPaths.d.ts +1 -1
- package/lib/types/domain/index.d.ts +26 -0
- package/lib/types/domain/types.d.ts +1 -1
- package/lib/types/fn/any.d.ts +1 -1
- package/lib/types/fn/boolean.d.ts +1 -1
- package/lib/types/{utils → fn}/compile.d.ts +10 -3
- package/lib/types/fn/date.d.ts +3 -3
- package/lib/types/fn/email.d.ts +1 -1
- package/lib/types/fn/from.d.ts +31 -3
- package/lib/types/fn/generic.d.ts +10 -0
- package/lib/types/fn/index.d.ts +24 -3
- package/lib/types/fn/integer.d.ts +1 -1
- package/lib/types/fn/lazyRef.d.ts +1 -1
- package/lib/types/fn/number.d.ts +1 -1
- package/lib/types/fn/oas/compileSpec.d.ts +6 -0
- package/lib/types/{utils → fn/oas}/getSpec.d.ts +1 -1
- package/lib/types/{utils → fn/oas}/getSpecType.d.ts +1 -1
- package/lib/types/{utils → fn/oas}/transformToOS2.d.ts +1 -1
- package/lib/types/fn/object.d.ts +1 -1
- package/lib/types/fn/string.d.ts +1 -1
- package/lib/types/fn/uri.d.ts +1 -1
- package/lib/types/fn/url.d.ts +1 -1
- package/lib/types/hooks/alterOneOf.d.ts +1 -1
- package/lib/types/hooks/alterRequiredGroups.d.ts +1 -1
- package/lib/types/index.d.ts +59 -48
- package/lib/types/{utils/getJsonEntityStore.d.ts → registries/JsonEntitiesContainer.d.ts} +5 -10
- package/lib/types/registries/JsonSchemaMapperContainer.d.ts +7 -1
- package/lib/types/registries/JsonTypesContainer.d.ts +15 -0
- package/lib/types/registries/{enumRegistries.d.ts → enumRegistry.d.ts} +1 -1
- package/lib/types/utils/generics.d.ts +13 -5
- package/lib/types/utils/getInheritedStores.d.ts +1 -1
- package/lib/types/utils/getOperationsRoutes.d.ts +3 -3
- package/lib/types/utils/getOperationsStores.d.ts +1 -1
- package/lib/types/utils/getPropertiesStores.d.ts +1 -1
- package/lib/types/utils/mapHeaders.d.ts +1 -1
- package/lib/types/utils/operationIdFormatter.d.ts +1 -1
- package/lib/types/utils/ref.d.ts +1 -1
- package/lib/types/utils/removeHiddenOperation.d.ts +1 -1
- package/lib/types/utils/toJsonMapCollection.d.ts +1 -1
- package/package.json +19 -19
- package/vitest.setup.ts +6 -0
- package/lib/esm/components/default/ofMapper.js +0 -9
- package/lib/esm/components/open-spec/discriminatorMappingMapper.js +0 -6
- package/lib/esm/components/open-spec/enumsMapper.js +0 -14
- package/lib/esm/components/open-spec/operationInParametersMapper.js +0 -5
- package/lib/esm/utils/compile.js +0 -13
- package/lib/esm/utils/getJsonEntityStore.js +0 -13
- package/lib/types/components/default/classMapper.d.ts +0 -3
- package/lib/types/components/default/enumsMapper.d.ts +0 -3
- package/lib/types/components/default/lazyRefMapper.d.ts +0 -3
- package/lib/types/components/default/ofMapper.d.ts +0 -3
- package/lib/types/components/default/requiredMapper.d.ts +0 -3
- package/lib/types/components/default/schemaMapper.d.ts +0 -3
- package/lib/types/components/open-spec/enumsMapper.d.ts +0 -3
- package/lib/types/components/open-spec/nullableMapper.d.ts +0 -3
- package/lib/types/components/open-spec/operationInParametersMapper.d.ts +0 -3
- package/lib/types/components/open-spec/operationMapper.d.ts +0 -3
- package/lib/types/components/open-spec/operationMediaMapper.d.ts +0 -3
- package/lib/types/components/open-spec/operationRequestBodyMapper.d.ts +0 -3
- package/lib/types/components/open-spec/operationResponseMapper.d.ts +0 -3
- package/lib/types/utils/getJsonSchema.d.ts +0 -6
- package/lib/esm/{interfaces/IgnoreCallback.js → domain/Generics.js} +0 -0
- package/lib/esm/{interfaces/JsonHookContext.js → domain/IgnoreCallback.js} +0 -0
- package/lib/esm/{interfaces/JsonOpenSpec.js → domain/JsonHookContext.js} +0 -0
- package/lib/esm/{interfaces/JsonSchemaOptions.js → domain/JsonOpenSpec.js} +0 -0
- package/lib/{types/components/open-spec/discriminatorMappingMapper.d.ts → esm/domain/JsonSchemaOptions.js} +0 -0
- package/lib/esm/{utils → fn/oas}/mapOpenSpec2.js +0 -0
- package/lib/esm/{utils → fn/oas}/mapOpenSpec3.js +0 -0
- package/lib/esm/{utils → fn/oas}/mapOpenSpecInfo.js +0 -0
- package/lib/esm/{utils → fn/oas}/mergeSpec.js +0 -0
- package/lib/esm/{utils → fn/oas}/transformToOS2.js +0 -0
- package/lib/esm/registries/{enumRegistries.js → enumRegistry.js} +0 -0
- package/lib/types/components/{open-spec/generate.d.ts → mappers/open-spec/discriminatorMappingMapper.d.ts} +0 -0
- package/lib/types/components/{open-spec → mappers/open-spec}/operationInFilesMapper.d.ts +0 -0
- package/lib/types/components/{open-spec → mappers/open-spec}/operationInQueryMapper.d.ts +0 -0
- package/lib/types/{interfaces → domain}/IgnoreCallback.d.ts +0 -0
- package/lib/types/{interfaces → domain}/JsonHookContext.d.ts +0 -0
- package/lib/types/{interfaces → domain}/JsonOpenSpec.d.ts +0 -0
- package/lib/types/{utils → fn/oas}/generateSpec.d.ts +1 -1
- /package/lib/types/{utils → fn/oas}/mapOpenSpec.d.ts +0 -0
- /package/lib/types/{utils → fn/oas}/mapOpenSpec2.d.ts +0 -0
- /package/lib/types/{utils → fn/oas}/mapOpenSpec3.d.ts +0 -0
- /package/lib/types/{utils → fn/oas}/mapOpenSpecInfo.d.ts +0 -0
- /package/lib/types/{utils → fn/oas}/mergeSpec.d.ts +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getJsonEntityStore, getJsonMethodStore } from "./registries/JsonEntitiesContainer.js";
|
|
2
|
+
import { JsonEntityStore } from "./domain/index.js";
|
|
3
|
+
import { JsonMethodStore } from "./components/index.js";
|
|
4
|
+
const CompatJsonEntityStore = JsonEntityStore;
|
|
5
|
+
CompatJsonEntityStore.get = getJsonEntityStore;
|
|
6
|
+
CompatJsonEntityStore.from = getJsonEntityStore;
|
|
7
|
+
CompatJsonEntityStore.fromMethod = getJsonMethodStore;
|
|
8
|
+
JsonMethodStore.get = getJsonMethodStore;
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Automatically generated by @tsed/barrels.
|
|
3
3
|
*/
|
|
4
|
-
export * from "./default/anyMapper.js";
|
|
5
|
-
export * from "./default/classMapper.js";
|
|
6
|
-
export * from "./default/discriminatorMappingMapper.js";
|
|
7
|
-
export * from "./default/enumsMapper.js";
|
|
8
|
-
export * from "./default/genericsMapper.js";
|
|
9
|
-
export * from "./default/inheritedClassMapper.js";
|
|
10
|
-
export * from "./default/lazyRefMapper.js";
|
|
11
|
-
export * from "./default/mapMapper.js";
|
|
12
|
-
export * from "./default/nextMapper.js";
|
|
13
|
-
export * from "./default/nullableMapper.js";
|
|
14
|
-
export * from "./default/objectMapper.js";
|
|
15
|
-
export * from "./default/ofMapper.js";
|
|
16
|
-
export * from "./default/requiredMapper.js";
|
|
17
|
-
export * from "./default/schemaMapper.js";
|
|
18
|
-
export * from "./open-spec/discriminatorMappingMapper.js";
|
|
19
|
-
export * from "./open-spec/enumsMapper.js";
|
|
20
|
-
export * from "./open-spec/generate.js";
|
|
21
|
-
export * from "./open-spec/nullableMapper.js";
|
|
22
|
-
export * from "./open-spec/operationInFilesMapper.js";
|
|
23
|
-
export * from "./open-spec/operationInParameterMapper.js";
|
|
24
|
-
export * from "./open-spec/operationInParametersMapper.js";
|
|
25
|
-
export * from "./open-spec/operationInQueryMapper.js";
|
|
26
|
-
export * from "./open-spec/operationMapper.js";
|
|
27
|
-
export * from "./open-spec/operationMediaMapper.js";
|
|
28
|
-
export * from "./open-spec/operationRequestBodyMapper.js";
|
|
29
|
-
export * from "./open-spec/operationResponseMapper.js";
|
|
30
|
-
export * from "./open-spec/pathsMapper.js";
|
|
4
|
+
export * from "./mappers/default/anyMapper.js";
|
|
5
|
+
export * from "./mappers/default/classMapper.js";
|
|
6
|
+
export * from "./mappers/default/discriminatorMappingMapper.js";
|
|
7
|
+
export * from "./mappers/default/enumsMapper.js";
|
|
8
|
+
export * from "./mappers/default/genericsMapper.js";
|
|
9
|
+
export * from "./mappers/default/inheritedClassMapper.js";
|
|
10
|
+
export * from "./mappers/default/lazyRefMapper.js";
|
|
11
|
+
export * from "./mappers/default/mapMapper.js";
|
|
12
|
+
export * from "./mappers/default/nextMapper.js";
|
|
13
|
+
export * from "./mappers/default/nullableMapper.js";
|
|
14
|
+
export * from "./mappers/default/objectMapper.js";
|
|
15
|
+
export * from "./mappers/default/ofMapper.js";
|
|
16
|
+
export * from "./mappers/default/requiredMapper.js";
|
|
17
|
+
export * from "./mappers/default/schemaMapper.js";
|
|
18
|
+
export * from "./mappers/open-spec/discriminatorMappingMapper.js";
|
|
19
|
+
export * from "./mappers/open-spec/enumsMapper.js";
|
|
20
|
+
export * from "./mappers/open-spec/generate.js";
|
|
21
|
+
export * from "./mappers/open-spec/nullableMapper.js";
|
|
22
|
+
export * from "./mappers/open-spec/operationInFilesMapper.js";
|
|
23
|
+
export * from "./mappers/open-spec/operationInParameterMapper.js";
|
|
24
|
+
export * from "./mappers/open-spec/operationInParametersMapper.js";
|
|
25
|
+
export * from "./mappers/open-spec/operationInQueryMapper.js";
|
|
26
|
+
export * from "./mappers/open-spec/operationMapper.js";
|
|
27
|
+
export * from "./mappers/open-spec/operationMediaMapper.js";
|
|
28
|
+
export * from "./mappers/open-spec/operationRequestBodyMapper.js";
|
|
29
|
+
export * from "./mappers/open-spec/operationResponseMapper.js";
|
|
30
|
+
export * from "./mappers/open-spec/pathsMapper.js";
|
|
31
|
+
export * from "./stores/JsonClassStore.js";
|
|
32
|
+
export * from "./stores/JsonMethodStore.js";
|
|
33
|
+
export * from "./stores/JsonParameterStore.js";
|
|
34
|
+
export * from "./stores/JsonPropertyStore.js";
|
|
35
|
+
export * from "./types/arrayType.js";
|
|
36
|
+
export * from "./types/classType.js";
|
|
37
|
+
export * from "./types/genericType.js";
|
|
38
|
+
export * from "./types/mapType.js";
|
|
39
|
+
export * from "./types/primitiveType.js";
|
|
40
|
+
export * from "./types/setType.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { toRef } from "
|
|
1
|
+
import { defineSchemaMapper, execMapper, execOneOfMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { JsonLazyRef } from "../../../domain/JsonLazyRef.js";
|
|
3
|
+
import { JsonSchema } from "../../../domain/JsonSchema.js";
|
|
4
|
+
import { toRef } from "../../../utils/ref.js";
|
|
5
5
|
export function anyMapper(input, options = {}) {
|
|
6
6
|
if (typeof input !== "object" || input === null) {
|
|
7
7
|
return input;
|
|
@@ -20,4 +20,4 @@ export function anyMapper(input, options = {}) {
|
|
|
20
20
|
}
|
|
21
21
|
return execMapper("object", [input], options);
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
defineSchemaMapper({ type: "any", transform: anyMapper });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createRef, createRefName } from "../../../utils/ref.js";
|
|
2
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
1
3
|
import { getValue, setValue } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import { execMapper, registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js";
|
|
4
|
-
import { createRef, createRefName } from "../../utils/ref.js";
|
|
4
|
+
import { getJsonEntityStore } from "../../../registries/JsonEntitiesContainer.js";
|
|
5
5
|
export function classMapper(value, options) {
|
|
6
|
-
const store =
|
|
6
|
+
const store = getJsonEntityStore(value.class);
|
|
7
7
|
const name = createRefName(store.schema.getName() || value.getName(), options);
|
|
8
8
|
if (!getValue(options, `components.schemas.${name}`)) {
|
|
9
9
|
// avoid infinite calls
|
|
@@ -15,4 +15,4 @@ export function classMapper(value, options) {
|
|
|
15
15
|
}
|
|
16
16
|
return createRef(name, value, options);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
defineSchemaMapper({ type: "class", transform: classMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
1
2
|
import { isString } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import { toRef } from "../../utils/ref.js";
|
|
3
|
+
import { toRef } from "../../../utils/ref.js";
|
|
4
4
|
export function discriminatorMappingMapper(obj, _, options) {
|
|
5
5
|
if (obj.discriminator?.mapping) {
|
|
6
6
|
const entries = Object.entries(obj.discriminator.mapping);
|
|
@@ -18,4 +18,4 @@ function defaultDiscriminatorMappingMapper(obj) {
|
|
|
18
18
|
}
|
|
19
19
|
return obj;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
defineSchemaMapper({ type: "discriminatorMapping", transform: defaultDiscriminatorMappingMapper });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function enumsMapper(obj, schema, options) {
|
|
3
3
|
if (options.inlineEnums && obj.enum?.$isJsonDocument) {
|
|
4
4
|
obj.enum = obj.enum.toJSON().enum;
|
|
@@ -8,4 +8,4 @@ export function enumsMapper(obj, schema, options) {
|
|
|
8
8
|
}
|
|
9
9
|
return obj;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
defineSchemaMapper({ type: "enums", transform: enumsMapper });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { isObject } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import { JsonSchema } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { JsonSchema } from "../../../domain/JsonSchema.js";
|
|
4
|
+
import { VendorKeys } from "../../../constants/VendorKeys.js";
|
|
5
|
+
import { s } from "../../../fn/index.js";
|
|
6
|
+
import { toRef } from "../../../utils/ref.js";
|
|
6
7
|
function getNestedSchema(propertyKey, schema, options) {
|
|
7
8
|
if ("isLazyRef" in schema) {
|
|
8
9
|
return null;
|
|
@@ -14,7 +15,7 @@ function getNestedSchema(propertyKey, schema, options) {
|
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
17
|
const [model, next] = genericValue;
|
|
17
|
-
const refSchema = JsonSchema.
|
|
18
|
+
const refSchema = model instanceof JsonSchema ? model : s.get(model);
|
|
18
19
|
const modelSchema = execMapper("schema", [refSchema], {
|
|
19
20
|
...options,
|
|
20
21
|
generics: next
|
|
@@ -68,4 +69,4 @@ export function genericsMapper(baseObj, schema, options) {
|
|
|
68
69
|
}
|
|
69
70
|
return baseObj;
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
+
defineSchemaMapper({ type: "generics", transform: genericsMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { classOf, deepMerge } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import { getInheritedStores } from "
|
|
2
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { getInheritedStores } from "../../../utils/getInheritedStores.js";
|
|
4
4
|
function alterMerge(_, obj) {
|
|
5
5
|
if (obj?.type && obj?.$ref) {
|
|
6
6
|
const { $ref, ...schema } = obj;
|
|
@@ -30,4 +30,4 @@ export function inheritedClassMapper(obj, { target, ...options }) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
defineSchemaMapper({ type: "inheritedClass", transform: inheritedClassMapper });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { createRef, toRef } from "../../../utils/ref.js";
|
|
2
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
3
|
export function lazyRefMapper(jsonLazyRef, options) {
|
|
4
4
|
const name = jsonLazyRef.name;
|
|
5
5
|
if (options.$refs?.find((t) => t === jsonLazyRef.target)) {
|
|
@@ -9,4 +9,4 @@ export function lazyRefMapper(jsonLazyRef, options) {
|
|
|
9
9
|
const schema = jsonLazyRef.getType() && execMapper("schema", [jsonLazyRef.schema], options);
|
|
10
10
|
return toRef(jsonLazyRef.schema, schema, options);
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
defineSchemaMapper({ type: "lazyRef", transform: lazyRefMapper });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
/**
|
|
3
3
|
* Serialize class which inherit from Map like JsonMap, JsonOperation, JsonParameter.
|
|
4
4
|
* @param input
|
|
@@ -15,4 +15,4 @@ export function mapMapper(input, { ignore = [], ...options } = {}) {
|
|
|
15
15
|
return obj;
|
|
16
16
|
}, {});
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
defineSchemaMapper({ type: "map", transform: mapMapper });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getGenericsOptions } from "
|
|
4
|
-
import { mergeSchema } from "
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { JsonSchema } from "../../../domain/JsonSchema.js";
|
|
3
|
+
import { getGenericsOptions } from "../../../utils/generics.js";
|
|
4
|
+
import { mergeSchema } from "../../../utils/mergeSchema.js";
|
|
5
5
|
function getMapper(input, mapper, root) {
|
|
6
6
|
if (input.isClass && !input.isLocalSchema && !root) {
|
|
7
7
|
return mapper || "class";
|
|
@@ -60,15 +60,15 @@ export function nextMapper(input, options) {
|
|
|
60
60
|
mapper: undefined
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
defineSchemaMapper({ type: "item", transform: itemMapper });
|
|
64
|
+
defineSchemaMapper({ type: "next", transform: nextMapper });
|
|
65
|
+
defineSchemaMapper({ type: "properties", transform: nextMapper });
|
|
66
|
+
defineSchemaMapper({ type: "items", transform: nextMapper });
|
|
67
|
+
defineSchemaMapper({ type: "additionalProperties", transform: nextMapper });
|
|
68
|
+
defineSchemaMapper({ type: "propertyNames", transform: nextMapper });
|
|
69
|
+
defineSchemaMapper({ type: "contains", transform: nextMapper });
|
|
70
|
+
defineSchemaMapper({ type: "dependencies", transform: nextMapper });
|
|
71
|
+
defineSchemaMapper({ type: "patternProperties", transform: nextMapper });
|
|
72
|
+
defineSchemaMapper({ type: "additionalItems", transform: nextMapper });
|
|
73
|
+
defineSchemaMapper({ type: "not", transform: nextMapper });
|
|
74
|
+
defineSchemaMapper({ type: "definitions", transform: nextMapper });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MANY_OF_PROPERTIES } from "../../../constants/jsonSchemaProperties.js";
|
|
1
2
|
import { cleanObject } from "@tsed/core/utils/cleanObject.js";
|
|
3
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
4
|
import { uniq } from "@tsed/core/utils/uniq.js";
|
|
3
|
-
import { MANY_OF_PROPERTIES } from "../../constants/jsonSchemaProperties.js";
|
|
4
|
-
import { registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js";
|
|
5
5
|
export function nullableMapper(obj, schema) {
|
|
6
6
|
if (!schema?.isNullable || obj.discriminator) {
|
|
7
7
|
return obj;
|
|
@@ -55,4 +55,4 @@ export function nullableMapper(obj, schema) {
|
|
|
55
55
|
}
|
|
56
56
|
return obj;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
defineSchemaMapper({ type: "nullable", transform: nullableMapper });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { VendorKeys } from "../../../constants/VendorKeys.js";
|
|
3
|
+
import { alterIgnore } from "../../../hooks/alterIgnore.js";
|
|
1
4
|
import { isArray } from "@tsed/core";
|
|
2
|
-
import { VendorKeys } from "../../constants/VendorKeys.js";
|
|
3
|
-
import { alterIgnore } from "../../hooks/alterIgnore.js";
|
|
4
|
-
import { execMapper, registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js";
|
|
5
5
|
/**
|
|
6
6
|
* Serialize Any object to a json schema
|
|
7
7
|
* @param input
|
|
@@ -27,4 +27,4 @@ export function objectMapper(input, options) {
|
|
|
27
27
|
return obj;
|
|
28
28
|
}, isArray(input) ? [] : {});
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
defineSchemaMapper({ type: "object", transform: objectMapper });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
export function ofMapper(input, options) {
|
|
3
|
+
return input.map((value) => {
|
|
4
|
+
return execMapper("item", [value], options);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
defineSchemaMapper({ type: "anyOf", transform: ofMapper });
|
|
8
|
+
defineSchemaMapper({ type: "allOf", transform: ofMapper });
|
|
9
|
+
defineSchemaMapper({ type: "oneOf", transform: ofMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { alterRequiredGroups } from "../../../hooks/alterRequiredGroups.js";
|
|
2
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
1
3
|
import { uniq } from "@tsed/core";
|
|
2
|
-
import { alterRequiredGroups } from "../../hooks/alterRequiredGroups.js";
|
|
3
|
-
import { registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js";
|
|
4
4
|
function mapRequiredProps(obj, schema, options = {}) {
|
|
5
5
|
const { useAlias } = options;
|
|
6
6
|
const props = Object.keys(obj.properties || {});
|
|
@@ -45,4 +45,4 @@ export function requiredMapper(obj, schema, options) {
|
|
|
45
45
|
}
|
|
46
46
|
return obj;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
defineSchemaMapper({ type: "required", transform: requiredMapper });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { defineSchemaMapper, execMapper, hasMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
1
2
|
import { getValue, isFunction, isObject } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { SpecTypes } from "../../../domain/SpecTypes.js";
|
|
4
|
+
import { alterOneOf } from "../../../hooks/alterOneOf.js";
|
|
5
|
+
import { getGenerics } from "../../../utils/generics.js";
|
|
6
|
+
import { mapAliasedProperties } from "../../../domain/JsonAliasMap.js";
|
|
6
7
|
/**
|
|
7
8
|
* @ignore
|
|
8
9
|
*/
|
|
@@ -111,10 +112,14 @@ function serializeSchema(schema, options) {
|
|
|
111
112
|
}
|
|
112
113
|
export function schemaMapper(schema, opts) {
|
|
113
114
|
const { options, addDef } = mapOptions(opts);
|
|
114
|
-
const
|
|
115
|
+
const generics = getGenerics(schema, options);
|
|
116
|
+
const obj = serializeSchema(schema, {
|
|
117
|
+
...options,
|
|
118
|
+
generics
|
|
119
|
+
});
|
|
115
120
|
if (addDef && Object.keys(getValue(options, "components.schemas", {})).length) {
|
|
116
121
|
obj.definitions = options.components.schemas;
|
|
117
122
|
}
|
|
118
123
|
return obj;
|
|
119
124
|
}
|
|
120
|
-
|
|
125
|
+
defineSchemaMapper({ type: "schema", transform: schemaMapper });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SpecTypes } from "../../../domain/SpecTypes.js";
|
|
2
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { discriminatorMappingMapper } from "../default/discriminatorMappingMapper.js";
|
|
4
|
+
defineSchemaMapper({
|
|
5
|
+
type: "discriminatorMapping",
|
|
6
|
+
transform: discriminatorMappingMapper,
|
|
7
|
+
spec: [SpecTypes.OPENAPI, SpecTypes.SWAGGER, SpecTypes.ASYNCAPI]
|
|
8
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SpecTypes } from "../../../domain/index.js";
|
|
2
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { enumsMapper } from "../default/enumsMapper.js";
|
|
4
|
+
export function wrapEnumsMapper(obj, schema, options) {
|
|
5
|
+
obj = enumsMapper(obj, schema, options);
|
|
6
|
+
if (obj.const !== undefined) {
|
|
7
|
+
obj.enum = [obj.const];
|
|
8
|
+
delete obj.const;
|
|
9
|
+
}
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
defineSchemaMapper({ type: "enums", transform: wrapEnumsMapper, spec: [SpecTypes.OPENAPI, SpecTypes.SWAGGER, SpecTypes.ASYNCAPI] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getValue, uniqBy } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { SpecTypes } from "../../../domain/SpecTypes.js";
|
|
4
4
|
function generate(model, options) {
|
|
5
5
|
options = {
|
|
6
6
|
...options,
|
|
@@ -17,5 +17,4 @@ function generate(model, options) {
|
|
|
17
17
|
}
|
|
18
18
|
return specJson;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
registerJsonSchemaMapper("generate", generate, SpecTypes.SWAGGER);
|
|
20
|
+
defineSchemaMapper({ type: "generate", transform: generate, spec: [SpecTypes.OPENAPI, SpecTypes.SWAGGER] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { SpecTypes } from "../../../domain/SpecTypes.js";
|
|
1
2
|
import { cleanObject } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import { registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
4
4
|
import { nullableMapper } from "../default/nullableMapper.js";
|
|
5
5
|
export function nullableMapperOpenApi(obj, schema, options) {
|
|
6
6
|
if (!schema?.isNullable) {
|
|
@@ -43,5 +43,4 @@ export function nullableMapperOpenApi(obj, schema, options) {
|
|
|
43
43
|
nullable: true
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
registerJsonSchemaMapper("nullable", nullableMapperOpenApi, SpecTypes.SWAGGER);
|
|
46
|
+
defineSchemaMapper({ type: "nullable", transform: nullableMapperOpenApi, spec: [SpecTypes.OPENAPI, SpecTypes.SWAGGER] });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cleanObject } from "@tsed/core";
|
|
2
|
-
import {
|
|
2
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
3
|
export function operationInFilesMapper(parameter, { jsonSchema }) {
|
|
4
4
|
const schema = {
|
|
5
5
|
type: "string",
|
|
@@ -20,4 +20,4 @@ export function operationInFilesMapper(parameter, { jsonSchema }) {
|
|
|
20
20
|
});
|
|
21
21
|
return parameter;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
defineSchemaMapper({ type: "operationInFiles", transform: operationInFilesMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { defineSchemaMapper, execMapper, hasMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { JsonParameterTypes } from "../../../domain/JsonParameterTypes.js";
|
|
1
3
|
import { camelCase } from "change-case";
|
|
2
|
-
import { JsonParameterTypes } from "../../domain/JsonParameterTypes.js";
|
|
3
|
-
import { execMapper, hasMapper, registerJsonSchemaMapper } from "../../registries/JsonSchemaMapperContainer.js";
|
|
4
4
|
function mapOptions(parameter, options = {}) {
|
|
5
5
|
return {
|
|
6
6
|
...options,
|
|
@@ -27,4 +27,4 @@ export function operationInParameterMapper(jsonParameter, opts) {
|
|
|
27
27
|
parameter.schema = jsonSchema;
|
|
28
28
|
return parameter;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
defineSchemaMapper({ type: "operationInParameter", transform: operationInParameterMapper });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
export function operationInParametersMapper(parameters, options) {
|
|
3
|
+
return parameters.flatMap((parameter) => execMapper("operationInParameter", [parameter], options)).filter(Boolean);
|
|
4
|
+
}
|
|
5
|
+
defineSchemaMapper({ type: "operationInParameters", transform: operationInParametersMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { createRefName, getSchemaFromRef } from "../../../utils/ref.js";
|
|
1
2
|
import { cleanObject } from "@tsed/core";
|
|
2
|
-
import {
|
|
3
|
-
import { createRefName, getSchemaFromRef } from "../../utils/ref.js";
|
|
3
|
+
import { defineSchemaMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
4
4
|
function buildExamples(property, examples) {
|
|
5
5
|
if (!examples) {
|
|
6
6
|
return undefined;
|
|
@@ -58,4 +58,4 @@ export function operationInQueryMapper(parameter, { jsonSchema, ...options }) {
|
|
|
58
58
|
parameter.schema = jsonSchema;
|
|
59
59
|
return parameter;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
defineSchemaMapper({ type: "operationInQuery", transform: operationInQueryMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { JsonParameterTypes, isParameterType } from "../../../domain/JsonParameterTypes.js";
|
|
2
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { getStatusMessage } from "../../../constants/httpStatusMessages.js";
|
|
4
4
|
function extractParameters(jsonOperation, options) {
|
|
5
5
|
return jsonOperation
|
|
6
6
|
.get("parameters")
|
|
@@ -41,4 +41,4 @@ export function operationMapper(jsonOperation, { tags = [], defaultTags = [], ..
|
|
|
41
41
|
tags.push(...operationTags);
|
|
42
42
|
return operation;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
defineSchemaMapper({ type: "operation", transform: operationMapper });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function operationMediaMapper(jsonMedia, options) {
|
|
3
3
|
return execMapper("map", [jsonMedia], {
|
|
4
4
|
...options,
|
|
@@ -6,4 +6,4 @@ export function operationMediaMapper(jsonMedia, options) {
|
|
|
6
6
|
groupsName: jsonMedia.schema().getGroupsName()
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
defineSchemaMapper({ type: "operationMedia", transform: operationMediaMapper });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { JsonRequestBody } from "../../../domain/JsonRequestBody.js";
|
|
3
|
+
import { JsonSchema } from "../../../domain/JsonSchema.js";
|
|
4
4
|
function buildSchemaFromBodyParameters(parameters, options) {
|
|
5
5
|
let schema = new JsonSchema();
|
|
6
6
|
const props = {};
|
|
@@ -60,4 +60,4 @@ export function operationRequestBodyMapper(bodyParameters, { consumes, ...option
|
|
|
60
60
|
});
|
|
61
61
|
return execMapper("map", [requestBody], options);
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
defineSchemaMapper({ type: "operationRequestBody", transform: operationRequestBodyMapper });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function operationResponseMapper(jsonResponse, options = {}) {
|
|
3
3
|
const response = execMapper("map", [jsonResponse], options);
|
|
4
4
|
if (jsonResponse.status === 204) {
|
|
@@ -16,4 +16,4 @@ export function operationResponseMapper(jsonResponse, options = {}) {
|
|
|
16
16
|
}
|
|
17
17
|
return response;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
defineSchemaMapper({ type: "operationResponse", transform: operationResponseMapper });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { buildPath } from "
|
|
4
|
-
import { concatParameters } from "
|
|
5
|
-
import { getJsonEntityStore } from "
|
|
6
|
-
import { getJsonPathParameters } from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { removeHiddenOperation } from "
|
|
1
|
+
import { defineSchemaMapper, execMapper } from "../../../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { OperationVerbs } from "../../../constants/OperationVerbs.js";
|
|
3
|
+
import { buildPath } from "../../../utils/buildPath.js";
|
|
4
|
+
import { concatParameters } from "../../../utils/concatParameters.js";
|
|
5
|
+
import { getJsonEntityStore } from "../../../registries/JsonEntitiesContainer.js";
|
|
6
|
+
import { getJsonPathParameters } from "../../../utils/getJsonPathParameters.js";
|
|
7
|
+
import { getOperationId } from "../../../utils/operationIdFormatter.js";
|
|
8
|
+
import { getOperationsStores } from "../../../utils/getOperationsStores.js";
|
|
9
|
+
import { removeHiddenOperation } from "../../../utils/removeHiddenOperation.js";
|
|
10
10
|
const ALLOWED_VERBS = [
|
|
11
11
|
OperationVerbs.ALL,
|
|
12
12
|
OperationVerbs.GET,
|
|
@@ -88,4 +88,4 @@ export function pathsMapper(model, { paths, rootPath, ...options }) {
|
|
|
88
88
|
.flatMap(mapOperationInPathParameters(options))
|
|
89
89
|
.reduce(pushToPath, paths);
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
defineSchemaMapper({ type: "paths", transform: pathsMapper });
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsonEntityStore, JsonSchema } from "../../domain/index.js";
|
|
2
2
|
import { DecoratorTypes } from "@tsed/core";
|
|
3
|
-
import {
|
|
4
|
-
import { JsonEntityStore } from "./JsonEntityStore.js";
|
|
5
|
-
import { JsonSchema } from "./JsonSchema.js";
|
|
3
|
+
import { defineStore } from "../../registries/JsonEntitiesContainer.js";
|
|
6
4
|
/**
|
|
7
5
|
* Store for class-level metadata and schema information.
|
|
8
6
|
*
|
|
@@ -23,10 +21,10 @@ import { JsonSchema } from "./JsonSchema.js";
|
|
|
23
21
|
*
|
|
24
22
|
* ```typescript
|
|
25
23
|
* // Get class store
|
|
26
|
-
* const classStore =
|
|
24
|
+
* const classStore = s.store(MyClass);
|
|
27
25
|
*
|
|
28
26
|
* // Access class schema
|
|
29
|
-
* const schema =
|
|
27
|
+
* const schema = s.get(MyClass);
|
|
30
28
|
*
|
|
31
29
|
* // Get all properties
|
|
32
30
|
* const properties = classStore.children;
|
|
@@ -78,7 +76,7 @@ import { JsonSchema } from "./JsonSchema.js";
|
|
|
78
76
|
*
|
|
79
77
|
* @public
|
|
80
78
|
*/
|
|
81
|
-
|
|
79
|
+
export class JsonClassStore extends JsonEntityStore {
|
|
82
80
|
constructor() {
|
|
83
81
|
super(...arguments);
|
|
84
82
|
/**
|
|
@@ -97,12 +95,9 @@ let JsonClassStore = class JsonClassStore extends JsonEntityStore {
|
|
|
97
95
|
this.buildType(this.target);
|
|
98
96
|
}
|
|
99
97
|
this._type = this._type || Object;
|
|
100
|
-
this._schema = JsonSchema
|
|
98
|
+
this._schema = new JsonSchema({
|
|
101
99
|
type: this.type
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
|
-
}
|
|
105
|
-
JsonClassStore
|
|
106
|
-
JsonEntityComponent(DecoratorTypes.CLASS)
|
|
107
|
-
], JsonClassStore);
|
|
108
|
-
export { JsonClassStore };
|
|
102
|
+
}
|
|
103
|
+
defineStore(DecoratorTypes.CLASS, JsonClassStore);
|