@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
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { JsonSchema } from "../../domain/JsonSchema.js";
|
|
1
|
+
import { DecoratorTypes, UnsupportedDecoratorType, decorateMethodsOf } from "@tsed/core";
|
|
2
|
+
import { JsonParameter, JsonSchema } from "../../domain/index.js";
|
|
3
|
+
import { s } from "../../fn/index.js";
|
|
5
4
|
/**
|
|
6
5
|
* Add a input parameter.
|
|
7
6
|
*
|
|
@@ -31,7 +30,7 @@ export function In(inType) {
|
|
|
31
30
|
const jsonParameter = new JsonParameter();
|
|
32
31
|
const schema = {};
|
|
33
32
|
const decorator = (target, propertyKey, index) => {
|
|
34
|
-
const store =
|
|
33
|
+
const store = s.store(target, propertyKey, index);
|
|
35
34
|
switch (store.decoratorType) {
|
|
36
35
|
case DecoratorTypes.PARAM:
|
|
37
36
|
store.parameter.in(inType);
|
|
@@ -39,7 +38,7 @@ export function In(inType) {
|
|
|
39
38
|
case DecoratorTypes.METHOD:
|
|
40
39
|
jsonParameter.in(inType);
|
|
41
40
|
store.operation.addParameter(-1, jsonParameter);
|
|
42
|
-
jsonParameter.schema(JsonSchema
|
|
41
|
+
jsonParameter.schema(new JsonSchema(schema));
|
|
43
42
|
break;
|
|
44
43
|
case DecoratorTypes.CLASS:
|
|
45
44
|
decorateMethodsOf(target, decorator);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Metadata, useDecorators, useMethodDecorators } from "@tsed/core";
|
|
2
|
-
import { JsonParameterTypes } from "../../domain/JsonParameterTypes.js";
|
|
3
|
-
import { Name } from "../common/name.js";
|
|
4
2
|
import { Consumes } from "./consumes.js";
|
|
5
3
|
import { In } from "./in.js";
|
|
4
|
+
import { JsonParameterTypes } from "../../domain/JsonParameterTypes.js";
|
|
5
|
+
import { Name } from "../common/name.js";
|
|
6
6
|
import { Returns } from "./returns.js";
|
|
7
7
|
/**
|
|
8
8
|
* Add a input file parameter.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DecoratorContext } from "../../domain/index.js";
|
|
1
2
|
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
2
|
-
import { DecoratorContext } from "../../domain/DecoratorContext.js";
|
|
3
3
|
import { mapOperationOptions } from "../../utils/mapOperationOptions.js";
|
|
4
4
|
class OperationDecoratorContext extends DecoratorContext {
|
|
5
5
|
constructor() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DecoratorTypes, UnsupportedDecoratorType, decorateMethodsOf } from "@tsed/core";
|
|
2
2
|
import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
3
3
|
/**
|
|
4
4
|
* Add produces metadata on the decorated element.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
2
1
|
import { Operation } from "./operation.js";
|
|
2
|
+
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
3
3
|
export function Publish(event) {
|
|
4
4
|
return Operation(OperationVerbs.PUBLISH, event);
|
|
5
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DecoratorContext } from "../../domain/index.js";
|
|
2
|
+
import { DecoratorTypes, decorateMethodsOf, decoratorTypeOf, isArray, isClass, isCollection, isPlainObject, isPrimitiveOrPrimitiveClass, isString } from "@tsed/core";
|
|
2
3
|
import { getStatusMessage } from "../../constants/httpStatusMessages.js";
|
|
3
|
-
import { DecoratorContext } from "../../domain/DecoratorContext.js";
|
|
4
|
-
import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
|
|
5
4
|
import { getStatusModel } from "../../utils/defineStatusModel.js";
|
|
6
5
|
import { mapHeaders } from "../../utils/mapHeaders.js";
|
|
6
|
+
import { s } from "../../fn/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
@@ -184,7 +184,7 @@ class ReturnDecoratorContext extends DecoratorContext {
|
|
|
184
184
|
const type = decoratorTypeOf(args);
|
|
185
185
|
switch (type) {
|
|
186
186
|
case DecoratorTypes.METHOD:
|
|
187
|
-
this.entity =
|
|
187
|
+
this.entity = s.store(...args);
|
|
188
188
|
if (this.entity.operation) {
|
|
189
189
|
this.map();
|
|
190
190
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
2
1
|
import { Operation } from "./operation.js";
|
|
2
|
+
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
3
3
|
/**
|
|
4
4
|
* This method is just like the `router.METHOD()` methods, except that it matches all HTTP methods (verbs).
|
|
5
5
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DecoratorTypes, UnsupportedDecoratorType, decorateMethodsOf } from "@tsed/core";
|
|
2
2
|
import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
3
3
|
export function Security(nameOrSecurity, ...scopes) {
|
|
4
4
|
return JsonEntityFn((store, args) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
2
1
|
import { Operation } from "./operation.js";
|
|
2
|
+
import { OperationVerbs } from "../../constants/OperationVerbs.js";
|
|
3
3
|
export function Subscribe(event) {
|
|
4
4
|
return Operation(OperationVerbs.SUBSCRIBE, event);
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DecoratorTypes, UnsupportedDecoratorType, decorateMethodsOf } from "@tsed/core";
|
|
2
2
|
import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
3
3
|
function mapTags(tags) {
|
|
4
4
|
return tags.map((tag) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DecoratorTypes } from "@tsed/core";
|
|
2
|
+
import { getJsonEntityStore } from "../registries/JsonEntitiesContainer.js";
|
|
2
3
|
import { pascalCase } from "change-case";
|
|
3
|
-
import { JsonEntityStore } from "./JsonEntityStore.js";
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
@@ -59,7 +59,7 @@ export class DecoratorContext extends Map {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
bind(args, decorator) {
|
|
62
|
-
this.entity =
|
|
62
|
+
this.entity = getJsonEntityStore(...args);
|
|
63
63
|
this.beforeInit();
|
|
64
64
|
this.onInit(args, decorator);
|
|
65
65
|
this.afterInit();
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { ancestorsOf,
|
|
2
|
-
|
|
3
|
-
* @ignore
|
|
4
|
-
*/
|
|
5
|
-
export const JsonEntitiesContainer = new Map();
|
|
1
|
+
import { ancestorsOf, isArrayOrArrayClass, isArrowFn, isClass, isClassObject, isCollection, isDate, isObject, isPlainObject, isPrimitiveOrPrimitiveClass, nameOf } from "@tsed/core";
|
|
2
|
+
import { getJsonEntityStore } from "../registries/JsonEntitiesContainer.js";
|
|
6
3
|
/**
|
|
7
4
|
* Base class for storing metadata about decorated entities (classes, properties, methods, parameters).
|
|
8
5
|
*
|
|
@@ -31,13 +28,13 @@ export const JsonEntitiesContainer = new Map();
|
|
|
31
28
|
*
|
|
32
29
|
* ```typescript
|
|
33
30
|
* // Get store for a class
|
|
34
|
-
* const classStore =
|
|
31
|
+
* const classStore = getJsonEntityStore(MyClass);
|
|
35
32
|
*
|
|
36
33
|
* // Get store for a property
|
|
37
|
-
* const propStore =
|
|
34
|
+
* const propStore = getJsonEntityStore(MyClass, "propertyName");
|
|
38
35
|
*
|
|
39
36
|
* // Get store for a method parameter
|
|
40
|
-
* const paramStore =
|
|
37
|
+
* const paramStore = getJsonEntityStore(MyClass, "methodName", 0);
|
|
41
38
|
* ```
|
|
42
39
|
*
|
|
43
40
|
* ### Architecture
|
|
@@ -103,8 +100,8 @@ export class JsonEntityStore {
|
|
|
103
100
|
}
|
|
104
101
|
get discriminatorAncestor() {
|
|
105
102
|
const ancestors = ancestorsOf(this.target);
|
|
106
|
-
const ancestor = ancestors.find((ancestor) =>
|
|
107
|
-
return ancestor &&
|
|
103
|
+
const ancestor = ancestors.find((ancestor) => getJsonEntityStore(ancestor).schema.isDiscriminator);
|
|
104
|
+
return ancestor && getJsonEntityStore(ancestor);
|
|
108
105
|
}
|
|
109
106
|
get isPrimitive() {
|
|
110
107
|
return isPrimitiveOrPrimitiveClass(this.type);
|
|
@@ -140,37 +137,6 @@ export class JsonEntityStore {
|
|
|
140
137
|
set path(path) {
|
|
141
138
|
this.store.set("path", path);
|
|
142
139
|
}
|
|
143
|
-
static from(...args) {
|
|
144
|
-
if (args[0].isStore) {
|
|
145
|
-
return args[0];
|
|
146
|
-
}
|
|
147
|
-
const target = args[0];
|
|
148
|
-
if (args.length > 1) {
|
|
149
|
-
args[0] = prototypeOf(args[0]);
|
|
150
|
-
}
|
|
151
|
-
const store = Store.from(...args);
|
|
152
|
-
if (!store.has("JsonEntityStore")) {
|
|
153
|
-
const decoratorType = decoratorTypeOf(args);
|
|
154
|
-
const entityStore = JsonEntitiesContainer.get(decoratorType);
|
|
155
|
-
const jsonSchemaStore = new entityStore({
|
|
156
|
-
store,
|
|
157
|
-
decoratorType,
|
|
158
|
-
target: classOf(target),
|
|
159
|
-
propertyKey: args[1],
|
|
160
|
-
index: typeof args[2] === "number" ? args[2] : undefined,
|
|
161
|
-
descriptor: typeof args[2] === "object" ? args[2] : undefined
|
|
162
|
-
});
|
|
163
|
-
jsonSchemaStore.build();
|
|
164
|
-
store.set("JsonEntityStore", jsonSchemaStore);
|
|
165
|
-
}
|
|
166
|
-
return store.get("JsonEntityStore");
|
|
167
|
-
}
|
|
168
|
-
static fromMethod(target, propertyKey) {
|
|
169
|
-
return this.from(target, propertyKey, descriptorOf(target, propertyKey));
|
|
170
|
-
}
|
|
171
|
-
static get(target, propertyKey, descriptor) {
|
|
172
|
-
return JsonEntityStore.from(prototypeOf(target), propertyKey, descriptor);
|
|
173
|
-
}
|
|
174
140
|
isGetterOnly() {
|
|
175
141
|
return isObject(this.descriptor) && !this.descriptor.value && this.descriptor.get && !this.descriptor.set;
|
|
176
142
|
}
|
|
@@ -176,7 +176,7 @@ export class JsonOperation extends JsonMap {
|
|
|
176
176
|
addAllowedGroupsParameter(allowedGroups) {
|
|
177
177
|
const jsonParameter = new JsonParameter();
|
|
178
178
|
jsonParameter.in("query").name("includes");
|
|
179
|
-
jsonParameter.schema(JsonSchema
|
|
179
|
+
jsonParameter.schema(new JsonSchema({
|
|
180
180
|
type: "array",
|
|
181
181
|
items: {
|
|
182
182
|
type: "string",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
1
|
import { JsonMap } from "./JsonMap.js";
|
|
3
|
-
import { formatParameterType } from "./JsonParameterTypes.js";
|
|
4
2
|
import { JsonSchema } from "./JsonSchema.js";
|
|
3
|
+
import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
4
|
+
import { formatParameterType } from "./JsonParameterTypes.js";
|
|
5
5
|
/**
|
|
6
6
|
* Represents an HTTP operation parameter for OpenAPI specifications.
|
|
7
7
|
*
|
|
@@ -25,7 +25,7 @@ import { JsonSchema } from "./JsonSchema.js";
|
|
|
25
25
|
* .in("path")
|
|
26
26
|
* .required(true)
|
|
27
27
|
* .description("The user identifier")
|
|
28
|
-
* .schema(
|
|
28
|
+
* .schema(s.string());
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
31
31
|
* ### Key Features
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toJsonMapCollection } from "../utils/toJsonMapCollection.js";
|
|
2
1
|
import { JsonMap } from "./JsonMap.js";
|
|
2
|
+
import { toJsonMapCollection } from "../utils/toJsonMapCollection.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents an HTTP request body definition for OpenAPI specifications.
|
|
5
5
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { mapHeaders } from "../utils/mapHeaders.js";
|
|
2
|
-
import { toJsonMapCollection } from "../utils/toJsonMapCollection.js";
|
|
3
1
|
import { JsonMap } from "./JsonMap.js";
|
|
4
2
|
import { JsonMedia } from "./JsonMedia.js";
|
|
3
|
+
import { mapHeaders } from "../utils/mapHeaders.js";
|
|
4
|
+
import { toJsonMapCollection } from "../utils/toJsonMapCollection.js";
|
|
5
5
|
/**
|
|
6
6
|
* Represents an HTTP response definition for OpenAPI specifications.
|
|
7
7
|
*
|