@tsed/schema 7.0.0-beta.2 → 7.0.0-beta.20
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/coverage.json +6 -0
- package/jest.config.js +1 -6
- package/lib/cjs/components/lazyRefMapper.js +1 -2
- package/lib/cjs/components/lazyRefMapper.js.map +1 -1
- package/lib/cjs/components/objectMapper.js +1 -1
- package/lib/cjs/components/objectMapper.js.map +1 -1
- package/lib/cjs/components/schemaMapper.js +1 -1
- package/lib/cjs/components/schemaMapper.js.map +1 -1
- package/lib/cjs/constants/httpStatusMessages.js +14 -100
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
- package/lib/cjs/decorators/collections/collectionOf.js +3 -4
- package/lib/cjs/decorators/collections/collectionOf.js.map +1 -1
- package/lib/cjs/decorators/common/anyOf.js +4 -0
- package/lib/cjs/decorators/common/anyOf.js.map +1 -1
- package/lib/cjs/decorators/common/description.js +1 -2
- package/lib/cjs/decorators/common/description.js.map +1 -1
- package/lib/cjs/decorators/common/enum.js +1 -20
- package/lib/cjs/decorators/common/enum.js.map +1 -1
- package/lib/cjs/decorators/common/ignore.js.map +1 -1
- package/lib/cjs/decorators/common/jsonEntityFn.js.map +1 -1
- package/lib/cjs/decorators/common/oneOf.js +4 -0
- package/lib/cjs/decorators/common/oneOf.js.map +1 -1
- package/lib/cjs/decorators/common/recordOf.js +63 -0
- package/lib/cjs/decorators/common/recordOf.js.map +1 -0
- package/lib/cjs/decorators/operations/acceptMime.js +28 -0
- package/lib/cjs/decorators/operations/acceptMime.js.map +1 -0
- package/lib/cjs/decorators/operations/in.js +6 -4
- package/lib/cjs/decorators/operations/in.js.map +1 -1
- package/lib/cjs/decorators/operations/redirect.js +1 -2
- package/lib/cjs/decorators/operations/redirect.js.map +1 -1
- package/lib/cjs/decorators/operations/returns.js +43 -21
- package/lib/cjs/decorators/operations/returns.js.map +1 -1
- package/lib/cjs/decorators/operations/route.js +1 -4
- package/lib/cjs/decorators/operations/route.js.map +1 -1
- package/lib/cjs/decorators/operations/view.js +31 -0
- package/lib/cjs/decorators/operations/view.js.map +1 -0
- package/lib/cjs/domain/DecoratorContext.js +6 -3
- package/lib/cjs/domain/DecoratorContext.js.map +1 -1
- package/lib/cjs/domain/JsonClassStore.js +5 -8
- package/lib/cjs/domain/JsonClassStore.js.map +1 -1
- package/lib/cjs/domain/JsonEntityStore.js +40 -1
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
- package/lib/cjs/domain/JsonLazyRef.js +2 -1
- package/lib/cjs/domain/JsonLazyRef.js.map +1 -1
- package/lib/cjs/domain/JsonMap.js.map +1 -1
- package/lib/cjs/domain/JsonMethodStore.js +85 -39
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
- package/lib/cjs/domain/JsonOperation.js +15 -34
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonOperationPathsMap.js +2 -16
- package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -1
- package/lib/cjs/domain/JsonOperationRoute.js +11 -8
- package/lib/cjs/domain/JsonOperationRoute.js.map +1 -1
- package/lib/cjs/domain/JsonParameter.js +42 -48
- package/lib/cjs/domain/JsonParameter.js.map +1 -1
- package/lib/cjs/domain/JsonParameterStore.js +26 -10
- package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
- package/lib/cjs/domain/JsonPropertyStore.js +7 -6
- package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
- package/lib/cjs/domain/JsonResponse.js +7 -18
- package/lib/cjs/domain/JsonResponse.js.map +1 -1
- package/lib/cjs/domain/JsonSchema.js +62 -71
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/domain/SpecTypes.js +1 -0
- package/lib/cjs/domain/SpecTypes.js.map +1 -1
- package/lib/cjs/hooks/alterIgnore.js +2 -3
- package/lib/cjs/hooks/alterIgnore.js.map +1 -1
- package/lib/cjs/hooks/alterRequiredGroups.js +1 -2
- package/lib/cjs/hooks/alterRequiredGroups.js.map +1 -1
- package/lib/cjs/index.js +150 -20
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/JsonSchemaOptions.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/concatPath.js +16 -1
- package/lib/cjs/utils/concatPath.js.map +1 -1
- package/lib/cjs/utils/from.js +9 -8
- package/lib/cjs/utils/from.js.map +1 -1
- package/lib/cjs/utils/generateSpec.js +46 -0
- package/lib/cjs/utils/generateSpec.js.map +1 -0
- package/lib/cjs/utils/generics.js.map +1 -1
- package/lib/cjs/utils/getJsonPathParameters.js +20 -6
- package/lib/cjs/utils/getJsonPathParameters.js.map +1 -1
- package/lib/cjs/utils/getJsonSchema.js +12 -3
- package/lib/cjs/utils/getJsonSchema.js.map +1 -1
- package/lib/cjs/utils/getJsonType.js +1 -1
- package/lib/cjs/utils/getJsonType.js.map +1 -1
- package/lib/cjs/utils/getOperationsRoutes.js +2 -1
- package/lib/cjs/utils/getOperationsRoutes.js.map +1 -1
- package/lib/cjs/utils/getRequiredProperties.js +3 -3
- package/lib/cjs/utils/getRequiredProperties.js.map +1 -1
- package/lib/cjs/utils/getSpec.js +58 -43
- package/lib/cjs/utils/getSpec.js.map +1 -1
- package/lib/cjs/utils/getSpecType.js +21 -0
- package/lib/cjs/utils/getSpecType.js.map +1 -0
- package/lib/cjs/utils/mapNullableType.js +1 -1
- package/lib/cjs/utils/mapNullableType.js.map +1 -1
- package/lib/cjs/utils/mapOpenSpec.js +41 -0
- package/lib/cjs/utils/mapOpenSpec.js.map +1 -0
- package/lib/cjs/utils/mapOpenSpec2.js +34 -0
- package/lib/cjs/utils/mapOpenSpec2.js.map +1 -0
- package/lib/cjs/utils/mapOpenSpec3.js +26 -0
- package/lib/cjs/utils/mapOpenSpec3.js.map +1 -0
- package/lib/cjs/utils/mapOpenSpecInfo.js +21 -0
- package/lib/cjs/utils/mapOpenSpecInfo.js.map +1 -0
- package/lib/cjs/utils/matchGroups.js +1 -1
- package/lib/cjs/utils/matchGroups.js.map +1 -1
- package/lib/cjs/utils/mergeOperation.js +2 -2
- package/lib/cjs/utils/mergeOperation.js.map +1 -1
- package/lib/cjs/utils/mergeSpec.js.map +1 -1
- package/lib/cjs/utils/operationIdFormatter.js +3 -3
- package/lib/cjs/utils/operationIdFormatter.js.map +1 -1
- package/lib/cjs/utils/ref.js +2 -2
- package/lib/cjs/utils/ref.js.map +1 -1
- package/lib/cjs/utils/serializeEnumValues.js +26 -0
- package/lib/cjs/utils/serializeEnumValues.js.map +1 -0
- package/lib/cjs/utils/transformToOS2.js +510 -0
- package/lib/cjs/utils/transformToOS2.js.map +1 -0
- package/lib/esm/components/anyMapper.js +4 -4
- package/lib/esm/components/classMapper.js +4 -4
- package/lib/esm/components/genericsMapper.js +4 -4
- package/lib/esm/components/inheritedClassMapper.js +2 -2
- package/lib/esm/components/itemMapper.js +1 -1
- package/lib/esm/components/lazyRefMapper.js +4 -5
- package/lib/esm/components/lazyRefMapper.js.map +1 -1
- package/lib/esm/components/mapMapper.js +2 -2
- package/lib/esm/components/objectMapper.js +4 -4
- package/lib/esm/components/objectMapper.js.map +1 -1
- package/lib/esm/components/ofMapper.js +1 -1
- package/lib/esm/components/propertiesMapper.js +1 -1
- package/lib/esm/components/schemaMapper.js +7 -7
- package/lib/esm/components/schemaMapper.js.map +1 -1
- package/lib/esm/constants/httpStatusMessages.js +13 -100
- package/lib/esm/constants/httpStatusMessages.js.map +1 -1
- package/lib/esm/decorators/class/children.js +1 -1
- package/lib/esm/decorators/collections/collectionContains.js +1 -1
- package/lib/esm/decorators/collections/collectionOf.js +4 -5
- package/lib/esm/decorators/collections/collectionOf.js.map +1 -1
- 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/additionalProperties.js +1 -1
- package/lib/esm/decorators/common/allOf.js +1 -1
- package/lib/esm/decorators/common/allow.js +2 -2
- package/lib/esm/decorators/common/any.js +1 -1
- package/lib/esm/decorators/common/anyOf.js +5 -1
- package/lib/esm/decorators/common/anyOf.js.map +1 -1
- package/lib/esm/decorators/common/const.js +1 -1
- package/lib/esm/decorators/common/customKey.js +1 -1
- package/lib/esm/decorators/common/default.js +1 -1
- package/lib/esm/decorators/common/description.js +2 -3
- package/lib/esm/decorators/common/description.js.map +1 -1
- package/lib/esm/decorators/common/enum.js +2 -21
- package/lib/esm/decorators/common/enum.js.map +1 -1
- package/lib/esm/decorators/common/example.js +1 -1
- package/lib/esm/decorators/common/examples.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 +2 -2
- package/lib/esm/decorators/common/forwardGroups.js +1 -1
- package/lib/esm/decorators/common/groups.js +2 -2
- package/lib/esm/decorators/common/ignore.js +1 -1
- package/lib/esm/decorators/common/ignore.js.map +1 -1
- package/lib/esm/decorators/common/integer.js +1 -1
- package/lib/esm/decorators/common/jsonEntityFn.js +1 -1
- package/lib/esm/decorators/common/jsonEntityFn.js.map +1 -1
- 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/oneOf.js +5 -1
- package/lib/esm/decorators/common/oneOf.js.map +1 -1
- package/lib/esm/decorators/common/optional.js +1 -1
- package/lib/esm/decorators/common/pattern.js +1 -1
- package/lib/esm/decorators/common/property.js +1 -1
- package/lib/esm/decorators/common/readOnly.js +1 -1
- package/lib/esm/decorators/common/recordOf.js +59 -0
- package/lib/esm/decorators/common/recordOf.js.map +1 -0
- package/lib/esm/decorators/common/required.js +2 -2
- package/lib/esm/decorators/common/requiredGroups.js +2 -2
- package/lib/esm/decorators/common/schema.js +1 -1
- package/lib/esm/decorators/common/title.js +1 -1
- package/lib/esm/decorators/common/writeOnly.js +1 -1
- package/lib/esm/decorators/config/jsonEntityComponent.js +1 -1
- package/lib/esm/decorators/generics/genericOf.js +2 -2
- package/lib/esm/decorators/generics/generics.js +1 -1
- package/lib/esm/decorators/operations/acceptMime.js +24 -0
- package/lib/esm/decorators/operations/acceptMime.js.map +1 -0
- package/lib/esm/decorators/operations/consumes.js +1 -1
- package/lib/esm/decorators/operations/contentType.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 +3 -1
- package/lib/esm/decorators/operations/in.js.map +1 -1
- package/lib/esm/decorators/operations/inFile.js +5 -5
- package/lib/esm/decorators/operations/location.js +1 -1
- package/lib/esm/decorators/operations/operationId.js +1 -1
- package/lib/esm/decorators/operations/operationPath.js +1 -1
- package/lib/esm/decorators/operations/partial.js +1 -1
- package/lib/esm/decorators/operations/path.js +1 -1
- package/lib/esm/decorators/operations/produces.js +1 -1
- package/lib/esm/decorators/operations/redirect.js +3 -4
- package/lib/esm/decorators/operations/redirect.js.map +1 -1
- package/lib/esm/decorators/operations/returns.js +51 -29
- package/lib/esm/decorators/operations/returns.js.map +1 -1
- package/lib/esm/decorators/operations/route.js +4 -7
- package/lib/esm/decorators/operations/route.js.map +1 -1
- package/lib/esm/decorators/operations/security.js +1 -1
- package/lib/esm/decorators/operations/status.js +1 -1
- package/lib/esm/decorators/operations/summary.js +1 -1
- package/lib/esm/decorators/operations/tags.js +1 -1
- package/lib/esm/decorators/operations/view.js +27 -0
- package/lib/esm/decorators/operations/view.js.map +1 -0
- package/lib/esm/domain/DecoratorContext.js +6 -3
- package/lib/esm/domain/DecoratorContext.js.map +1 -1
- package/lib/esm/domain/JsonClassStore.js +7 -10
- package/lib/esm/domain/JsonClassStore.js.map +1 -1
- package/lib/esm/domain/JsonEntityStore.js +40 -1
- package/lib/esm/domain/JsonEntityStore.js.map +1 -1
- package/lib/esm/domain/JsonLazyRef.js +4 -3
- package/lib/esm/domain/JsonLazyRef.js.map +1 -1
- package/lib/esm/domain/JsonMap.js +1 -1
- package/lib/esm/domain/JsonMap.js.map +1 -1
- package/lib/esm/domain/JsonMethodStore.js +86 -40
- package/lib/esm/domain/JsonMethodStore.js.map +1 -1
- package/lib/esm/domain/JsonOperation.js +22 -41
- package/lib/esm/domain/JsonOperation.js.map +1 -1
- package/lib/esm/domain/JsonOperationPathsMap.js +3 -17
- package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -1
- package/lib/esm/domain/JsonOperationRoute.js +12 -9
- package/lib/esm/domain/JsonOperationRoute.js.map +1 -1
- package/lib/esm/domain/JsonParameter.js +46 -52
- package/lib/esm/domain/JsonParameter.js.map +1 -1
- package/lib/esm/domain/JsonParameterStore.js +29 -13
- package/lib/esm/domain/JsonParameterStore.js.map +1 -1
- package/lib/esm/domain/JsonPropertyStore.js +8 -7
- package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
- package/lib/esm/domain/JsonRequestBody.js +2 -2
- package/lib/esm/domain/JsonResponse.js +10 -21
- package/lib/esm/domain/JsonResponse.js.map +1 -1
- package/lib/esm/domain/JsonSchema.js +67 -76
- package/lib/esm/domain/JsonSchema.js.map +1 -1
- package/lib/esm/domain/SpecTypes.js +1 -0
- package/lib/esm/domain/SpecTypes.js.map +1 -1
- package/lib/esm/hooks/alterIgnore.js +2 -3
- package/lib/esm/hooks/alterIgnore.js.map +1 -1
- package/lib/esm/hooks/alterRequiredGroups.js +1 -2
- package/lib/esm/hooks/alterRequiredGroups.js.map +1 -1
- package/lib/esm/index.js +150 -20
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/JsonSchemaOptions.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/utils/concatPath.js +16 -1
- package/lib/esm/utils/concatPath.js.map +1 -1
- package/lib/esm/utils/from.js +5 -4
- package/lib/esm/utils/from.js.map +1 -1
- package/lib/esm/utils/generateSpec.js +41 -0
- package/lib/esm/utils/generateSpec.js.map +1 -0
- package/lib/esm/utils/generics.js.map +1 -1
- package/lib/esm/utils/getInheritedStores.js +1 -1
- package/lib/esm/utils/getJsonEntityStore.js +5 -5
- package/lib/esm/utils/getJsonPathParameters.js +20 -6
- package/lib/esm/utils/getJsonPathParameters.js.map +1 -1
- package/lib/esm/utils/getJsonSchema.js +15 -6
- package/lib/esm/utils/getJsonSchema.js.map +1 -1
- package/lib/esm/utils/getJsonType.js +2 -2
- package/lib/esm/utils/getJsonType.js.map +1 -1
- package/lib/esm/utils/getOperationsRoutes.js +5 -4
- package/lib/esm/utils/getOperationsRoutes.js.map +1 -1
- package/lib/esm/utils/getOperationsStores.js +4 -4
- package/lib/esm/utils/getPropertiesStores.js +3 -3
- package/lib/esm/utils/getRequiredProperties.js +4 -4
- package/lib/esm/utils/getRequiredProperties.js.map +1 -1
- package/lib/esm/utils/getSpec.js +65 -50
- package/lib/esm/utils/getSpec.js.map +1 -1
- package/lib/esm/utils/getSpecType.js +16 -0
- package/lib/esm/utils/getSpecType.js.map +1 -0
- package/lib/esm/utils/mapNullableType.js +2 -2
- package/lib/esm/utils/mapNullableType.js.map +1 -1
- package/lib/esm/utils/mapOpenSpec.js +37 -0
- package/lib/esm/utils/mapOpenSpec.js.map +1 -0
- package/lib/esm/utils/mapOpenSpec2.js +30 -0
- package/lib/esm/utils/mapOpenSpec2.js.map +1 -0
- package/lib/esm/utils/mapOpenSpec3.js +22 -0
- package/lib/esm/utils/mapOpenSpec3.js.map +1 -0
- package/lib/esm/utils/mapOpenSpecInfo.js +17 -0
- package/lib/esm/utils/mapOpenSpecInfo.js.map +1 -0
- package/lib/esm/utils/mapRouteOptions.js +1 -1
- package/lib/esm/utils/mergeOperation.js +5 -5
- package/lib/esm/utils/mergeOperation.js.map +1 -1
- package/lib/esm/utils/mergeSpec.js.map +1 -1
- package/lib/esm/utils/operationIdFormatter.js +1 -1
- package/lib/esm/utils/operationIdFormatter.js.map +1 -1
- package/lib/esm/utils/ref.js +2 -2
- package/lib/esm/utils/ref.js.map +1 -1
- package/lib/esm/utils/serializeEnumValues.js +21 -0
- package/lib/esm/utils/serializeEnumValues.js.map +1 -0
- package/lib/esm/utils/toJsonMapCollection.js +1 -1
- package/lib/esm/utils/transformToOS2.js +504 -0
- package/lib/esm/utils/transformToOS2.js.map +1 -0
- package/lib/types/constants/httpStatusMessages.d.ts +2 -263
- package/lib/types/decorators/common/anyOf.d.ts +4 -0
- package/lib/types/decorators/common/ignore.d.ts +1 -1
- package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
- package/lib/types/decorators/common/oneOf.d.ts +4 -0
- package/lib/types/decorators/common/recordOf.d.ts +46 -0
- package/lib/types/decorators/operations/acceptMime.d.ts +19 -0
- package/lib/types/decorators/operations/in.d.ts +1 -1
- package/lib/types/decorators/operations/returns.d.ts +7 -2
- package/lib/types/decorators/operations/view.d.ts +23 -0
- package/lib/types/domain/JsonEntityStore.d.ts +1 -0
- package/lib/types/domain/JsonMap.d.ts +1 -1
- package/lib/types/domain/JsonMethodStore.d.ts +56 -4
- package/lib/types/domain/JsonOperation.d.ts +2 -2
- package/lib/types/domain/JsonOperationPathsMap.d.ts +0 -2
- package/lib/types/domain/JsonOperationRoute.d.ts +7 -6
- package/lib/types/domain/JsonParameter.d.ts +2 -1
- package/lib/types/domain/JsonParameterStore.d.ts +23 -1
- package/lib/types/domain/JsonPropertyStore.d.ts +7 -0
- package/lib/types/domain/JsonResponse.d.ts +3 -1
- package/lib/types/domain/JsonSchema.d.ts +2 -2
- package/lib/types/domain/SpecTypes.d.ts +1 -0
- package/lib/types/index.d.ts +143 -13
- package/lib/types/interfaces/JsonSchemaOptions.d.ts +2 -2
- package/lib/types/utils/concatPath.d.ts +1 -1
- package/lib/types/utils/generateSpec.d.ts +16 -0
- package/lib/types/utils/generics.d.ts +1 -1
- package/lib/types/utils/getJsonSchema.d.ts +12 -2
- package/lib/types/utils/getOperationsRoutes.d.ts +2 -2
- package/lib/types/utils/getSpec.d.ts +5 -4
- package/lib/types/utils/getSpecType.d.ts +12 -0
- package/lib/types/utils/mapNullableType.d.ts +1 -1
- package/lib/types/utils/mapOpenSpec.d.ts +10 -0
- package/lib/types/utils/mapOpenSpec2.d.ts +9 -0
- package/lib/types/utils/mapOpenSpec3.d.ts +8 -0
- package/lib/types/utils/mapOpenSpecInfo.d.ts +6 -0
- package/lib/types/utils/mergeSpec.d.ts +2 -2
- package/lib/types/utils/serializeEnumValues.d.ts +5 -0
- package/lib/types/utils/transformToOS2.d.ts +25 -0
- package/package.json +35 -18
- package/readme.md +4 -2
- package/tsconfig.compile.esm.json +4 -13
- package/benchmark/cold-start.js +0 -17
- package/lib/cjs/components/index.js +0 -15
- package/lib/cjs/components/index.js.map +0 -1
- package/lib/cjs/decorators/index.js +0 -77
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/domain/index.js +0 -20
- package/lib/cjs/domain/index.js.map +0 -1
- package/lib/cjs/interfaces/index.js +0 -8
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/esm/components/index.js +0 -12
- package/lib/esm/components/index.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -74
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/domain/index.js +0 -17
- package/lib/esm/domain/index.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -5
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/types/components/index.d.ts +0 -11
- package/lib/types/decorators/index.d.ts +0 -68
- package/lib/types/domain/index.d.ts +0 -16
- package/lib/types/interfaces/index.d.ts +0 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isClass, isPrimitiveClass } from "@tsed/core";
|
|
2
|
-
import { JsonEntityStore } from "../domain/JsonEntityStore";
|
|
3
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
4
|
-
import { popGenerics } from "../utils/generics";
|
|
5
|
-
import { getJsonType } from "../utils/getJsonType";
|
|
2
|
+
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
3
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
4
|
+
import { popGenerics } from "../utils/generics.js";
|
|
5
|
+
import { getJsonType } from "../utils/getJsonType.js";
|
|
6
6
|
/**
|
|
7
7
|
* @ignore
|
|
8
8
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { classOf, deepMerge } from "@tsed/core";
|
|
2
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
-
import { getInheritedStores } from "../utils/getInheritedStores";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { getInheritedStores } from "../utils/getInheritedStores.js";
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function itemMapper(value, options) {
|
|
3
3
|
return value && value.isClass ? execMapper("class", value, options) : execMapper("any", value, options);
|
|
4
4
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
2
|
-
import { mapGenericsOptions } from "../utils/generics";
|
|
3
|
-
import { createRef, toRef } from "../utils/ref";
|
|
1
|
+
import { registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
|
+
import { mapGenericsOptions } from "../utils/generics.js";
|
|
3
|
+
import { createRef, toRef } from "../utils/ref.js";
|
|
4
4
|
export function lazyRefMapper(input, options) {
|
|
5
|
-
var _a;
|
|
6
5
|
const name = input.name;
|
|
7
|
-
if (
|
|
6
|
+
if (options.$refs?.find((t) => t === input.target)) {
|
|
8
7
|
return createRef(name, input.schema, options);
|
|
9
8
|
}
|
|
10
9
|
options.$refs = [...(options.$refs || []), input.target];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyRefMapper.js","sourceRoot":"","sources":["../../../src/components/lazyRefMapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AAE9C,MAAM,UAAU,aAAa,CAAC,KAAkB,EAAE,OAA0B
|
|
1
|
+
{"version":3,"file":"lazyRefMapper.js","sourceRoot":"","sources":["../../../src/components/lazyRefMapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,cAAc,CAAC;AAE9C,MAAM,UAAU,aAAa,CAAC,KAAkB,EAAE,OAA0B;IAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAExB,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,EAAE;QACvD,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/C;IAED,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,wBAAwB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import {JsonLazyRef} from \"../domain/JsonLazyRef\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {mapGenericsOptions} from \"../utils/generics\";\nimport {createRef, toRef} from \"../utils/ref\";\n\nexport function lazyRefMapper(input: JsonLazyRef, options: JsonSchemaOptions) {\n const name = input.name;\n\n if (options.$refs?.find((t: any) => t === input.target)) {\n return createRef(name, input.schema, options);\n }\n\n options.$refs = [...(options.$refs || []), input.target];\n\n const schema = input.toJSON(mapGenericsOptions(options));\n\n return toRef(input.schema, schema, options);\n}\n\nregisterJsonSchemaMapper(\"lazyRef\", lazyRefMapper);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mapGenericsOptions } from "../utils/generics";
|
|
2
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { mapGenericsOptions } from "../utils/generics.js";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
3
|
/**
|
|
4
4
|
* Serialize class which inherit from Map like JsonMap, JsonOperation, JsonParameter.
|
|
5
5
|
* @param input
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from "@tsed/core";
|
|
2
|
-
import { alterIgnore } from "../hooks/alterIgnore";
|
|
3
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
4
|
-
import { mapNullableType } from "../utils/mapNullableType";
|
|
2
|
+
import { alterIgnore } from "../hooks/alterIgnore.js";
|
|
3
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
4
|
+
import { mapNullableType } from "../utils/mapNullableType.js";
|
|
5
5
|
/**
|
|
6
6
|
* Serialize Any object to a json schema
|
|
7
7
|
* @param input
|
|
@@ -14,7 +14,7 @@ export function objectMapper(input, options) {
|
|
|
14
14
|
if (options.withIgnoredProps !== false && !alterIgnore(value, ctx)) {
|
|
15
15
|
const opts = {
|
|
16
16
|
...options,
|
|
17
|
-
groups:
|
|
17
|
+
groups: input?.$forwardGroups || value?.$forwardGroups ? options.groups : undefined
|
|
18
18
|
};
|
|
19
19
|
// remove groups to avoid bad schema generation over children models
|
|
20
20
|
obj[key] = execMapper("item", value, opts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectMapper.js","sourceRoot":"","sources":["../../../src/components/objectMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAU,EAAE,OAA0B;IACjE,MAAM,EAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,GAAG,EAAC,GAAG,OAAO,CAAC;IAE/H,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAA6B,EAAE,EAAE;QAChD,IAAI,OAAO,CAAC,gBAAgB,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,EAA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b,CAAC,EACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CACzB,CAAC;AACJ,CAAC;AAED,wBAAwB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import {isArray} from \"@tsed/core\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {alterIgnore} from \"../hooks/alterIgnore\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {mapNullableType} from \"../utils/mapNullableType\";\n\n/**\n * Serialize Any object to a json schema\n * @param input\n * @param options\n * @ignore\n */\nexport function objectMapper(input: any, options: JsonSchemaOptions) {\n const {specType, operationIdFormatter, root, schemas, genericTypes, nestedGenerics, useAlias, genericLabels, ...ctx} = options;\n\n return Object.entries(input).reduce<any>(\n (obj, [key, value]: [string, any | JsonSchema]) => {\n if (options.withIgnoredProps !== false && !alterIgnore(value, ctx)) {\n const opts = {\n ...options,\n groups: input?.$forwardGroups || value?.$forwardGroups ? options.groups : undefined\n };\n // remove groups to avoid bad schema generation over children models\n obj[key] = execMapper(\"item\", value, opts);\n obj[key] = mapNullableType(obj[key], value, opts);\n }\n\n return obj;\n },\n isArray(input) ? [] : {}\n );\n}\n\nregisterJsonSchemaMapper(\"object\", objectMapper);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function ofMapper(input, options, parent) {
|
|
3
3
|
return input.map((value) => {
|
|
4
4
|
return execMapper("item", value, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
2
2
|
export function propertiesMapper(input, options, parent) {
|
|
3
3
|
if (input.isClass) {
|
|
4
4
|
return execMapper("class", input, options);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isObject } from "@tsed/core";
|
|
2
|
-
import { mapAliasedProperties } from "../domain/JsonAliasMap";
|
|
3
|
-
import { SpecTypes } from "../domain/SpecTypes";
|
|
4
|
-
import { execMapper, hasMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
5
|
-
import { getRequiredProperties } from "../utils/getRequiredProperties";
|
|
6
|
-
import { alterOneOf } from "../hooks/alterOneOf";
|
|
7
|
-
import { mapNullableType } from "../utils/mapNullableType";
|
|
2
|
+
import { mapAliasedProperties } from "../domain/JsonAliasMap.js";
|
|
3
|
+
import { SpecTypes } from "../domain/SpecTypes.js";
|
|
4
|
+
import { execMapper, hasMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
5
|
+
import { getRequiredProperties } from "../utils/getRequiredProperties.js";
|
|
6
|
+
import { alterOneOf } from "../hooks/alterOneOf.js";
|
|
7
|
+
import { mapNullableType } from "../utils/mapNullableType.js";
|
|
8
8
|
/**
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
11
|
-
const IGNORES = ["name", "$required", "$hooks", "_nestedGenerics", SpecTypes.OPENAPI, SpecTypes.JSON];
|
|
11
|
+
const IGNORES = ["name", "$required", "$hooks", "_nestedGenerics", SpecTypes.OPENAPI, SpecTypes.SWAGGER, SpecTypes.JSON];
|
|
12
12
|
/**
|
|
13
13
|
* @ignore
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaMapper.js","sourceRoot":"","sources":["../../../src/components/schemaMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5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,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,EAAC,CAAC,CAAC;KAC/G;IAED,GAAG,GAAG,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAQ,CAAC,CAAC;IAE7E,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,EAAE;QAC1C,GAAG,GAAG;YACJ,GAAG,GAAG;YACN,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;SAC1D,CAAC;KACH;IAED,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAC,GAAG,OAAO,EAAE,QAAQ,EAAC,CAAC,CAAC;IACjE,GAAG,GAAG,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wBAAwB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import {isObject} from \"@tsed/core\";\nimport {mapAliasedProperties} from \"../domain/JsonAliasMap\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, hasMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getRequiredProperties} from \"../utils/getRequiredProperties\";\nimport {alterOneOf} from \"../hooks/alterOneOf\";\nimport {mapNullableType} from \"../utils/mapNullableType\";\n\n/**\n * @ignore\n */\nconst IGNORES = [\"name\", \"$required\", \"$hooks\", \"_nestedGenerics\", SpecTypes.OPENAPI, SpecTypes.SWAGGER, SpecTypes.JSON];\n/**\n * @ignore\n */\nconst IGNORES_OPENSPEC = [\"const\"];\n\n/**\n * @ignore\n */\nfunction isEmptyProperties(key: string, value: any) {\n return typeof value === \"object\" && [\"items\", \"properties\", \"additionalProperties\"].includes(key) && Object.keys(value).length === 0;\n}\n\n/**\n * @ignore\n */\nfunction shouldMapAlias(key: string, value: any, useAlias: boolean) {\n return typeof value === \"object\" && useAlias && [\"properties\", \"additionalProperties\"].includes(key);\n}\n\n/**\n * @ignore\n */\nfunction shouldSkipKey(key: string, {specType = SpecTypes.JSON, customKeys = false}: JsonSchemaOptions) {\n return (\n IGNORES.includes(key) ||\n (key.startsWith(\"#\") && (customKeys === false || specType !== SpecTypes.JSON)) ||\n (specType !== SpecTypes.JSON && IGNORES_OPENSPEC.includes(key))\n );\n}\n\nfunction isExample(key: string, value: any, options: JsonSchemaOptions) {\n return key === \"examples\" && isObject(value) && SpecTypes.OPENAPI === options.specType!;\n}\n\nexport function schemaMapper(schema: JsonSchema, options: JsonSchemaOptions): any {\n const {useAlias = true, schemas = {}} = options;\n options = {\n ...options,\n useAlias,\n schemas\n };\n\n let obj: any = [...schema.keys()]\n .filter((key) => !shouldSkipKey(key, options))\n .reduce((item: any, key) => {\n let value = schema.get(key);\n\n key = key.replace(/^#/, \"\");\n\n if (key === \"type\") {\n return {\n ...item,\n [key]: schema.getJsonType()\n };\n }\n\n if (isExample(key, value, options)) {\n key = \"example\";\n value = Object.values(value)[0];\n }\n\n if (value && typeof value === \"object\" && hasMapper(key)) {\n value = execMapper(key, value, options, schema);\n\n if (isEmptyProperties(key, value)) {\n return item;\n }\n\n if (shouldMapAlias(key, value, useAlias)) {\n value = mapAliasedProperties(value, schema.alias);\n }\n }\n\n return {\n ...item,\n [key]: value\n };\n }, {});\n\n if (schema.isClass) {\n obj = execMapper(\"inheritedClass\", obj, {...options, root: false, schemas, target: schema.getComputedType()});\n }\n\n obj = execMapper(\"generics\", obj, {...options, root: false, schemas} as any);\n\n if (schema.has(options.specType as string)) {\n obj = {\n ...obj,\n ...schema.get(options.specType as string).toJSON(options)\n };\n }\n\n obj = getRequiredProperties(obj, schema, {...options, useAlias});\n obj = mapNullableType(obj, schema, options);\n obj = alterOneOf(obj, schema, options);\n\n return obj;\n}\n\nregisterJsonSchemaMapper(\"schema\", schemaMapper);\n"]}
|
|
@@ -1,105 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
"204": { label: "No Content", code: "NO_CONTENT" },
|
|
14
|
-
"205": { label: "Reset Content", code: "RESET_CONTENT" },
|
|
15
|
-
"206": { label: "Partial Content", code: "PARTIAL_CONTENT" },
|
|
16
|
-
"207": { label: "Multi-Status", code: "MULTI_STATUS" },
|
|
17
|
-
"208": { label: "Already Reported", code: "ALREADY_REPORTED" },
|
|
18
|
-
"226": { label: "IM Used", code: "IM_USED" },
|
|
19
|
-
"300": { label: "Multiple Choices", code: "MULTIPLE_CHOICES" },
|
|
20
|
-
"301": { label: "Moved Permanently", code: "MOVED_PERMANENTLY" },
|
|
21
|
-
"302": { label: "Found", code: "FOUND" },
|
|
22
|
-
"303": { label: "See Other", code: "SEE_OTHER" },
|
|
23
|
-
"304": { label: "Not Modified", code: "NOT_MODIFIED" },
|
|
24
|
-
"305": { label: "Use Proxy", code: "USE_PROXY" },
|
|
25
|
-
"306": { label: "(Unused)", code: "UNUSED" },
|
|
26
|
-
"307": { label: "Temporary Redirect", code: "TEMPORARY_REDIRECT" },
|
|
27
|
-
"308": { label: "Permanent Redirect", code: "PERMANENT_REDIRECT" },
|
|
28
|
-
"310": { label: "Too Many Redirects", code: "TOO_MANY_REDIRECTS" },
|
|
29
|
-
"400": { label: "Bad Request", code: "BAD_REQUEST" },
|
|
30
|
-
"401": { label: "Unauthorized", code: "UNAUTHORIZED" },
|
|
31
|
-
"402": { label: "Payment Required", code: "PAYMENT_REQUIRED" },
|
|
32
|
-
"403": { label: "Forbidden", code: "FORBIDDEN" },
|
|
33
|
-
"404": { label: "Not Found", code: "NOT_FOUND" },
|
|
34
|
-
"405": { label: "Method Not Allowed", code: "METHOD_NOT_ALLOWED" },
|
|
35
|
-
"406": { label: "Not Acceptable", code: "NOT_ACCEPTABLE" },
|
|
36
|
-
"407": {
|
|
37
|
-
label: "Proxy Authentication Required",
|
|
38
|
-
code: "PROXY_AUTHENTICATION_REQUIRED"
|
|
39
|
-
},
|
|
40
|
-
"408": { label: "Request Timeout", code: "REQUEST_TIMEOUT" },
|
|
41
|
-
"409": { label: "Conflict", code: "CONFLICT" },
|
|
42
|
-
"410": { label: "Gone", code: "GONE" },
|
|
43
|
-
"411": { label: "Length Required", code: "LENGTH_REQUIRED" },
|
|
44
|
-
"412": { label: "Precondition Failed", code: "PRECONDITION_FAILED" },
|
|
45
|
-
"413": {
|
|
46
|
-
label: "Request Entity Too Large",
|
|
47
|
-
code: "REQUEST_ENTITY_TOO_LARGE"
|
|
48
|
-
},
|
|
49
|
-
"414": { label: "Request URI Too Long", code: "REQUEST_URI_TOO_LONG" },
|
|
50
|
-
"415": { label: "Unsupported Media Type", code: "UNSUPPORTED_MEDIA_TYPE" },
|
|
51
|
-
"416": {
|
|
52
|
-
label: "Request Range Unsatisfiable",
|
|
53
|
-
code: "REQUEST_RANGE_UNSATISFIABLE"
|
|
54
|
-
},
|
|
55
|
-
"417": { label: "Expectation Failed", code: "EXPECTATION_FAILED" },
|
|
56
|
-
"418": { label: "I'm a Teapot", code: "I_M_A_TEAPOT" },
|
|
57
|
-
"421": { label: "Misdirected Request", code: "MISDIRECTED_REQUEST" },
|
|
58
|
-
"422": { label: "Unprocessable Entity", code: "UNPROCESSABLE_ENTITY" },
|
|
59
|
-
"423": { label: "Locked", code: "LOCKED" },
|
|
60
|
-
"424": { label: "Failed Dependency", code: "FAILED_DEPENDENCY" },
|
|
61
|
-
"425": { label: "Too Early", code: "TOO_EARLY" },
|
|
62
|
-
"426": { label: "Upgrade Required", code: "UPGRADE_REQUIRED" },
|
|
63
|
-
"427": { label: "Unassigned", code: "UNASSIGNED" },
|
|
64
|
-
"428": { label: "Precondition Required", code: "PRECONDITION_REQUIRED" },
|
|
65
|
-
"429": { label: "Too Many Requests", code: "TOO_MANY_REQUESTS" },
|
|
66
|
-
"430": { label: "Unassigned", code: "UNASSIGNED" },
|
|
67
|
-
"431": {
|
|
68
|
-
label: "Request Header Fields Too Large",
|
|
69
|
-
code: "REQUEST_HEADER_FIELDS_TOO_LARGE"
|
|
70
|
-
},
|
|
71
|
-
"451": {
|
|
72
|
-
label: "Unavailable For Legal Reasons",
|
|
73
|
-
code: "UNAVAILABLE_FOR_LEGAL_REASONS"
|
|
74
|
-
},
|
|
75
|
-
"500": { label: "Internal Server Error", code: "INTERNAL_SERVER_ERROR" },
|
|
76
|
-
"501": { label: "Not Implemented", code: "NOT_IMPLEMENTED" },
|
|
77
|
-
"502": { label: "Bad Gateway", code: "BAD_GATEWAY" },
|
|
78
|
-
"503": { label: "Service Unavailable", code: "SERVICE_UNAVAILABLE" },
|
|
79
|
-
"504": { label: "Gateway Timeout", code: "GATEWAY_TIMEOUT" },
|
|
80
|
-
"505": {
|
|
81
|
-
label: "HTTP Version Not Supported",
|
|
82
|
-
code: "HTTP_VERSION_NOT_SUPPORTED"
|
|
83
|
-
},
|
|
84
|
-
"506": { label: "Variant Also Negotiates", code: "VARIANT_ALSO_NEGOTIATES" },
|
|
85
|
-
"507": { label: "Insufficient Storage", code: "INSUFFICIENT_STORAGE" },
|
|
86
|
-
"508": { label: "Loop Detected", code: "LOOP_DETECTED" },
|
|
87
|
-
"509": {
|
|
88
|
-
label: "Bandwidth Limit Exceeded",
|
|
89
|
-
code: "BANDWIDTH_LIMIT_EXCEEDED"
|
|
90
|
-
},
|
|
91
|
-
"510": { label: "Not Extended", code: "NOT_EXTENDED" },
|
|
92
|
-
"511": {
|
|
93
|
-
label: "Network Authentication Required",
|
|
94
|
-
code: "NETWORK_AUTHENTICATION_REQUIRED"
|
|
95
|
-
}
|
|
96
|
-
};
|
|
1
|
+
import statuses from "statuses";
|
|
2
|
+
import { constantCase } from "change-case";
|
|
3
|
+
export const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map, code) => {
|
|
4
|
+
const message = String(statuses(code));
|
|
5
|
+
return {
|
|
6
|
+
...map,
|
|
7
|
+
[String(code)]: { label: message, code: constantCase(message) }
|
|
8
|
+
};
|
|
9
|
+
}, {});
|
|
10
|
+
HTTP_STATUS_MESSAGES["200"].label = "Success";
|
|
11
|
+
HTTP_STATUS_MESSAGES["200"].code = "SUCCESS";
|
|
97
12
|
export function getStatusConstant(status) {
|
|
98
|
-
|
|
99
|
-
return (_a = HTTP_STATUS_MESSAGES[status]) === null || _a === void 0 ? void 0 : _a.code;
|
|
13
|
+
return HTTP_STATUS_MESSAGES[status]?.code;
|
|
100
14
|
}
|
|
101
15
|
export function getStatusMessage(status) {
|
|
102
|
-
|
|
103
|
-
return (_a = HTTP_STATUS_MESSAGES[status]) === null || _a === void 0 ? void 0 : _a.label;
|
|
16
|
+
return HTTP_STATUS_MESSAGES[status]?.label;
|
|
104
17
|
}
|
|
105
18
|
//# sourceMappingURL=httpStatusMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAkD,EAAE,IAAY,EAAE,EAAE;IAC7H,MAAM,OAAO,GAAW,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,OAAO;QACL,GAAG,GAAG;QACN,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,EAAC;KAC9D,CAAC;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AAEP,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;AAC9C,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7C,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACvD,OAAQ,oBAA4B,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAuB;IACtD,OAAQ,oBAA4B,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;AACtD,CAAC","sourcesContent":["import statuses from \"statuses\";\nimport {constantCase} from \"change-case\";\n\nexport const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map: Record<string, {label: string; code: string}>, code: number) => {\n const message: string = String(statuses(code));\n return {\n ...map,\n [String(code)]: {label: message, code: constantCase(message)}\n };\n}, {});\n\nHTTP_STATUS_MESSAGES[\"200\"].label = \"Success\";\nHTTP_STATUS_MESSAGES[\"200\"].code = \"SUCCESS\";\n\nexport function getStatusConstant(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.code;\n}\n\nexport function getStatusMessage(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.label;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonEntityStore } from "../../domain/JsonEntityStore";
|
|
1
|
+
import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
|
|
2
2
|
/**
|
|
3
3
|
* Set the type of the item collection. The possible value is String, Boolean, Number, Date, Object, Class, etc...
|
|
4
4
|
*
|
|
@@ -32,20 +32,19 @@ import { JsonEntityStore } from "../../domain/JsonEntityStore";
|
|
|
32
32
|
* @collections
|
|
33
33
|
*/
|
|
34
34
|
export function CollectionOf(type, collectionType) {
|
|
35
|
+
if (!type) {
|
|
36
|
+
throw new Error("A type is required on `@CollectionOf(type)` decorator. Please give a type or wrap it inside an arrow function if you have a circular reference.");
|
|
37
|
+
}
|
|
35
38
|
const schema = {};
|
|
36
39
|
let contains = false;
|
|
37
40
|
const decorator = (...args) => {
|
|
38
41
|
const store = JsonEntityStore.from(...args);
|
|
39
|
-
// const itemSchema = store.itemSchema.toJSON();
|
|
40
42
|
if (collectionType) {
|
|
41
43
|
store.collectionType = collectionType;
|
|
42
44
|
store.schema.type(collectionType);
|
|
43
45
|
}
|
|
44
46
|
store.type = type;
|
|
45
|
-
// console.log(type);
|
|
46
47
|
store.itemSchema.type(type);
|
|
47
|
-
// console.log(store.itemSchema.getComputedType(), schema);
|
|
48
|
-
// store.itemSchema.assign({...itemSchema, type});
|
|
49
48
|
store.schema.assign(schema);
|
|
50
49
|
if (store.isArray && contains) {
|
|
51
50
|
store.schema.set("contains", store.schema.get("items"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectionOf.js","sourceRoot":"","sources":["../../../../src/decorators/collections/collectionOf.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAkE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,YAAY,CAAC,IAAS,EAAE,cAAoB;IAC1D,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,IAAI,QAAQ,GAAY,KAAK,CAAC;IAE9B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAS,EAAE,EAAE;QACjC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"collectionOf.js","sourceRoot":"","sources":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MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAE3B,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IACF,SAAS,CAAC,aAAa,GAAG,CAAC,aAAqB,EAAE,EAAE;QAClD,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;QAErC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,aAAa,GAAG,CAAC,aAAqB,EAAE,EAAE;QAClD,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;QAErC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,QAAQ,GAAG,GAAG,EAAE;QACxB,QAAQ,GAAG,IAAI,CAAC;QAEhB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,CAAC,WAAW,GAAG,IAAI,EAAE,EAAE;QAC7C,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;QAEjC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAS;IAC/B,OAAO,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,IAAS;IAC7B,OAAO,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../../domain/JsonEntityStore\";\n\nexport interface ArrayOfChainedDecorators {\n (...args: any): any;\n\n /**\n * An array instance is valid against `minItems` if its size is greater than, or equal to, the value of this keyword.\n *\n * ::: warning\n * The value `minItems` MUST be a non-negative integer.\n * :::\n *\n * ::: tip\n * Omitting this keyword has the same behavior as a value of 0.\n * :::\n */\n MinItems(minItems: number): this;\n\n /**\n * The value `maxItems` MUST be a non-negative integer.\n *\n * An array instance is valid against `maxItems` if its size is less than, or equal to, the value of this keyword.\n *\n * :: warning\n * The value `maxItems` MUST be a non-negative integer.\n * :::\n */\n MaxItems(maxItems: number): this;\n\n /**\n * Set the type of the item collection. The possible value is String, Boolean, Number, Date, Object, Class, etc...\n *\n * The array instance will be valid against \"contains\" if at least one of its elements is valid against the given schema.\n */\n Contains(): this;\n\n /**\n * If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.\n */\n UniqueItems(uniqueItems?: boolean): this;\n}\n\nexport interface MapOfChainedDecorators {\n (...args: any): any;\n\n /**\n * An object instance is valid against `minProperties` if its number of properties is less than, or equal to, the value of this keyword.\n *\n * ::: warning\n * The value of this keyword MUST be a non-negative integer.\n * :::\n */\n MinProperties(minProperties: number): this;\n\n /**\n * An object instance is valid against `maxProperties` if its number of properties is less than, or equal to, the value of this keyword.\n *\n * ::: warning\n * The value of this keyword MUST be a non-negative integer.\n * :::\n */\n MaxProperties(maxProperties: number): this;\n}\n\nexport interface CollectionOfChainedDecorators extends MapOfChainedDecorators, ArrayOfChainedDecorators {}\n\n/**\n * Set the type of the item collection. The possible value is String, Boolean, Number, Date, Object, Class, etc...\n *\n * ```typescript\n * class Model {\n * @CollectionOf(String).MinLength(0).MaxLength(0)\n * property: string[];\n * }\n * ```\n * ::: warning\n * You mustn't use the `type Type = string | number` as parameters Type.\n *\n * This example doesn't work:\n *\n * ```typescript\n * type Type = \"string\" | \"number\"\n * class Model {\n * @CollectionOf(Type)\n * property: Type[];\n * }\n * ```\n * :::\n *\n * @param {Type<any>} type\n * @param collectionType\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @collections\n */\nexport function CollectionOf(type: any, collectionType?: any): CollectionOfChainedDecorators {\n if (!type) {\n throw new Error(\n \"A type is required on `@CollectionOf(type)` decorator. Please give a type or wrap it inside an arrow function if you have a circular reference.\"\n );\n }\n\n const schema: any = {};\n let contains: boolean = false;\n\n const decorator = (...args: any) => {\n const store = JsonEntityStore.from(...args);\n\n if (collectionType) {\n store.collectionType = collectionType;\n store.schema.type(collectionType);\n }\n\n store.type = type;\n store.itemSchema.type(type);\n\n store.schema.assign(schema);\n\n if (store.isArray && contains) {\n store.schema.set(\"contains\", store.schema.get(\"items\"));\n store.schema.delete(\"items\");\n }\n };\n\n decorator.MinItems = (minItems: number) => {\n schema.minItems = minItems;\n\n return decorator;\n };\n\n decorator.MaxItems = (maxItems: number) => {\n schema.maxItems = maxItems;\n\n return decorator;\n };\n decorator.MinProperties = (minProperties: number) => {\n schema.minProperties = minProperties;\n\n return decorator;\n };\n\n decorator.MaxProperties = (maxProperties: number) => {\n schema.maxProperties = maxProperties;\n\n return decorator;\n };\n\n decorator.Contains = () => {\n contains = true;\n\n return decorator;\n };\n\n decorator.UniqueItems = (uniqueItems = true) => {\n schema.uniqueItems = uniqueItems;\n\n return decorator;\n };\n\n return decorator;\n}\n\n/**\n * Alias of @@GenericOf@@ decorator.\n * @param type\n * @decorator\n */\nexport function ArrayOf(type: any): ArrayOfChainedDecorators {\n return CollectionOf(type, Array);\n}\n\n/**\n * Alias of @@GenericOf@@ decorator.\n * @param type\n * @decorator\n */\nexport function MapOf(type: any): MapOfChainedDecorators {\n return CollectionOf(type, Map);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonEntityFn } from "../common/jsonEntityFn";
|
|
1
|
+
import { JsonEntityFn } from "../common/jsonEntityFn.js";
|
|
2
2
|
/**
|
|
3
3
|
* If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
4
4
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DecoratorTypes, isClass, useDecorators } from "@tsed/core";
|
|
2
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
3
|
-
import { Property } from "./property";
|
|
2
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
3
|
+
import { Property } from "./property.js";
|
|
4
4
|
/**
|
|
5
5
|
* Add allowed values when the property or parameters is required.
|
|
6
6
|
*
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
1
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
2
2
|
/**
|
|
3
3
|
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
4
4
|
*
|
|
5
|
+
* ::: warning
|
|
6
|
+
* AnyOf isn't supported by OS2
|
|
7
|
+
* :::
|
|
8
|
+
*
|
|
5
9
|
* @decorator
|
|
6
10
|
* @validation
|
|
7
11
|
* @swagger
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/anyOf.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/anyOf.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK,CAAC,GAAG,KAAsB;IAC7C,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {AnyJsonSchema} from \"../../domain/JsonSchema\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n *\n * ::: warning\n * AnyOf isn't supported by OS2\n * :::\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @classDecorator\n * @input\n * @param anyOf\n */\nexport function AnyOf(...anyOf: AnyJsonSchema[]) {\n return JsonEntityFn((entity) => {\n entity.itemSchema.anyOf(anyOf);\n });\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { decoratorTypeOf, DecoratorTypes } from "@tsed/core";
|
|
2
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
2
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
3
3
|
/**
|
|
4
4
|
* Add a description to the class, method or property
|
|
5
5
|
*
|
|
@@ -54,7 +54,6 @@ import { JsonEntityFn } from "./jsonEntityFn";
|
|
|
54
54
|
*/
|
|
55
55
|
export function Description(description) {
|
|
56
56
|
return JsonEntityFn((store, args) => {
|
|
57
|
-
var _a;
|
|
58
57
|
switch (decoratorTypeOf(args)) {
|
|
59
58
|
case DecoratorTypes.PROP:
|
|
60
59
|
case DecoratorTypes.CLASS:
|
|
@@ -64,7 +63,7 @@ export function Description(description) {
|
|
|
64
63
|
store.parameter.description(description);
|
|
65
64
|
break;
|
|
66
65
|
case DecoratorTypes.METHOD:
|
|
67
|
-
|
|
66
|
+
store.operation?.description(description);
|
|
68
67
|
break;
|
|
69
68
|
}
|
|
70
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/decorators/common/description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/decorators/common/description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,WAAW,CAAC,WAAgB;IAC1C,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,IAAyB,EAAE,EAAE;QACxE,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,cAAc,CAAC,IAAI,CAAC;YACzB,KAAK,cAAc,CAAC,KAAK;gBACvB,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACtC,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACtB,KAA4B,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACjE,MAAM;YAER,KAAK,cAAc,CAAC,MAAM;gBACvB,KAAyB,CAAC,SAAS,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;gBAC/D,MAAM;SACT;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {DecoratorParameters, decoratorTypeOf, DecoratorTypes} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\nimport type {JsonMethodStore} from \"../../domain/JsonMethodStore\";\nimport type {JsonParameterStore} from \"../../domain/JsonParameterStore\";\n\n/**\n * Add a description to the class, method or property\n *\n * ## Examples\n * ### On class\n *\n * ```typescript\n * @Description(\"description\")\n * class Model {\n *\n * }\n * ```\n *\n * ### On method\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * @Description(\"description\")\n * async method() {}\n * }\n * ```\n *\n * ### On parameter\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * async method(@Description(\"description\") @PathParam(\"id\") id: string) {}\n * }\n * ```\n *\n * ### On property\n *\n * ```typescript\n * class Model {\n * @Description(\"description\")\n * id: string;\n * }\n * ```\n *\n * @param {string} description\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @classDecorator\n * @methodDecorator\n * @propertyDecorator\n * @parameterDecorator\n */\nexport function Description(description: any) {\n return JsonEntityFn((store: JsonEntityStore, args: DecoratorParameters) => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.PROP:\n case DecoratorTypes.CLASS:\n store.schema.description(description);\n break;\n\n case DecoratorTypes.PARAM:\n (store as JsonParameterStore).parameter.description(description);\n break;\n\n case DecoratorTypes.METHOD:\n (store as JsonMethodStore).operation?.description(description);\n break;\n }\n });\n}\n"]}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JsonEntityFn } from "./jsonEntityFn";
|
|
3
|
-
const transformTsEnum = (enumValue) => {
|
|
4
|
-
return Object.keys(enumValue).reduce((acc, key) => {
|
|
5
|
-
if (isNaN(+key)) {
|
|
6
|
-
const value = enumValue[key];
|
|
7
|
-
return acc.concat(value);
|
|
8
|
-
}
|
|
9
|
-
return acc;
|
|
10
|
-
}, []);
|
|
11
|
-
};
|
|
1
|
+
import { JsonEntityFn } from "./jsonEntityFn.js";
|
|
12
2
|
export function Enum(enumValue, ...enumValues) {
|
|
13
3
|
return JsonEntityFn((store) => {
|
|
14
|
-
|
|
15
|
-
if (isObject(value) && value !== null) {
|
|
16
|
-
value = transformTsEnum(value);
|
|
17
|
-
}
|
|
18
|
-
return acc.concat(value);
|
|
19
|
-
}, []);
|
|
20
|
-
const types = values.reduce((set, value) => {
|
|
21
|
-
return set.add(value === null ? "null" : typeof value);
|
|
22
|
-
}, new Set());
|
|
23
|
-
store.itemSchema.enum(values).any(...types);
|
|
4
|
+
store.itemSchema.enum(enumValue, ...enumValues);
|
|
24
5
|
});
|
|
25
6
|
}
|
|
26
7
|
//# sourceMappingURL=enum.js.map
|