@tsed/schema 7.86.3 → 7.87.1
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/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/cjs/components/default/anyMapper.js +1 -2
- package/lib/cjs/components/default/anyMapper.js.map +1 -1
- package/lib/cjs/components/default/classMapper.js +2 -22
- package/lib/cjs/components/default/classMapper.js.map +1 -1
- package/lib/cjs/components/default/discriminatorMappingMapper.js.map +1 -1
- package/lib/cjs/components/default/genericsMapper.js +61 -47
- package/lib/cjs/components/default/genericsMapper.js.map +1 -1
- package/lib/cjs/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/cjs/components/default/lazyRefMapper.js +1 -2
- package/lib/cjs/components/default/lazyRefMapper.js.map +1 -1
- package/lib/cjs/components/default/mapMapper.js +0 -2
- package/lib/cjs/components/default/mapMapper.js.map +1 -1
- package/lib/cjs/components/default/nextMapper.js +80 -0
- package/lib/cjs/components/default/nextMapper.js.map +1 -0
- package/lib/cjs/components/default/nullableMapper.js.map +1 -1
- package/lib/cjs/components/default/objectMapper.js +8 -3
- package/lib/cjs/components/default/objectMapper.js.map +1 -1
- package/lib/cjs/components/default/ofMapper.js +2 -5
- package/lib/cjs/components/default/ofMapper.js.map +1 -1
- package/lib/cjs/components/default/requiredMapper.js +2 -2
- package/lib/cjs/components/default/requiredMapper.js.map +1 -1
- package/lib/cjs/components/default/schemaMapper.js +9 -7
- package/lib/cjs/components/default/schemaMapper.js.map +1 -1
- package/lib/cjs/components/index.js +1 -7
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/open-spec/enumsMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/generate.js.map +1 -1
- package/lib/cjs/components/open-spec/nullableMapper.js +5 -1
- package/lib/cjs/components/open-spec/nullableMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/operationInFilesMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/operationInParameterMapper.js +3 -7
- package/lib/cjs/components/open-spec/operationInParameterMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/operationInQueryMapper.js +21 -16
- package/lib/cjs/components/open-spec/operationInQueryMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/operationMediaMapper.js +5 -2
- package/lib/cjs/components/open-spec/operationMediaMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/operationRequestBodyMapper.js +4 -3
- package/lib/cjs/components/open-spec/operationRequestBodyMapper.js.map +1 -1
- package/lib/cjs/components/open-spec/pathsMapper.js +1 -0
- package/lib/cjs/components/open-spec/pathsMapper.js.map +1 -1
- package/lib/cjs/constants/VendorKeys.js +15 -0
- package/lib/cjs/constants/VendorKeys.js.map +1 -0
- package/lib/cjs/constants/httpStatusMessages.js +1 -1
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
- package/lib/cjs/decorators/class/children.js.map +1 -1
- package/lib/cjs/decorators/collections/collectionOf.js +29 -0
- package/lib/cjs/decorators/collections/collectionOf.js.map +1 -1
- package/lib/cjs/decorators/common/allow.js.map +1 -1
- package/lib/cjs/decorators/common/any.js.map +1 -1
- package/lib/cjs/decorators/common/defaultMsg.js.map +1 -1
- package/lib/cjs/decorators/common/description.js +8 -11
- package/lib/cjs/decorators/common/description.js.map +1 -1
- package/lib/cjs/decorators/common/discriminatorKey.js +1 -1
- package/lib/cjs/decorators/common/discriminatorKey.js.map +1 -1
- package/lib/cjs/decorators/common/enum.js.map +1 -1
- package/lib/cjs/decorators/common/examples.js.map +1 -1
- package/lib/cjs/decorators/common/format.js.map +1 -1
- package/lib/cjs/decorators/common/forwardGroups.js +1 -1
- package/lib/cjs/decorators/common/forwardGroups.js.map +1 -1
- package/lib/cjs/decorators/common/groups.js +15 -26
- package/lib/cjs/decorators/common/groups.js.map +1 -1
- package/lib/cjs/decorators/common/integer.js.map +1 -1
- package/lib/cjs/decorators/common/oneOf.js +1 -2
- package/lib/cjs/decorators/common/oneOf.js.map +1 -1
- package/lib/cjs/decorators/common/optional.js.map +1 -1
- package/lib/cjs/decorators/config/jsonEntityComponent.js.map +1 -1
- package/lib/cjs/decorators/generics/genericOf.js +7 -16
- package/lib/cjs/decorators/generics/genericOf.js.map +1 -1
- package/lib/cjs/decorators/generics/generics.js +3 -3
- package/lib/cjs/decorators/generics/generics.js.map +1 -1
- package/lib/cjs/decorators/operations/acceptMime.js.map +1 -1
- package/lib/cjs/decorators/operations/consumes.js.map +1 -1
- package/lib/cjs/decorators/operations/deprecated.js.map +1 -1
- package/lib/cjs/decorators/operations/header.js.map +1 -1
- package/lib/cjs/decorators/operations/in.js.map +1 -1
- package/lib/cjs/decorators/operations/inFile.js +2 -2
- package/lib/cjs/decorators/operations/inFile.js.map +1 -1
- package/lib/cjs/decorators/operations/operation.js +5 -1
- package/lib/cjs/decorators/operations/operation.js.map +1 -1
- package/lib/cjs/decorators/operations/operationId.js.map +1 -1
- package/lib/cjs/decorators/operations/operationPath.js +1 -1
- package/lib/cjs/decorators/operations/operationPath.js.map +1 -1
- package/lib/cjs/decorators/operations/path.js.map +1 -1
- package/lib/cjs/decorators/operations/produces.js.map +1 -1
- package/lib/cjs/decorators/operations/redirect.js +1 -1
- package/lib/cjs/decorators/operations/redirect.js.map +1 -1
- package/lib/cjs/decorators/operations/returns.js +39 -62
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/decorators/operations/security.js.map +1 -1
- package/lib/cjs/decorators/operations/status.js.map +1 -1
- package/lib/cjs/decorators/operations/summary.js.map +1 -1
- package/lib/cjs/decorators/operations/tags.js +10 -1
- package/lib/cjs/decorators/operations/tags.js.map +1 -1
- package/lib/cjs/domain/DecoratorContext.js.map +1 -1
- package/lib/cjs/domain/JsonClassStore.js +1 -1
- package/lib/cjs/domain/JsonClassStore.js.map +1 -1
- package/lib/cjs/domain/JsonEntityStore.js +40 -35
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
- package/lib/cjs/domain/JsonLazyRef.js.map +1 -1
- package/lib/cjs/domain/JsonMap.js.map +1 -1
- package/lib/cjs/domain/JsonMedia.js +27 -6
- package/lib/cjs/domain/JsonMedia.js.map +1 -1
- package/lib/cjs/domain/JsonMethodStore.js +27 -8
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
- package/lib/cjs/domain/JsonOperation.js +36 -8
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonParameter.js +20 -5
- package/lib/cjs/domain/JsonParameter.js.map +1 -1
- package/lib/cjs/domain/JsonParameterStore.js +15 -25
- package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
- package/lib/cjs/domain/JsonPropertyStore.js +14 -45
- package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +286 -79
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/domain/__fixtures__/inspectOperationsPaths.js +11 -0
- package/lib/cjs/domain/__fixtures__/inspectOperationsPaths.js.map +1 -0
- package/lib/cjs/fn/email.js +2 -2
- package/lib/cjs/fn/email.js.map +1 -1
- package/lib/cjs/fn/uri.js +2 -2
- package/lib/cjs/fn/uri.js.map +1 -1
- package/lib/cjs/fn/url.js +2 -2
- package/lib/cjs/fn/url.js.map +1 -1
- package/lib/cjs/index.js +4 -8
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/generics.js +5 -36
- package/lib/cjs/utils/generics.js.map +1 -1
- package/lib/cjs/utils/getJsonEntityStore.js +3 -3
- package/lib/cjs/utils/getJsonEntityStore.js.map +1 -1
- package/lib/cjs/utils/getJsonSchema.js +24 -17
- package/lib/cjs/utils/getJsonSchema.js.map +1 -1
- package/lib/cjs/utils/getOperationsStores.js.map +1 -1
- package/lib/cjs/utils/getPropertiesStores.js.map +1 -1
- package/lib/cjs/utils/getSpec.js.map +1 -1
- package/lib/cjs/utils/mergeSchema.js +103 -0
- package/lib/cjs/utils/mergeSchema.js.map +1 -0
- package/lib/cjs/utils/ref.js +15 -13
- package/lib/cjs/utils/ref.js.map +1 -1
- package/lib/esm/components/default/anyMapper.js +1 -2
- package/lib/esm/components/default/anyMapper.js.map +1 -1
- package/lib/esm/components/default/classMapper.js +2 -22
- package/lib/esm/components/default/classMapper.js.map +1 -1
- package/lib/esm/components/default/discriminatorMappingMapper.js.map +1 -1
- package/lib/esm/components/default/genericsMapper.js +62 -48
- package/lib/esm/components/default/genericsMapper.js.map +1 -1
- package/lib/esm/components/default/inheritedClassMapper.js.map +1 -1
- package/lib/esm/components/default/lazyRefMapper.js +1 -2
- package/lib/esm/components/default/lazyRefMapper.js.map +1 -1
- package/lib/esm/components/default/mapMapper.js +0 -2
- package/lib/esm/components/default/mapMapper.js.map +1 -1
- package/lib/esm/components/default/nextMapper.js +75 -0
- package/lib/esm/components/default/nextMapper.js.map +1 -0
- package/lib/esm/components/default/nullableMapper.js.map +1 -1
- package/lib/esm/components/default/objectMapper.js +8 -3
- package/lib/esm/components/default/objectMapper.js.map +1 -1
- package/lib/esm/components/default/ofMapper.js +2 -5
- package/lib/esm/components/default/ofMapper.js.map +1 -1
- package/lib/esm/components/default/requiredMapper.js +2 -2
- package/lib/esm/components/default/requiredMapper.js.map +1 -1
- package/lib/esm/components/default/schemaMapper.js +10 -8
- package/lib/esm/components/default/schemaMapper.js.map +1 -1
- package/lib/esm/components/index.js +1 -7
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/open-spec/enumsMapper.js.map +1 -1
- package/lib/esm/components/open-spec/generate.js.map +1 -1
- package/lib/esm/components/open-spec/nullableMapper.js +5 -1
- package/lib/esm/components/open-spec/nullableMapper.js.map +1 -1
- package/lib/esm/components/open-spec/operationInFilesMapper.js.map +1 -1
- package/lib/esm/components/open-spec/operationInParameterMapper.js +3 -7
- package/lib/esm/components/open-spec/operationInParameterMapper.js.map +1 -1
- package/lib/esm/components/open-spec/operationInQueryMapper.js +22 -17
- package/lib/esm/components/open-spec/operationInQueryMapper.js.map +1 -1
- package/lib/esm/components/open-spec/operationMediaMapper.js +5 -2
- package/lib/esm/components/open-spec/operationMediaMapper.js.map +1 -1
- package/lib/esm/components/open-spec/operationRequestBodyMapper.js +4 -3
- package/lib/esm/components/open-spec/operationRequestBodyMapper.js.map +1 -1
- package/lib/esm/components/open-spec/pathsMapper.js +1 -0
- package/lib/esm/components/open-spec/pathsMapper.js.map +1 -1
- package/lib/esm/constants/VendorKeys.js +12 -0
- package/lib/esm/constants/VendorKeys.js.map +1 -0
- package/lib/esm/constants/httpStatusMessages.js +1 -1
- package/lib/esm/constants/httpStatusMessages.js.map +1 -1
- package/lib/esm/decorators/class/children.js.map +1 -1
- package/lib/esm/decorators/collections/collectionOf.js +29 -0
- package/lib/esm/decorators/collections/collectionOf.js.map +1 -1
- package/lib/esm/decorators/common/allow.js.map +1 -1
- package/lib/esm/decorators/common/any.js.map +1 -1
- package/lib/esm/decorators/common/defaultMsg.js.map +1 -1
- package/lib/esm/decorators/common/description.js +9 -12
- package/lib/esm/decorators/common/description.js.map +1 -1
- package/lib/esm/decorators/common/discriminatorKey.js +1 -1
- package/lib/esm/decorators/common/discriminatorKey.js.map +1 -1
- package/lib/esm/decorators/common/enum.js.map +1 -1
- package/lib/esm/decorators/common/examples.js.map +1 -1
- package/lib/esm/decorators/common/format.js.map +1 -1
- package/lib/esm/decorators/common/forwardGroups.js +1 -1
- package/lib/esm/decorators/common/forwardGroups.js.map +1 -1
- package/lib/esm/decorators/common/groups.js +15 -26
- package/lib/esm/decorators/common/groups.js.map +1 -1
- package/lib/esm/decorators/common/integer.js.map +1 -1
- package/lib/esm/decorators/common/oneOf.js +1 -2
- package/lib/esm/decorators/common/oneOf.js.map +1 -1
- package/lib/esm/decorators/common/optional.js.map +1 -1
- package/lib/esm/decorators/config/jsonEntityComponent.js.map +1 -1
- package/lib/esm/decorators/generics/genericOf.js +8 -17
- package/lib/esm/decorators/generics/genericOf.js.map +1 -1
- package/lib/esm/decorators/generics/generics.js +3 -3
- package/lib/esm/decorators/generics/generics.js.map +1 -1
- package/lib/esm/decorators/operations/acceptMime.js.map +1 -1
- package/lib/esm/decorators/operations/consumes.js.map +1 -1
- package/lib/esm/decorators/operations/deprecated.js.map +1 -1
- package/lib/esm/decorators/operations/header.js.map +1 -1
- package/lib/esm/decorators/operations/in.js.map +1 -1
- package/lib/esm/decorators/operations/inFile.js +2 -2
- package/lib/esm/decorators/operations/inFile.js.map +1 -1
- package/lib/esm/decorators/operations/operation.js +5 -1
- package/lib/esm/decorators/operations/operation.js.map +1 -1
- package/lib/esm/decorators/operations/operationId.js.map +1 -1
- package/lib/esm/decorators/operations/operationPath.js +1 -1
- package/lib/esm/decorators/operations/operationPath.js.map +1 -1
- package/lib/esm/decorators/operations/path.js.map +1 -1
- package/lib/esm/decorators/operations/produces.js.map +1 -1
- package/lib/esm/decorators/operations/redirect.js +1 -1
- package/lib/esm/decorators/operations/redirect.js.map +1 -1
- package/lib/esm/decorators/operations/returns.js +40 -63
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/decorators/operations/security.js.map +1 -1
- package/lib/esm/decorators/operations/status.js.map +1 -1
- package/lib/esm/decorators/operations/summary.js.map +1 -1
- package/lib/esm/decorators/operations/tags.js +10 -1
- package/lib/esm/decorators/operations/tags.js.map +1 -1
- package/lib/esm/domain/DecoratorContext.js.map +1 -1
- package/lib/esm/domain/JsonClassStore.js +1 -1
- package/lib/esm/domain/JsonClassStore.js.map +1 -1
- package/lib/esm/domain/JsonEntityStore.js +40 -35
- package/lib/esm/domain/JsonEntityStore.js.map +1 -1
- package/lib/esm/domain/JsonLazyRef.js.map +1 -1
- package/lib/esm/domain/JsonMap.js.map +1 -1
- package/lib/esm/domain/JsonMedia.js +27 -6
- package/lib/esm/domain/JsonMedia.js.map +1 -1
- package/lib/esm/domain/JsonMethodStore.js +28 -9
- package/lib/esm/domain/JsonMethodStore.js.map +1 -1
- package/lib/esm/domain/JsonOperation.js +34 -7
- package/lib/esm/domain/JsonOperation.js.map +1 -1
- package/lib/esm/domain/JsonParameter.js +20 -5
- package/lib/esm/domain/JsonParameter.js.map +1 -1
- package/lib/esm/domain/JsonParameterStore.js +16 -26
- package/lib/esm/domain/JsonParameterStore.js.map +1 -1
- package/lib/esm/domain/JsonPropertyStore.js +15 -46
- package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +287 -80
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/domain/__fixtures__/inspectOperationsPaths.js +7 -0
- package/lib/esm/domain/__fixtures__/inspectOperationsPaths.js.map +1 -0
- package/lib/esm/fn/email.js +2 -2
- package/lib/esm/fn/email.js.map +1 -1
- package/lib/esm/fn/uri.js +2 -2
- package/lib/esm/fn/uri.js.map +1 -1
- package/lib/esm/fn/url.js +2 -2
- package/lib/esm/fn/url.js.map +1 -1
- package/lib/esm/index.js +4 -8
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/generics.js +3 -32
- package/lib/esm/utils/generics.js.map +1 -1
- package/lib/esm/utils/getJsonEntityStore.js +3 -3
- package/lib/esm/utils/getJsonEntityStore.js.map +1 -1
- package/lib/esm/utils/getJsonSchema.js +24 -17
- package/lib/esm/utils/getJsonSchema.js.map +1 -1
- package/lib/esm/utils/getOperationsStores.js.map +1 -1
- package/lib/esm/utils/getPropertiesStores.js.map +1 -1
- package/lib/esm/utils/getSpec.js.map +1 -1
- package/lib/esm/utils/mergeSchema.js +99 -0
- package/lib/esm/utils/mergeSchema.js.map +1 -0
- package/lib/esm/utils/ref.js +14 -13
- package/lib/esm/utils/ref.js.map +1 -1
- package/lib/types/components/default/classMapper.d.ts +1 -1
- package/lib/types/components/default/genericsMapper.d.ts +9 -2
- package/lib/types/components/default/lazyRefMapper.d.ts +1 -1
- package/lib/types/components/default/nextMapper.d.ts +5 -0
- package/lib/types/components/default/ofMapper.d.ts +1 -1
- package/lib/types/components/index.d.ts +1 -7
- package/lib/types/components/open-spec/nullableMapper.d.ts +2 -1
- package/lib/types/components/open-spec/operationInQueryMapper.d.ts +1 -1
- package/lib/types/constants/VendorKeys.d.ts +10 -0
- package/lib/types/decorators/collections/collectionOf.d.ts +6 -0
- package/lib/types/decorators/generics/genericOf.d.ts +3 -0
- package/lib/types/decorators/generics/generics.d.ts +2 -2
- package/lib/types/decorators/operations/acceptMime.d.ts +1 -1
- package/lib/types/decorators/operations/consumes.d.ts +1 -1
- package/lib/types/decorators/operations/header.d.ts +1 -1
- package/lib/types/decorators/operations/operationId.d.ts +1 -1
- package/lib/types/decorators/operations/operationPath.d.ts +1 -1
- package/lib/types/decorators/operations/path.d.ts +1 -1
- package/lib/types/decorators/operations/returns.d.ts +11 -9
- package/lib/types/decorators/operations/tags.d.ts +11 -2
- package/lib/types/domain/JsonClassStore.d.ts +1 -1
- package/lib/types/domain/JsonEntityStore.d.ts +20 -16
- package/lib/types/domain/JsonMedia.d.ts +4 -5
- package/lib/types/domain/JsonMethodStore.d.ts +9 -2
- package/lib/types/domain/JsonOperation.d.ts +7 -4
- package/lib/types/domain/JsonParameter.d.ts +4 -7
- package/lib/types/domain/JsonParameterStore.d.ts +1 -4
- package/lib/types/domain/JsonPropertyStore.d.ts +2 -21
- package/lib/types/domain/JsonSchema.d.ts +83 -40
- package/lib/types/domain/__fixtures__/inspectOperationsPaths.d.ts +5 -0
- package/lib/types/index.d.ts +4 -8
- package/lib/types/interfaces/JsonSchemaOptions.d.ts +16 -2
- package/lib/types/utils/generics.d.ts +7 -48
- package/lib/types/utils/getJsonEntityStore.d.ts +3 -3
- package/lib/types/utils/getJsonSchema.d.ts +3 -2
- package/lib/types/utils/mergeSchema.d.ts +2 -0
- package/lib/types/utils/ref.d.ts +4 -2
- package/lib/types-esm/components/default/classMapper.d.ts +1 -1
- package/lib/types-esm/components/default/genericsMapper.d.ts +9 -2
- package/lib/types-esm/components/default/lazyRefMapper.d.ts +1 -1
- package/lib/types-esm/components/default/nextMapper.d.ts +5 -0
- package/lib/types-esm/components/default/ofMapper.d.ts +1 -1
- package/lib/types-esm/components/index.d.ts +1 -7
- package/lib/types-esm/components/open-spec/nullableMapper.d.ts +2 -1
- package/lib/types-esm/components/open-spec/operationInQueryMapper.d.ts +1 -1
- package/lib/types-esm/constants/VendorKeys.d.ts +10 -0
- package/lib/types-esm/decorators/collections/collectionOf.d.ts +6 -0
- package/lib/types-esm/decorators/generics/genericOf.d.ts +3 -0
- package/lib/types-esm/decorators/generics/generics.d.ts +2 -2
- package/lib/types-esm/decorators/operations/acceptMime.d.ts +1 -1
- package/lib/types-esm/decorators/operations/consumes.d.ts +1 -1
- package/lib/types-esm/decorators/operations/header.d.ts +1 -1
- package/lib/types-esm/decorators/operations/operationId.d.ts +1 -1
- package/lib/types-esm/decorators/operations/operationPath.d.ts +1 -1
- package/lib/types-esm/decorators/operations/path.d.ts +1 -1
- package/lib/types-esm/decorators/operations/returns.d.ts +11 -9
- package/lib/types-esm/decorators/operations/tags.d.ts +11 -2
- package/lib/types-esm/domain/JsonClassStore.d.ts +1 -1
- package/lib/types-esm/domain/JsonEntityStore.d.ts +20 -16
- package/lib/types-esm/domain/JsonMedia.d.ts +4 -5
- package/lib/types-esm/domain/JsonMethodStore.d.ts +9 -2
- package/lib/types-esm/domain/JsonOperation.d.ts +7 -4
- package/lib/types-esm/domain/JsonParameter.d.ts +4 -7
- package/lib/types-esm/domain/JsonParameterStore.d.ts +1 -4
- package/lib/types-esm/domain/JsonPropertyStore.d.ts +2 -21
- package/lib/types-esm/domain/JsonSchema.d.ts +83 -40
- package/lib/types-esm/domain/__fixtures__/inspectOperationsPaths.d.ts +5 -0
- package/lib/types-esm/index.d.ts +4 -8
- package/lib/types-esm/interfaces/JsonSchemaOptions.d.ts +16 -2
- package/lib/types-esm/utils/generics.d.ts +7 -48
- package/lib/types-esm/utils/getJsonEntityStore.d.ts +3 -3
- package/lib/types-esm/utils/getJsonSchema.d.ts +3 -2
- package/lib/types-esm/utils/mergeSchema.d.ts +2 -0
- package/lib/types-esm/utils/ref.d.ts +4 -2
- package/package.json +6 -6
- package/lib/cjs/components/async-api/channelsMapper.js +0 -62
- package/lib/cjs/components/async-api/channelsMapper.js.map +0 -1
- package/lib/cjs/components/async-api/generate.js +0 -20
- package/lib/cjs/components/async-api/generate.js.map +0 -1
- package/lib/cjs/components/async-api/messageMapper.js +0 -44
- package/lib/cjs/components/async-api/messageMapper.js.map +0 -1
- package/lib/cjs/components/async-api/payloadMapper.js +0 -52
- package/lib/cjs/components/async-api/payloadMapper.js.map +0 -1
- package/lib/cjs/components/async-api/responseMapper.js +0 -58
- package/lib/cjs/components/async-api/responseMapper.js.map +0 -1
- package/lib/cjs/components/default/itemMapper.js +0 -10
- package/lib/cjs/components/default/itemMapper.js.map +0 -1
- package/lib/cjs/components/default/propertiesMapper.js +0 -25
- package/lib/cjs/components/default/propertiesMapper.js.map +0 -1
- package/lib/cjs/utils/somethingOf.js +0 -16
- package/lib/cjs/utils/somethingOf.js.map +0 -1
- package/lib/esm/components/async-api/channelsMapper.js +0 -58
- package/lib/esm/components/async-api/channelsMapper.js.map +0 -1
- package/lib/esm/components/async-api/generate.js +0 -18
- package/lib/esm/components/async-api/generate.js.map +0 -1
- package/lib/esm/components/async-api/messageMapper.js +0 -40
- package/lib/esm/components/async-api/messageMapper.js.map +0 -1
- package/lib/esm/components/async-api/payloadMapper.js +0 -48
- package/lib/esm/components/async-api/payloadMapper.js.map +0 -1
- package/lib/esm/components/async-api/responseMapper.js +0 -54
- package/lib/esm/components/async-api/responseMapper.js.map +0 -1
- package/lib/esm/components/default/itemMapper.js +0 -6
- package/lib/esm/components/default/itemMapper.js.map +0 -1
- package/lib/esm/components/default/propertiesMapper.js +0 -21
- package/lib/esm/components/default/propertiesMapper.js.map +0 -1
- package/lib/esm/utils/somethingOf.js +0 -12
- package/lib/esm/utils/somethingOf.js.map +0 -1
- package/lib/types/components/async-api/channelsMapper.d.ts +0 -2
- package/lib/types/components/async-api/generate.d.ts +0 -1
- package/lib/types/components/async-api/messageMapper.d.ts +0 -6
- package/lib/types/components/async-api/payloadMapper.d.ts +0 -4
- package/lib/types/components/async-api/responseMapper.d.ts +0 -6
- package/lib/types/components/default/itemMapper.d.ts +0 -2
- package/lib/types/components/default/propertiesMapper.d.ts +0 -3
- package/lib/types/utils/somethingOf.d.ts +0 -1
- package/lib/types-esm/components/async-api/channelsMapper.d.ts +0 -2
- package/lib/types-esm/components/async-api/generate.d.ts +0 -1
- package/lib/types-esm/components/async-api/messageMapper.d.ts +0 -6
- package/lib/types-esm/components/async-api/payloadMapper.d.ts +0 -4
- package/lib/types-esm/components/async-api/responseMapper.d.ts +0 -6
- package/lib/types-esm/components/default/itemMapper.d.ts +0 -2
- package/lib/types-esm/components/default/propertiesMapper.d.ts +0 -3
- package/lib/types-esm/utils/somethingOf.d.ts +0 -1
|
@@ -9,7 +9,7 @@ export class JsonEntityStore {
|
|
|
9
9
|
const { target, propertyKey, descriptor, index, decoratorType } = options;
|
|
10
10
|
this.target = target;
|
|
11
11
|
this.propertyKey = propertyKey;
|
|
12
|
-
this.propertyName = String(propertyKey);
|
|
12
|
+
this.propertyName = propertyKey ? String(propertyKey) : propertyKey || "";
|
|
13
13
|
this.descriptor = descriptor;
|
|
14
14
|
this.index = index;
|
|
15
15
|
this.decoratorType = decoratorType;
|
|
@@ -17,6 +17,25 @@ export class JsonEntityStore {
|
|
|
17
17
|
this.store = options.store;
|
|
18
18
|
this.parent = this;
|
|
19
19
|
}
|
|
20
|
+
get type() {
|
|
21
|
+
return this._type;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get original type without transformation
|
|
25
|
+
* @param value
|
|
26
|
+
*/
|
|
27
|
+
set type(value) {
|
|
28
|
+
if (!value?.$schema?.skip) {
|
|
29
|
+
this._type = value;
|
|
30
|
+
}
|
|
31
|
+
this.build();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Return the JsonSchema
|
|
35
|
+
*/
|
|
36
|
+
get schema() {
|
|
37
|
+
return this._schema;
|
|
38
|
+
}
|
|
20
39
|
/**
|
|
21
40
|
* Return the class name of the entity.
|
|
22
41
|
* @returns {string}
|
|
@@ -47,35 +66,12 @@ export class JsonEntityStore {
|
|
|
47
66
|
get isClass() {
|
|
48
67
|
return isClass(this.computedType);
|
|
49
68
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Return the JsonSchema
|
|
52
|
-
*/
|
|
53
|
-
get schema() {
|
|
54
|
-
return this._schema;
|
|
55
|
-
}
|
|
56
|
-
get nestedGenerics() {
|
|
57
|
-
return this.schema.nestedGenerics;
|
|
58
|
-
}
|
|
59
|
-
set nestedGenerics(nestedGenerics) {
|
|
60
|
-
this.schema.nestedGenerics = nestedGenerics;
|
|
61
|
-
}
|
|
62
|
-
get type() {
|
|
63
|
-
return this._type;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Get original type without transformation
|
|
67
|
-
* @param value
|
|
68
|
-
*/
|
|
69
|
-
set type(value) {
|
|
70
|
-
this._type = value;
|
|
71
|
-
this.build();
|
|
72
|
-
}
|
|
73
69
|
/**
|
|
74
70
|
* Return the itemSchema computed type. if the type is a function used for recursive model, the function will be called to
|
|
75
71
|
* get the right type.
|
|
76
72
|
*/
|
|
77
73
|
get computedType() {
|
|
78
|
-
return this.itemSchema.
|
|
74
|
+
return this.itemSchema.class;
|
|
79
75
|
}
|
|
80
76
|
get itemSchema() {
|
|
81
77
|
return this.isCollection ? this.schema.itemSchema() : this.schema;
|
|
@@ -86,6 +82,12 @@ export class JsonEntityStore {
|
|
|
86
82
|
get isDiscriminatorChild() {
|
|
87
83
|
return this.schema.isDiscriminator && this.discriminatorAncestor?.schema.discriminator().base !== this.target;
|
|
88
84
|
}
|
|
85
|
+
get path() {
|
|
86
|
+
return this.store.get("path");
|
|
87
|
+
}
|
|
88
|
+
set path(path) {
|
|
89
|
+
this.store.set("path", path);
|
|
90
|
+
}
|
|
89
91
|
static from(...args) {
|
|
90
92
|
if (args[0].isStore) {
|
|
91
93
|
return args[0];
|
|
@@ -129,11 +131,23 @@ export class JsonEntityStore {
|
|
|
129
131
|
toString() {
|
|
130
132
|
return [this.targetName, this.propertyName, this.index].filter((o) => o !== undefined).join(":");
|
|
131
133
|
}
|
|
134
|
+
getBestType() {
|
|
135
|
+
return this.itemSchema.hasDiscriminator
|
|
136
|
+
? this.itemSchema.discriminator().base
|
|
137
|
+
: isClassObject(this.type)
|
|
138
|
+
? this.itemSchema.getTarget()
|
|
139
|
+
: isArrowFn(this.type)
|
|
140
|
+
? this.type()
|
|
141
|
+
: this.type;
|
|
142
|
+
}
|
|
143
|
+
is(input) {
|
|
144
|
+
return this.decoratorType === input;
|
|
145
|
+
}
|
|
132
146
|
buildType(type) {
|
|
133
147
|
if (isCollection(type)) {
|
|
134
148
|
this.collectionType = type;
|
|
135
149
|
}
|
|
136
|
-
else {
|
|
150
|
+
else if (!(type && "$schema" in type && type.$schema.skip)) {
|
|
137
151
|
this._type = type;
|
|
138
152
|
// issue #1534: Enum metadata stored as plain object instead of String (see: https://github.com/tsedio/tsed/issues/1534)
|
|
139
153
|
if (this._type && isPlainObject(this._type)) {
|
|
@@ -141,14 +155,5 @@ export class JsonEntityStore {
|
|
|
141
155
|
}
|
|
142
156
|
}
|
|
143
157
|
}
|
|
144
|
-
getBestType() {
|
|
145
|
-
return this.itemSchema.hasDiscriminator
|
|
146
|
-
? this.itemSchema.discriminator().base
|
|
147
|
-
: isClassObject(this.type)
|
|
148
|
-
? this.itemSchema.getTarget()
|
|
149
|
-
: isArrowFn(this.type)
|
|
150
|
-
? this.type()
|
|
151
|
-
: this.type;
|
|
152
|
-
}
|
|
153
158
|
}
|
|
154
159
|
//# sourceMappingURL=JsonEntityStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonEntityStore.js","sourceRoot":"","sources":["../../../src/domain/JsonEntityStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,OAAO,EACP,eAAe,EAEf,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,OAAO,EACP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CAAC,EAAE;gBAC3C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;aACrB;SACF;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonLazyRef.js","sourceRoot":"","sources":["../../../src/domain/JsonLazyRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAO,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"JsonLazyRef.js","sourceRoot":"","sources":["../../../src/domain/JsonLazyRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAO,MAAM,YAAY,CAAC;AAExC,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE,MAAM,OAAO,WAAW;IAGtB,YAAqB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAFpC,cAAS,GAAG,IAAI,CAAC;IAEsB,CAAC;IAEjD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;IACnD,CAAC;IAED,IAAI,IAAI;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMap.js","sourceRoot":"","sources":["../../../src/domain/JsonMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"JsonMap.js","sourceRoot":"","sources":["../../../src/domain/JsonMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAC,UAAU,EAAC,MAAM,4CAA4C,CAAC;AAEtE,MAAM,OAAO,OAAW,SAAQ,GAAgB;IAM9C,YAAY,MAAkB,EAAE;QAC9B,KAAK,EAAE,CAAC;QAJV,UAAK,GAAW,KAAK,CAAC;QACb,oBAAe,GAAG,IAAI,CAAC;QAK9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,MAAwB,EAAE;QAC/B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;aAClB;iBAAM;gBACL,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,OAA2B;QAChC,OAAO,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -1,16 +1,37 @@
|
|
|
1
|
+
import { isArray, isClass } from "@tsed/core";
|
|
1
2
|
import { JsonMap } from "./JsonMap.js";
|
|
3
|
+
import { JsonSchema } from "./JsonSchema.js";
|
|
2
4
|
export class JsonMedia extends JsonMap {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(
|
|
5
|
+
constructor(obj = {}) {
|
|
6
|
+
super(obj);
|
|
5
7
|
this.$kind = "operationMedia";
|
|
6
|
-
this.
|
|
8
|
+
if (!this.has("schema")) {
|
|
9
|
+
this.set("schema", new JsonSchema());
|
|
10
|
+
}
|
|
7
11
|
}
|
|
8
12
|
schema(schema) {
|
|
9
|
-
this.set("schema", schema);
|
|
10
|
-
return this;
|
|
13
|
+
schema && this.set("schema", schema);
|
|
14
|
+
return this.get("schema");
|
|
11
15
|
}
|
|
12
16
|
examples(examples) {
|
|
13
|
-
this.set("examples", examples);
|
|
17
|
+
examples && this.set("examples", examples);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
type(type) {
|
|
21
|
+
if (type) {
|
|
22
|
+
if (isArray(type)) {
|
|
23
|
+
this.schema().oneOf(type.map((type) => ({ type })));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (isClass(type)) {
|
|
27
|
+
this.schema().type("object");
|
|
28
|
+
this.schema().itemSchema(type);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.schema().type(type);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
14
35
|
return this;
|
|
15
36
|
}
|
|
16
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMedia.js","sourceRoot":"","sources":["../../../src/domain/JsonMedia.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JsonMedia.js","sourceRoot":"","sources":["../../../src/domain/JsonMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAI5C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,MAAM,OAAO,SAAU,SAAQ,OAAiC;IAG9D,YAAY,MAAyC,EAAE;QACrD,KAAK,CAAC,GAAG,CAAC,CAAC;QAHb,UAAK,GAAW,gBAAgB,CAAC;QAI/B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACvB,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC;SACtC;IACH,CAAC;IAED,MAAM,CAAC,MAAmB;QACxB,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAe,CAAC;IAC1C,CAAC;IAED,QAAQ,CAAC,QAAc;QACrB,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAS;QACZ,IAAI,IAAI,EAAE;YACR,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;gBACjB,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,CAAC;aACnD;iBAAM;gBACL,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;oBACjB,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC7B,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;iBAChC;qBAAM;oBACL,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC1B;aACF;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { DecoratorTypes, deepMerge, descriptorOf, isCollection, isFunction, isPromise, Metadata, prototypeOf, Store } from "@tsed/core";
|
|
2
|
+
import { DecoratorTypes, deepMerge, descriptorOf, isClass, isCollection, isFunction, isPromise, Metadata, prototypeOf, Store } from "@tsed/core";
|
|
3
3
|
import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
|
|
4
4
|
import { JsonEntityStore } from "./JsonEntityStore.js";
|
|
5
5
|
import { JsonOperation } from "./JsonOperation.js";
|
|
@@ -59,15 +59,21 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
|
|
|
59
59
|
descriptor = descriptor || descriptorOf(prototypeOf(target), propertyKey);
|
|
60
60
|
return JsonEntityStore.from(prototypeOf(target), propertyKey, descriptor);
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* TODO must be located on JsonOperation level directly
|
|
64
|
+
* @param status
|
|
65
|
+
* @param contentType
|
|
66
|
+
* @param includes
|
|
67
|
+
*/
|
|
62
68
|
getResponseOptions(status, { contentType = "application/json", includes } = {}) {
|
|
63
69
|
const media = this.operation.getResponseOf(status).getMedia(contentType, false);
|
|
64
70
|
if (media && media.has("schema")) {
|
|
65
|
-
const
|
|
66
|
-
let groups = media.
|
|
67
|
-
if (includes &&
|
|
68
|
-
groups = [...(groups || []), ...includes.filter((include) =>
|
|
71
|
+
const allowedGroups = media.schema().getAllowedGroups();
|
|
72
|
+
let groups = media.schema().getGroups();
|
|
73
|
+
if (includes && allowedGroups?.size) {
|
|
74
|
+
groups = [...(groups || []), ...includes.filter((include) => allowedGroups.has(include))];
|
|
69
75
|
}
|
|
70
|
-
return { type: schema
|
|
76
|
+
return { type: media.schema().collectionClass, groups };
|
|
71
77
|
}
|
|
72
78
|
return { type: this.type };
|
|
73
79
|
}
|
|
@@ -126,12 +132,25 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
|
|
|
126
132
|
// @ts-ignore
|
|
127
133
|
delete this._type;
|
|
128
134
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
135
|
+
// TODO est-ce que c'est tjrs d'actualité car on doit utiliser le decorator @Returns pour affecter correctement les data
|
|
136
|
+
// peut etre que c'est pour les get/setter ou méthod n'étant pas un endpoint?
|
|
132
137
|
if (this.collectionType) {
|
|
138
|
+
this._schema = JsonSchema.from({
|
|
139
|
+
type: this.collectionType
|
|
140
|
+
});
|
|
133
141
|
this._schema.itemSchema(this.type);
|
|
134
142
|
}
|
|
143
|
+
else if (isClass(this.type)) {
|
|
144
|
+
this._schema = JsonSchema.from({
|
|
145
|
+
type: "object"
|
|
146
|
+
});
|
|
147
|
+
this._schema.itemSchema(this.type);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this._schema = JsonSchema.from({
|
|
151
|
+
type: this.type
|
|
152
|
+
});
|
|
153
|
+
}
|
|
135
154
|
this.parent.schema.addProperty(this.propertyName, this.schema);
|
|
136
155
|
}
|
|
137
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonMethodStore.js","sourceRoot":"","sources":["../../../src/domain/JsonMethodStore.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"JsonMethodStore.js","sourceRoot":"","sources":["../../../src/domain/JsonMethodStore.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,UAAU,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,KAAK,EAEN,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,mBAAmB,EAAC,MAAM,6CAA6C,CAAC;AAEhF,OAAO,EAAC,eAAe,EAAyB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAapC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,eAAe;IAclD,YAAY,OAA+B;QACzC,KAAK,CAAC;YACJ,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAY,CAAC;YAC7D,UAAU,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAY,CAAC;YAC9D,GAAG,OAAO;SACX,CAAC,CAAC;QAlBI,WAAM,GAAmB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7D,gBAAW,GAAU,EAAE,CAAC;QACxB,sBAAiB,GAAU,EAAE,CAAC;QAC9B,qBAAgB,GAAU,EAAE,CAAC;QACpC;;WAEG;QACM,cAAS,GAAkB,IAAI,aAAa,EAAE,C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AC;QAElD,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC;YACjC,aAAa;YACb,OAAO,IAAI,CAAC,KAAK,CAAC;SACnB;QAED,wHAAwH;QACxH,6EAA6E;QAC7E,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC;gBAC7B,IAAI,EAAE,IAAI,CAAC,cAAc;aAC1B,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpC;aAAM,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC7B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC;gBAC7B,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpC;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC;gBAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;CACF,CAAA;AA1LY,eAAe;IAD3B,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC;;GAC9B,eAAe,CA0L3B;SA1LY,eAAe;AAgN5B,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC"}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { deepMerge, uniq, uniqBy } from "@tsed/core";
|
|
2
2
|
import { isRedirectionStatus, isSuccessStatus } from "../utils/isSuccessStatus.js";
|
|
3
3
|
import { JsonMap } from "./JsonMap.js";
|
|
4
|
+
import { JsonParameter } from "./JsonParameter.js";
|
|
4
5
|
import { JsonResponse } from "./JsonResponse.js";
|
|
6
|
+
import { JsonSchema } from "./JsonSchema.js";
|
|
7
|
+
export class JsonMethodPath extends JsonMap {
|
|
8
|
+
constructor(method, path) {
|
|
9
|
+
super();
|
|
10
|
+
this.method = method;
|
|
11
|
+
this.path = path;
|
|
12
|
+
}
|
|
13
|
+
summary(summary) {
|
|
14
|
+
super.set("summary", summary);
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
description(description) {
|
|
18
|
+
super.set("description", description);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
5
22
|
export class JsonOperation extends JsonMap {
|
|
6
23
|
#status;
|
|
7
24
|
#redirection;
|
|
@@ -112,6 +129,19 @@ export class JsonOperation extends JsonMap {
|
|
|
112
129
|
super.set("deprecated", deprecated);
|
|
113
130
|
return this;
|
|
114
131
|
}
|
|
132
|
+
addAllowedGroupsParameter(allowedGroups) {
|
|
133
|
+
const jsonParameter = new JsonParameter();
|
|
134
|
+
jsonParameter.in("query").name("includes");
|
|
135
|
+
jsonParameter.schema(JsonSchema.from({
|
|
136
|
+
type: "array",
|
|
137
|
+
items: {
|
|
138
|
+
type: "string",
|
|
139
|
+
enum: [...allowedGroups]
|
|
140
|
+
}
|
|
141
|
+
}));
|
|
142
|
+
this.addParameter(-1, jsonParameter);
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
115
145
|
parameters(parameters) {
|
|
116
146
|
super.set("parameters", parameters);
|
|
117
147
|
return this;
|
|
@@ -134,13 +164,10 @@ export class JsonOperation extends JsonMap {
|
|
|
134
164
|
const produces = uniq([].concat(this.get("produces"), produce)).filter(Boolean);
|
|
135
165
|
this.set("produces", produces);
|
|
136
166
|
}
|
|
137
|
-
addOperationPath(method, path
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
path
|
|
142
|
-
});
|
|
143
|
-
return this;
|
|
167
|
+
addOperationPath(method, path) {
|
|
168
|
+
const operationPath = new JsonMethodPath(method, path);
|
|
169
|
+
this.operationPaths.set(String(method) + String(path), operationPath);
|
|
170
|
+
return operationPath;
|
|
144
171
|
}
|
|
145
172
|
getAllowedOperationPath(allowedVerbs) {
|
|
146
173
|
if (!allowedVerbs) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonOperation.js","sourceRoot":"","sources":["../../../src/domain/JsonOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"JsonOperation.js","sourceRoot":"","sources":["../../../src/domain/JsonOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAInD,OAAO,EAAC,mBAAmB,EAAE,eAAe,EAAC,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,MAAM,OAAO,cAAe,SAAQ,OAAY;IAC9C,YACS,MAAc,EACd,IAAqB;QAE5B,KAAK,EAAE,CAAC;QAHD,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAiB;IAG9B,CAAC;IAED,OAAO,CAAC,OAAe;QACrB,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,WAAmB;QAC7B,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAOD,MAAM,OAAO,aAAc,SAA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C,YAAY,EAAE;YACjB,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;SAC1C;QAED,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACvH,CAAC;CACF"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
import { JsonMap } from "./JsonMap.js";
|
|
3
3
|
import { formatParameterType } from "./JsonParameterTypes.js";
|
|
4
|
+
import { JsonSchema } from "./JsonSchema.js";
|
|
4
5
|
export class JsonParameter extends JsonMap {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(
|
|
6
|
+
constructor(obj = {}) {
|
|
7
|
+
super(obj);
|
|
7
8
|
this.$kind = "operationInParameter";
|
|
8
|
-
this.
|
|
9
|
+
if (!this.has("schema")) {
|
|
10
|
+
this.set("schema", new JsonSchema());
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
getName() {
|
|
11
14
|
const name = this.get("name");
|
|
@@ -36,8 +39,20 @@ export class JsonParameter extends JsonMap {
|
|
|
36
39
|
return this;
|
|
37
40
|
}
|
|
38
41
|
schema(schema) {
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
if (schema) {
|
|
43
|
+
this.set("schema", schema);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
return this.get("schema");
|
|
47
|
+
}
|
|
48
|
+
itemSchema(schema) {
|
|
49
|
+
if (this.schema().isCollection) {
|
|
50
|
+
schema && this.schema().itemSchema(schema);
|
|
51
|
+
return this.schema().itemSchema();
|
|
52
|
+
}
|
|
53
|
+
schema && this.schema(schema);
|
|
54
|
+
// non-collection: delegate to the main schema
|
|
55
|
+
return this.schema();
|
|
41
56
|
}
|
|
42
57
|
toJSON(options) {
|
|
43
58
|
return execMapper("operationInParameter", [this], options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonParameter.js","sourceRoot":"","sources":["../../../src/domain/JsonParameter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JsonParameter.js","sourceRoot":"","sources":["../../../src/domain/JsonParameter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,MAAM,OAAO,aAAc,SAAQ,OAAiC;IAIlE,YAAY,MAAyC,EAAE;QACrD,KAAK,CAAC,GAAG,CAAC,CAAC;QAJb,UAAK,GAAG,sBAAsB,CAAC;QAK7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACvB,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC;SACtC;IACH,CAAC;IAED,OAAO;QACL,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAE9B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE;YAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3B;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,QAAgD;QACvD,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;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
|
|
2
|
-
import { ancestorsOf, DecoratorTypes, isClass,
|
|
2
|
+
import { ancestorsOf, DecoratorTypes, isClass, isMethodDescriptor, Metadata, prototypeOf } from "@tsed/core";
|
|
3
|
+
import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
|
|
3
4
|
import { JsonEntityStore } from "./JsonEntityStore.js";
|
|
4
5
|
import { JsonParameter } from "./JsonParameter.js";
|
|
5
|
-
import { JsonSchema } from "./JsonSchema.js";
|
|
6
|
-
import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
|
|
7
6
|
let JsonParameterStore = class JsonParameterStore extends JsonEntityStore {
|
|
8
7
|
constructor(options) {
|
|
9
8
|
super(options);
|
|
@@ -17,12 +16,6 @@ let JsonParameterStore = class JsonParameterStore extends JsonEntityStore {
|
|
|
17
16
|
this.expression = options.expression || this.expression;
|
|
18
17
|
this.dataPath = options.dataPath || this.dataPath;
|
|
19
18
|
}
|
|
20
|
-
get nestedGenerics() {
|
|
21
|
-
return this.parameter.nestedGenerics;
|
|
22
|
-
}
|
|
23
|
-
set nestedGenerics(nestedGenerics) {
|
|
24
|
-
this.parameter.nestedGenerics = nestedGenerics;
|
|
25
|
-
}
|
|
26
19
|
/**
|
|
27
20
|
* Return the required state.
|
|
28
21
|
* @returns {boolean}
|
|
@@ -34,7 +27,10 @@ let JsonParameterStore = class JsonParameterStore extends JsonEntityStore {
|
|
|
34
27
|
this.parameter.required(value);
|
|
35
28
|
}
|
|
36
29
|
get allowedRequiredValues() {
|
|
37
|
-
return this.schema
|
|
30
|
+
return this.schema.getAllowedRequiredValues();
|
|
31
|
+
}
|
|
32
|
+
get schema() {
|
|
33
|
+
return this.parameter.schema();
|
|
38
34
|
}
|
|
39
35
|
static getParams(target, propertyKey) {
|
|
40
36
|
const params = [];
|
|
@@ -62,28 +58,22 @@ let JsonParameterStore = class JsonParameterStore extends JsonEntityStore {
|
|
|
62
58
|
isRequired(value) {
|
|
63
59
|
return this.required && [undefined, null, ""].includes(value) && !this.allowedRequiredValues.includes(value);
|
|
64
60
|
}
|
|
65
|
-
getSchema(type) {
|
|
66
|
-
if (isCollection(type) || !isClass(type)) {
|
|
67
|
-
return JsonSchema.from({
|
|
68
|
-
type
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return JsonEntityStore.from(type).schema;
|
|
72
|
-
}
|
|
73
61
|
build() {
|
|
74
62
|
if (!this._type) {
|
|
75
63
|
const type = Metadata.getParamTypes(prototypeOf(this.target), this.propertyKey)[this.index];
|
|
76
64
|
this.buildType(type);
|
|
77
65
|
}
|
|
78
66
|
this._type = this._type || Object;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this.parameter.schema(this.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
67
|
+
this.parent.children.set(this.index, this);
|
|
68
|
+
this.parent.operation.addParameter(this.index, this.parameter);
|
|
69
|
+
if (this.collectionType) {
|
|
70
|
+
this.parameter.schema().type(this.collectionType);
|
|
71
|
+
}
|
|
72
|
+
if (isClass(this._type)) {
|
|
73
|
+
this.parameter.schema().itemSchema(this._type);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.parameter.itemSchema().type(this._type);
|
|
87
77
|
}
|
|
88
78
|
}
|
|
89
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonParameterStore.js","sourceRoot":"","sources":["../../../src/domain/JsonParameterStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"JsonParameterStore.js","sourceRoot":"","sources":["../../../src/domain/JsonParameterStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,WAAW,EAAO,MAAM,YAAY,CAAC;AAEjH,OAAO,EAAC,mBAAmB,EAAC,MAAM,6CAA6C,C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C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAM,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,KAAe,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzE,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACnD;QAED,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAChD;aAAM;YACL,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC9C;IACH,CAAC;CACF,CAAA;AAhGY,kBAAkB;IAD9B,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC;;GAC7B,kBAAkB,CAgG9B;SAhGY,kBAAkB;AAsG/B,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,50 +1,15 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { DecoratorTypes, Metadata, prototypeOf } from "@tsed/core";
|
|
2
|
+
import { DecoratorTypes, isClass, Metadata, prototypeOf } from "@tsed/core";
|
|
3
|
+
import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
|
|
3
4
|
import { JsonEntityStore } from "./JsonEntityStore.js";
|
|
4
5
|
import { JsonSchema } from "./JsonSchema.js";
|
|
5
|
-
import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
|
|
6
6
|
let JsonPropertyStore = class JsonPropertyStore extends JsonEntityStore {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.parent = JsonEntityStore.from(this.target);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @returns {boolean}
|
|
14
|
-
*/
|
|
15
|
-
get required() {
|
|
16
|
-
return this.parent.schema.isRequired(this.propertyKey);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Change the state of the required data.
|
|
20
|
-
* @param value
|
|
21
|
-
*/
|
|
22
|
-
set required(value) {
|
|
23
|
-
if (value) {
|
|
24
|
-
this.parent.schema.addRequired(this.propertyKey);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this.parent.schema.removeRequired(this.propertyKey);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
get allowedRequiredValues() {
|
|
31
|
-
return this.schema.$allow;
|
|
32
|
-
}
|
|
33
|
-
discriminatorKey() {
|
|
34
|
-
this.parent.schema.discriminatorKey(String(this.propertyKey));
|
|
35
|
-
this.itemSchema.isDiscriminatorKey = true;
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
isDiscriminatorKey() {
|
|
39
|
-
return this.itemSchema.isDiscriminatorKey;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Check precondition between value, required and allowedRequiredValues to know if the entity is required.
|
|
43
|
-
* @param value
|
|
44
|
-
* @returns {boolean}
|
|
45
|
-
*/
|
|
46
|
-
isRequired(value) {
|
|
47
|
-
return this.required && [undefined, null, ""].includes(value) && !this.allowedRequiredValues.includes(value);
|
|
11
|
+
static get(target, propertyKey) {
|
|
12
|
+
return JsonEntityStore.from(prototypeOf(target), propertyKey);
|
|
48
13
|
}
|
|
49
14
|
build() {
|
|
50
15
|
if (!this._type) {
|
|
@@ -55,19 +20,23 @@ let JsonPropertyStore = class JsonPropertyStore extends JsonEntityStore {
|
|
|
55
20
|
let schema = properties[this.propertyName];
|
|
56
21
|
if (!schema) {
|
|
57
22
|
this.parent.children.set(this.propertyName, this);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
23
|
+
if (this.isCollection) {
|
|
24
|
+
schema = JsonSchema.from({
|
|
25
|
+
type: this.collectionType
|
|
26
|
+
});
|
|
27
|
+
schema.itemSchema(this.type);
|
|
28
|
+
}
|
|
29
|
+
else if (isClass(this.type)) {
|
|
30
|
+
schema = JsonSchema.from({ type: "object" });
|
|
62
31
|
schema.itemSchema(this.type);
|
|
63
32
|
}
|
|
33
|
+
else {
|
|
34
|
+
schema = JsonSchema.from({ type: this.type });
|
|
35
|
+
}
|
|
64
36
|
}
|
|
65
37
|
this.parent.schema.addProperty(this.propertyName, schema);
|
|
66
38
|
this._schema = schema;
|
|
67
39
|
}
|
|
68
|
-
static get(target, propertyKey) {
|
|
69
|
-
return JsonEntityStore.from(prototypeOf(target), propertyKey);
|
|
70
|
-
}
|
|
71
40
|
};
|
|
72
41
|
JsonPropertyStore = __decorate([
|
|
73
42
|
JsonEntityComponent(DecoratorTypes.PROP)
|