@tsed/schema 7.0.0-alpha.1 → 7.0.0-beta.3
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/benchmark/cold-start.js +17 -0
- package/jest.config.js +14 -0
- package/lib/cjs/components/anyMapper.js +23 -0
- package/lib/cjs/components/anyMapper.js.map +1 -0
- package/lib/cjs/components/classMapper.js +41 -0
- package/lib/cjs/components/classMapper.js.map +1 -0
- package/lib/cjs/components/genericsMapper.js +62 -0
- package/lib/cjs/components/genericsMapper.js.map +1 -0
- package/lib/cjs/components/index.js +15 -0
- package/lib/cjs/components/index.js.map +1 -0
- package/lib/cjs/components/inheritedClassMapper.js +22 -0
- package/lib/cjs/components/inheritedClassMapper.js.map +1 -0
- package/lib/cjs/components/itemMapper.js +10 -0
- package/lib/cjs/components/itemMapper.js.map +1 -0
- package/lib/cjs/components/lazyRefMapper.js +19 -0
- package/lib/cjs/components/lazyRefMapper.js.map +1 -0
- package/lib/cjs/components/mapMapper.js +25 -0
- package/lib/cjs/components/mapMapper.js.map +1 -0
- package/lib/cjs/components/objectMapper.js +31 -0
- package/lib/cjs/components/objectMapper.js.map +1 -0
- package/lib/cjs/components/ofMapper.js +17 -0
- package/lib/cjs/components/ofMapper.js.map +1 -0
- package/lib/cjs/components/propertiesMapper.js +25 -0
- package/lib/cjs/components/propertiesMapper.js.map +1 -0
- package/lib/cjs/components/schemaMapper.js +95 -0
- package/lib/cjs/components/schemaMapper.js.map +1 -0
- package/lib/cjs/constants/httpMethods.js +46 -0
- package/lib/cjs/constants/httpMethods.js.map +1 -0
- package/lib/cjs/constants/httpStatusMessages.js +110 -0
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -0
- package/lib/cjs/decorators/class/children.js +24 -0
- package/lib/cjs/decorators/class/children.js.map +1 -0
- package/lib/cjs/decorators/collections/collectionContains.js +29 -0
- package/lib/cjs/decorators/collections/collectionContains.js.map +1 -0
- package/lib/cjs/decorators/collections/collectionOf.js +103 -0
- package/lib/cjs/decorators/collections/collectionOf.js.map +1 -0
- package/lib/cjs/decorators/collections/maxItems.js +60 -0
- package/lib/cjs/decorators/collections/maxItems.js.map +1 -0
- package/lib/cjs/decorators/collections/maxProperties.js +83 -0
- package/lib/cjs/decorators/collections/maxProperties.js.map +1 -0
- package/lib/cjs/decorators/collections/minItems.js +64 -0
- package/lib/cjs/decorators/collections/minItems.js.map +1 -0
- package/lib/cjs/decorators/collections/minProperties.js +82 -0
- package/lib/cjs/decorators/collections/minProperties.js.map +1 -0
- package/lib/cjs/decorators/collections/uniqueItems.js +60 -0
- package/lib/cjs/decorators/collections/uniqueItems.js.map +1 -0
- package/lib/cjs/decorators/common/additionalProperties.js +20 -0
- package/lib/cjs/decorators/common/additionalProperties.js.map +1 -0
- package/lib/cjs/decorators/common/allOf.js +22 -0
- package/lib/cjs/decorators/common/allOf.js.map +1 -0
- package/lib/cjs/decorators/common/allow.js +47 -0
- package/lib/cjs/decorators/common/allow.js.map +1 -0
- package/lib/cjs/decorators/common/any.js +46 -0
- package/lib/cjs/decorators/common/any.js.map +1 -0
- package/lib/cjs/decorators/common/anyOf.js +22 -0
- package/lib/cjs/decorators/common/anyOf.js.map +1 -0
- package/lib/cjs/decorators/common/const.js +70 -0
- package/lib/cjs/decorators/common/const.js.map +1 -0
- package/lib/cjs/decorators/common/customKey.js +43 -0
- package/lib/cjs/decorators/common/customKey.js.map +1 -0
- package/lib/cjs/decorators/common/default.js +51 -0
- package/lib/cjs/decorators/common/default.js.map +1 -0
- package/lib/cjs/decorators/common/description.js +76 -0
- package/lib/cjs/decorators/common/description.js.map +1 -0
- package/lib/cjs/decorators/common/enum.js +30 -0
- package/lib/cjs/decorators/common/enum.js.map +1 -0
- package/lib/cjs/decorators/common/example.js +21 -0
- package/lib/cjs/decorators/common/example.js.map +1 -0
- package/lib/cjs/decorators/common/examples.js +21 -0
- package/lib/cjs/decorators/common/examples.js.map +1 -0
- package/lib/cjs/decorators/common/exclusiveMaximum.js +77 -0
- package/lib/cjs/decorators/common/exclusiveMaximum.js.map +1 -0
- package/lib/cjs/decorators/common/exclusiveMinimum.js +77 -0
- package/lib/cjs/decorators/common/exclusiveMinimum.js.map +1 -0
- package/lib/cjs/decorators/common/format.js +486 -0
- package/lib/cjs/decorators/common/format.js.map +1 -0
- package/lib/cjs/decorators/common/forwardGroups.js +20 -0
- package/lib/cjs/decorators/common/forwardGroups.js.map +1 -0
- package/lib/cjs/decorators/common/groups.js +41 -0
- package/lib/cjs/decorators/common/groups.js.map +1 -0
- package/lib/cjs/decorators/common/hidden.js +40 -0
- package/lib/cjs/decorators/common/hidden.js.map +1 -0
- package/lib/cjs/decorators/common/ignore.js +71 -0
- package/lib/cjs/decorators/common/ignore.js.map +1 -0
- package/lib/cjs/decorators/common/integer.js +71 -0
- package/lib/cjs/decorators/common/integer.js.map +1 -0
- package/lib/cjs/decorators/common/jsonEntityFn.js +32 -0
- package/lib/cjs/decorators/common/jsonEntityFn.js.map +1 -0
- package/lib/cjs/decorators/common/maxLength.js +89 -0
- package/lib/cjs/decorators/common/maxLength.js.map +1 -0
- package/lib/cjs/decorators/common/maximum.js +151 -0
- package/lib/cjs/decorators/common/maximum.js.map +1 -0
- package/lib/cjs/decorators/common/minLength.js +90 -0
- package/lib/cjs/decorators/common/minLength.js.map +1 -0
- package/lib/cjs/decorators/common/minimum.js +149 -0
- package/lib/cjs/decorators/common/minimum.js.map +1 -0
- package/lib/cjs/decorators/common/multipleOf.js +81 -0
- package/lib/cjs/decorators/common/multipleOf.js.map +1 -0
- package/lib/cjs/decorators/common/name.js +52 -0
- package/lib/cjs/decorators/common/name.js.map +1 -0
- package/lib/cjs/decorators/common/nullable.js +34 -0
- package/lib/cjs/decorators/common/nullable.js.map +1 -0
- package/lib/cjs/decorators/common/oneOf.js +23 -0
- package/lib/cjs/decorators/common/oneOf.js.map +1 -0
- package/lib/cjs/decorators/common/optional.js +28 -0
- package/lib/cjs/decorators/common/optional.js.map +1 -0
- package/lib/cjs/decorators/common/pattern.js +103 -0
- package/lib/cjs/decorators/common/pattern.js.map +1 -0
- package/lib/cjs/decorators/common/property.js +27 -0
- package/lib/cjs/decorators/common/property.js.map +1 -0
- package/lib/cjs/decorators/common/readOnly.js +21 -0
- package/lib/cjs/decorators/common/readOnly.js.map +1 -0
- package/lib/cjs/decorators/common/required.js +53 -0
- package/lib/cjs/decorators/common/required.js.map +1 -0
- package/lib/cjs/decorators/common/requiredGroups.js +26 -0
- package/lib/cjs/decorators/common/requiredGroups.js.map +1 -0
- package/lib/cjs/decorators/common/schema.js +68 -0
- package/lib/cjs/decorators/common/schema.js.map +1 -0
- package/lib/cjs/decorators/common/title.js +49 -0
- package/lib/cjs/decorators/common/title.js.map +1 -0
- package/lib/cjs/decorators/common/writeOnly.js +21 -0
- package/lib/cjs/decorators/common/writeOnly.js.map +1 -0
- package/lib/cjs/decorators/config/jsonEntityComponent.js +18 -0
- package/lib/cjs/decorators/config/jsonEntityComponent.js.map +1 -0
- package/lib/cjs/decorators/generics/genericOf.js +99 -0
- package/lib/cjs/decorators/generics/genericOf.js.map +1 -0
- package/lib/cjs/decorators/generics/generics.js +25 -0
- package/lib/cjs/decorators/generics/generics.js.map +1 -0
- package/lib/cjs/decorators/index.js +77 -0
- package/lib/cjs/decorators/index.js.map +1 -0
- package/lib/cjs/decorators/operations/consumes.js +39 -0
- package/lib/cjs/decorators/operations/consumes.js.map +1 -0
- package/lib/cjs/decorators/operations/contentType.js +28 -0
- package/lib/cjs/decorators/operations/contentType.js.map +1 -0
- package/lib/cjs/decorators/operations/deprecated.js +43 -0
- package/lib/cjs/decorators/operations/deprecated.js.map +1 -0
- package/lib/cjs/decorators/operations/header.js +59 -0
- package/lib/cjs/decorators/operations/header.js.map +1 -0
- package/lib/cjs/decorators/operations/in.js +78 -0
- package/lib/cjs/decorators/operations/in.js.map +1 -0
- package/lib/cjs/decorators/operations/inFile.js +45 -0
- package/lib/cjs/decorators/operations/inFile.js.map +1 -0
- package/lib/cjs/decorators/operations/location.js +29 -0
- package/lib/cjs/decorators/operations/location.js.map +1 -0
- package/lib/cjs/decorators/operations/operationId.js +24 -0
- package/lib/cjs/decorators/operations/operationId.js.map +1 -0
- package/lib/cjs/decorators/operations/operationPath.js +34 -0
- package/lib/cjs/decorators/operations/operationPath.js.map +1 -0
- package/lib/cjs/decorators/operations/partial.js +18 -0
- package/lib/cjs/decorators/operations/partial.js.map +1 -0
- package/lib/cjs/decorators/operations/path.js +29 -0
- package/lib/cjs/decorators/operations/path.js.map +1 -0
- package/lib/cjs/decorators/operations/produces.js +46 -0
- package/lib/cjs/decorators/operations/produces.js.map +1 -0
- package/lib/cjs/decorators/operations/redirect.js +26 -0
- package/lib/cjs/decorators/operations/redirect.js.map +1 -0
- package/lib/cjs/decorators/operations/returns.js +252 -0
- package/lib/cjs/decorators/operations/returns.js.map +1 -0
- package/lib/cjs/decorators/operations/route.js +200 -0
- package/lib/cjs/decorators/operations/route.js.map +1 -0
- package/lib/cjs/decorators/operations/security.js +43 -0
- package/lib/cjs/decorators/operations/security.js.map +1 -0
- package/lib/cjs/decorators/operations/status.js +133 -0
- package/lib/cjs/decorators/operations/status.js.map +1 -0
- package/lib/cjs/decorators/operations/summary.js +34 -0
- package/lib/cjs/decorators/operations/summary.js.map +1 -0
- package/lib/cjs/decorators/operations/tags.js +52 -0
- package/lib/cjs/decorators/operations/tags.js.map +1 -0
- package/lib/cjs/domain/DecoratorContext.js +88 -0
- package/lib/cjs/domain/DecoratorContext.js.map +1 -0
- package/lib/cjs/domain/JsonAliasMap.js +15 -0
- package/lib/cjs/domain/JsonAliasMap.js.map +1 -0
- package/lib/cjs/domain/JsonClassStore.js +37 -0
- package/lib/cjs/domain/JsonClassStore.js.map +1 -0
- package/lib/cjs/domain/JsonEntityStore.js +166 -0
- package/lib/cjs/domain/JsonEntityStore.js.map +1 -0
- package/lib/cjs/domain/JsonFormatTypes.js +22 -0
- package/lib/cjs/domain/JsonFormatTypes.js.map +1 -0
- package/lib/cjs/domain/JsonLazyRef.js +26 -0
- package/lib/cjs/domain/JsonLazyRef.js.map +1 -0
- package/lib/cjs/domain/JsonMap.js +27 -0
- package/lib/cjs/domain/JsonMap.js.map +1 -0
- package/lib/cjs/domain/JsonMethodStore.js +101 -0
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -0
- package/lib/cjs/domain/JsonOperation.js +250 -0
- package/lib/cjs/domain/JsonOperation.js.map +1 -0
- package/lib/cjs/domain/JsonOperationPathsMap.js +29 -0
- package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -0
- package/lib/cjs/domain/JsonOperationRoute.js +56 -0
- package/lib/cjs/domain/JsonOperationRoute.js.map +1 -0
- package/lib/cjs/domain/JsonParameter.js +125 -0
- package/lib/cjs/domain/JsonParameter.js.map +1 -0
- package/lib/cjs/domain/JsonParameterStore.js +90 -0
- package/lib/cjs/domain/JsonParameterStore.js.map +1 -0
- package/lib/cjs/domain/JsonParameterTypes.js +27 -0
- package/lib/cjs/domain/JsonParameterTypes.js.map +1 -0
- package/lib/cjs/domain/JsonPropertyStore.js +68 -0
- package/lib/cjs/domain/JsonPropertyStore.js.map +1 -0
- package/lib/cjs/domain/JsonRequestBody.js +32 -0
- package/lib/cjs/domain/JsonRequestBody.js.map +1 -0
- package/lib/cjs/domain/JsonResponse.js +86 -0
- package/lib/cjs/domain/JsonResponse.js.map +1 -0
- package/lib/cjs/domain/JsonSchema.js +723 -0
- package/lib/cjs/domain/JsonSchema.js.map +1 -0
- package/lib/cjs/domain/SpecTypes.js +9 -0
- package/lib/cjs/domain/SpecTypes.js.map +1 -0
- package/lib/cjs/domain/index.js +20 -0
- package/lib/cjs/domain/index.js.map +1 -0
- package/lib/cjs/hooks/alterIgnore.js +21 -0
- package/lib/cjs/hooks/alterIgnore.js.map +1 -0
- package/lib/cjs/hooks/alterOneOf.js +14 -0
- package/lib/cjs/hooks/alterOneOf.js.map +1 -0
- package/lib/cjs/hooks/alterRequiredGroups.js +15 -0
- package/lib/cjs/hooks/alterRequiredGroups.js.map +1 -0
- package/lib/cjs/index.js +24 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/IgnoreCallback.js +3 -0
- package/lib/cjs/interfaces/IgnoreCallback.js.map +1 -0
- package/lib/cjs/interfaces/JsonHookContext.js +3 -0
- package/lib/cjs/interfaces/JsonHookContext.js.map +1 -0
- package/lib/cjs/interfaces/JsonOpenSpec.js +3 -0
- package/lib/cjs/interfaces/JsonOpenSpec.js.map +1 -0
- package/lib/cjs/interfaces/JsonSchemaOptions.js +3 -0
- package/lib/cjs/interfaces/JsonSchemaOptions.js.map +1 -0
- package/lib/cjs/interfaces/index.js +8 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/cjs/registries/JsonSchemaMapperContainer.js +37 -0
- package/lib/cjs/registries/JsonSchemaMapperContainer.js.map +1 -0
- package/lib/cjs/utils/buildPath.js +13 -0
- package/lib/cjs/utils/buildPath.js.map +1 -0
- package/lib/cjs/utils/concatParameters.js +16 -0
- package/lib/cjs/utils/concatParameters.js.map +1 -0
- package/lib/cjs/utils/concatPath.js +8 -0
- package/lib/cjs/utils/concatPath.js.map +1 -0
- package/lib/cjs/utils/defineStatusModel.js +13 -0
- package/lib/cjs/utils/defineStatusModel.js.map +1 -0
- package/lib/cjs/utils/from.js +272 -0
- package/lib/cjs/utils/from.js.map +1 -0
- package/lib/cjs/utils/generics.js +40 -0
- package/lib/cjs/utils/generics.js.map +1 -0
- package/lib/cjs/utils/getComputedType.js +26 -0
- package/lib/cjs/utils/getComputedType.js.map +1 -0
- package/lib/cjs/utils/getInheritedStores.js +23 -0
- package/lib/cjs/utils/getInheritedStores.js.map +1 -0
- package/lib/cjs/utils/getJsonEntityStore.js +18 -0
- package/lib/cjs/utils/getJsonEntityStore.js.map +1 -0
- package/lib/cjs/utils/getJsonPathParameters.js +73 -0
- package/lib/cjs/utils/getJsonPathParameters.js.map +1 -0
- package/lib/cjs/utils/getJsonSchema.js +55 -0
- package/lib/cjs/utils/getJsonSchema.js.map +1 -0
- package/lib/cjs/utils/getJsonType.js +40 -0
- package/lib/cjs/utils/getJsonType.js.map +1 -0
- package/lib/cjs/utils/getOperationsRoutes.js +36 -0
- package/lib/cjs/utils/getOperationsRoutes.js.map +1 -0
- package/lib/cjs/utils/getOperationsStores.js +33 -0
- package/lib/cjs/utils/getOperationsStores.js.map +1 -0
- package/lib/cjs/utils/getPropertiesStores.js +45 -0
- package/lib/cjs/utils/getPropertiesStores.js.map +1 -0
- package/lib/cjs/utils/getRequiredProperties.js +66 -0
- package/lib/cjs/utils/getRequiredProperties.js.map +1 -0
- package/lib/cjs/utils/getSpec.js +87 -0
- package/lib/cjs/utils/getSpec.js.map +1 -0
- package/lib/cjs/utils/isSuccessStatus.js +8 -0
- package/lib/cjs/utils/isSuccessStatus.js.map +1 -0
- package/lib/cjs/utils/mapHeaders.js +29 -0
- package/lib/cjs/utils/mapHeaders.js.map +1 -0
- package/lib/cjs/utils/mapNullableType.js +44 -0
- package/lib/cjs/utils/mapNullableType.js.map +1 -0
- package/lib/cjs/utils/mapRouteOptions.js +26 -0
- package/lib/cjs/utils/mapRouteOptions.js.map +1 -0
- package/lib/cjs/utils/matchGroups.js +23 -0
- package/lib/cjs/utils/matchGroups.js.map +1 -0
- package/lib/cjs/utils/mergeOperation.js +44 -0
- package/lib/cjs/utils/mergeOperation.js.map +1 -0
- package/lib/cjs/utils/mergeSpec.js +46 -0
- package/lib/cjs/utils/mergeSpec.js.map +1 -0
- package/lib/cjs/utils/operationIdFormatter.js +37 -0
- package/lib/cjs/utils/operationIdFormatter.js.map +1 -0
- package/lib/cjs/utils/ref.js +65 -0
- package/lib/cjs/utils/ref.js.map +1 -0
- package/lib/cjs/utils/toJsonMapCollection.js +15 -0
- package/lib/cjs/utils/toJsonMapCollection.js.map +1 -0
- package/lib/cjs/utils/toJsonRegex.js +12 -0
- package/lib/cjs/utils/toJsonRegex.js.map +1 -0
- package/lib/esm/components/anyMapper.js +19 -0
- package/lib/esm/components/anyMapper.js.map +1 -0
- package/lib/esm/components/classMapper.js +37 -0
- package/lib/esm/components/classMapper.js.map +1 -0
- package/lib/esm/components/genericsMapper.js +58 -0
- package/lib/esm/components/genericsMapper.js.map +1 -0
- package/lib/esm/components/index.js +12 -0
- package/lib/esm/components/index.js.map +1 -0
- package/lib/esm/components/inheritedClassMapper.js +18 -0
- package/lib/esm/components/inheritedClassMapper.js.map +1 -0
- package/lib/esm/components/itemMapper.js +6 -0
- package/lib/esm/components/itemMapper.js.map +1 -0
- package/lib/esm/components/lazyRefMapper.js +15 -0
- package/lib/esm/components/lazyRefMapper.js.map +1 -0
- package/lib/esm/components/mapMapper.js +21 -0
- package/lib/esm/components/mapMapper.js.map +1 -0
- package/lib/esm/components/objectMapper.js +27 -0
- package/lib/esm/components/objectMapper.js.map +1 -0
- package/lib/esm/components/ofMapper.js +13 -0
- package/lib/esm/components/ofMapper.js.map +1 -0
- package/lib/esm/components/propertiesMapper.js +21 -0
- package/lib/esm/components/propertiesMapper.js.map +1 -0
- package/lib/esm/components/schemaMapper.js +91 -0
- package/lib/esm/components/schemaMapper.js.map +1 -0
- package/lib/esm/constants/httpMethods.js +43 -0
- package/lib/esm/constants/httpMethods.js.map +1 -0
- package/lib/esm/constants/httpStatusMessages.js +105 -0
- package/lib/esm/constants/httpStatusMessages.js.map +1 -0
- package/lib/esm/decorators/class/children.js +20 -0
- package/lib/esm/decorators/class/children.js.map +1 -0
- package/lib/esm/decorators/collections/collectionContains.js +25 -0
- package/lib/esm/decorators/collections/collectionContains.js.map +1 -0
- package/lib/esm/decorators/collections/collectionOf.js +97 -0
- package/lib/esm/decorators/collections/collectionOf.js.map +1 -0
- package/lib/esm/decorators/collections/maxItems.js +56 -0
- package/lib/esm/decorators/collections/maxItems.js.map +1 -0
- package/lib/esm/decorators/collections/maxProperties.js +79 -0
- package/lib/esm/decorators/collections/maxProperties.js.map +1 -0
- package/lib/esm/decorators/collections/minItems.js +60 -0
- package/lib/esm/decorators/collections/minItems.js.map +1 -0
- package/lib/esm/decorators/collections/minProperties.js +78 -0
- package/lib/esm/decorators/collections/minProperties.js.map +1 -0
- package/lib/esm/decorators/collections/uniqueItems.js +56 -0
- package/lib/esm/decorators/collections/uniqueItems.js.map +1 -0
- package/lib/esm/decorators/common/additionalProperties.js +16 -0
- package/lib/esm/decorators/common/additionalProperties.js.map +1 -0
- package/lib/esm/decorators/common/allOf.js +18 -0
- package/lib/esm/decorators/common/allOf.js.map +1 -0
- package/lib/esm/decorators/common/allow.js +43 -0
- package/lib/esm/decorators/common/allow.js.map +1 -0
- package/lib/esm/decorators/common/any.js +42 -0
- package/lib/esm/decorators/common/any.js.map +1 -0
- package/lib/esm/decorators/common/anyOf.js +18 -0
- package/lib/esm/decorators/common/anyOf.js.map +1 -0
- package/lib/esm/decorators/common/const.js +66 -0
- package/lib/esm/decorators/common/const.js.map +1 -0
- package/lib/esm/decorators/common/customKey.js +38 -0
- package/lib/esm/decorators/common/customKey.js.map +1 -0
- package/lib/esm/decorators/common/default.js +47 -0
- package/lib/esm/decorators/common/default.js.map +1 -0
- package/lib/esm/decorators/common/description.js +72 -0
- package/lib/esm/decorators/common/description.js.map +1 -0
- package/lib/esm/decorators/common/enum.js +26 -0
- package/lib/esm/decorators/common/enum.js.map +1 -0
- package/lib/esm/decorators/common/example.js +17 -0
- package/lib/esm/decorators/common/example.js.map +1 -0
- package/lib/esm/decorators/common/examples.js +17 -0
- package/lib/esm/decorators/common/examples.js.map +1 -0
- package/lib/esm/decorators/common/exclusiveMaximum.js +73 -0
- package/lib/esm/decorators/common/exclusiveMaximum.js.map +1 -0
- package/lib/esm/decorators/common/exclusiveMinimum.js +73 -0
- package/lib/esm/decorators/common/exclusiveMinimum.js.map +1 -0
- package/lib/esm/decorators/common/format.js +476 -0
- package/lib/esm/decorators/common/format.js.map +1 -0
- package/lib/esm/decorators/common/forwardGroups.js +16 -0
- package/lib/esm/decorators/common/forwardGroups.js.map +1 -0
- package/lib/esm/decorators/common/groups.js +37 -0
- package/lib/esm/decorators/common/groups.js.map +1 -0
- package/lib/esm/decorators/common/hidden.js +36 -0
- package/lib/esm/decorators/common/hidden.js.map +1 -0
- package/lib/esm/decorators/common/ignore.js +67 -0
- package/lib/esm/decorators/common/ignore.js.map +1 -0
- package/lib/esm/decorators/common/integer.js +67 -0
- package/lib/esm/decorators/common/integer.js.map +1 -0
- package/lib/esm/decorators/common/jsonEntityFn.js +28 -0
- package/lib/esm/decorators/common/jsonEntityFn.js.map +1 -0
- package/lib/esm/decorators/common/maxLength.js +85 -0
- package/lib/esm/decorators/common/maxLength.js.map +1 -0
- package/lib/esm/decorators/common/maximum.js +146 -0
- package/lib/esm/decorators/common/maximum.js.map +1 -0
- package/lib/esm/decorators/common/minLength.js +86 -0
- package/lib/esm/decorators/common/minLength.js.map +1 -0
- package/lib/esm/decorators/common/minimum.js +144 -0
- package/lib/esm/decorators/common/minimum.js.map +1 -0
- package/lib/esm/decorators/common/multipleOf.js +77 -0
- package/lib/esm/decorators/common/multipleOf.js.map +1 -0
- package/lib/esm/decorators/common/name.js +48 -0
- package/lib/esm/decorators/common/name.js.map +1 -0
- package/lib/esm/decorators/common/nullable.js +30 -0
- package/lib/esm/decorators/common/nullable.js.map +1 -0
- package/lib/esm/decorators/common/oneOf.js +19 -0
- package/lib/esm/decorators/common/oneOf.js.map +1 -0
- package/lib/esm/decorators/common/optional.js +24 -0
- package/lib/esm/decorators/common/optional.js.map +1 -0
- package/lib/esm/decorators/common/pattern.js +99 -0
- package/lib/esm/decorators/common/pattern.js.map +1 -0
- package/lib/esm/decorators/common/property.js +23 -0
- package/lib/esm/decorators/common/property.js.map +1 -0
- package/lib/esm/decorators/common/readOnly.js +17 -0
- package/lib/esm/decorators/common/readOnly.js.map +1 -0
- package/lib/esm/decorators/common/required.js +49 -0
- package/lib/esm/decorators/common/required.js.map +1 -0
- package/lib/esm/decorators/common/requiredGroups.js +22 -0
- package/lib/esm/decorators/common/requiredGroups.js.map +1 -0
- package/lib/esm/decorators/common/schema.js +63 -0
- package/lib/esm/decorators/common/schema.js.map +1 -0
- package/lib/esm/decorators/common/title.js +45 -0
- package/lib/esm/decorators/common/title.js.map +1 -0
- package/lib/esm/decorators/common/writeOnly.js +17 -0
- package/lib/esm/decorators/common/writeOnly.js.map +1 -0
- package/lib/esm/decorators/config/jsonEntityComponent.js +14 -0
- package/lib/esm/decorators/config/jsonEntityComponent.js.map +1 -0
- package/lib/esm/decorators/generics/genericOf.js +95 -0
- package/lib/esm/decorators/generics/genericOf.js.map +1 -0
- package/lib/esm/decorators/generics/generics.js +21 -0
- package/lib/esm/decorators/generics/generics.js.map +1 -0
- package/lib/esm/decorators/index.js +74 -0
- package/lib/esm/decorators/index.js.map +1 -0
- package/lib/esm/decorators/operations/consumes.js +35 -0
- package/lib/esm/decorators/operations/consumes.js.map +1 -0
- package/lib/esm/decorators/operations/contentType.js +24 -0
- package/lib/esm/decorators/operations/contentType.js.map +1 -0
- package/lib/esm/decorators/operations/deprecated.js +39 -0
- package/lib/esm/decorators/operations/deprecated.js.map +1 -0
- package/lib/esm/decorators/operations/header.js +55 -0
- package/lib/esm/decorators/operations/header.js.map +1 -0
- package/lib/esm/decorators/operations/in.js +74 -0
- package/lib/esm/decorators/operations/in.js.map +1 -0
- package/lib/esm/decorators/operations/inFile.js +41 -0
- package/lib/esm/decorators/operations/inFile.js.map +1 -0
- package/lib/esm/decorators/operations/location.js +25 -0
- package/lib/esm/decorators/operations/location.js.map +1 -0
- package/lib/esm/decorators/operations/operationId.js +20 -0
- package/lib/esm/decorators/operations/operationId.js.map +1 -0
- package/lib/esm/decorators/operations/operationPath.js +30 -0
- package/lib/esm/decorators/operations/operationPath.js.map +1 -0
- package/lib/esm/decorators/operations/partial.js +14 -0
- package/lib/esm/decorators/operations/partial.js.map +1 -0
- package/lib/esm/decorators/operations/path.js +25 -0
- package/lib/esm/decorators/operations/path.js.map +1 -0
- package/lib/esm/decorators/operations/produces.js +42 -0
- package/lib/esm/decorators/operations/produces.js.map +1 -0
- package/lib/esm/decorators/operations/redirect.js +22 -0
- package/lib/esm/decorators/operations/redirect.js.map +1 -0
- package/lib/esm/decorators/operations/returns.js +248 -0
- package/lib/esm/decorators/operations/returns.js.map +1 -0
- package/lib/esm/decorators/operations/route.js +188 -0
- package/lib/esm/decorators/operations/route.js.map +1 -0
- package/lib/esm/decorators/operations/security.js +39 -0
- package/lib/esm/decorators/operations/security.js.map +1 -0
- package/lib/esm/decorators/operations/status.js +129 -0
- package/lib/esm/decorators/operations/status.js.map +1 -0
- package/lib/esm/decorators/operations/summary.js +30 -0
- package/lib/esm/decorators/operations/summary.js.map +1 -0
- package/lib/esm/decorators/operations/tags.js +48 -0
- package/lib/esm/decorators/operations/tags.js.map +1 -0
- package/lib/esm/domain/DecoratorContext.js +84 -0
- package/lib/esm/domain/DecoratorContext.js.map +1 -0
- package/lib/esm/domain/JsonAliasMap.js +11 -0
- package/lib/esm/domain/JsonAliasMap.js.map +1 -0
- package/lib/esm/domain/JsonClassStore.js +34 -0
- package/lib/esm/domain/JsonClassStore.js.map +1 -0
- package/lib/esm/domain/JsonEntityStore.js +162 -0
- package/lib/esm/domain/JsonEntityStore.js.map +1 -0
- package/lib/esm/domain/JsonFormatTypes.js +19 -0
- package/lib/esm/domain/JsonFormatTypes.js.map +1 -0
- package/lib/esm/domain/JsonLazyRef.js +22 -0
- package/lib/esm/domain/JsonLazyRef.js.map +1 -0
- package/lib/esm/domain/JsonMap.js +23 -0
- package/lib/esm/domain/JsonMap.js.map +1 -0
- package/lib/esm/domain/JsonMethodStore.js +98 -0
- package/lib/esm/domain/JsonMethodStore.js.map +1 -0
- package/lib/esm/domain/JsonOperation.js +246 -0
- package/lib/esm/domain/JsonOperation.js.map +1 -0
- package/lib/esm/domain/JsonOperationPathsMap.js +25 -0
- package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -0
- package/lib/esm/domain/JsonOperationRoute.js +52 -0
- package/lib/esm/domain/JsonOperationRoute.js.map +1 -0
- package/lib/esm/domain/JsonParameter.js +121 -0
- package/lib/esm/domain/JsonParameter.js.map +1 -0
- package/lib/esm/domain/JsonParameterStore.js +87 -0
- package/lib/esm/domain/JsonParameterStore.js.map +1 -0
- package/lib/esm/domain/JsonParameterTypes.js +22 -0
- package/lib/esm/domain/JsonParameterTypes.js.map +1 -0
- package/lib/esm/domain/JsonPropertyStore.js +65 -0
- package/lib/esm/domain/JsonPropertyStore.js.map +1 -0
- package/lib/esm/domain/JsonRequestBody.js +28 -0
- package/lib/esm/domain/JsonRequestBody.js.map +1 -0
- package/lib/esm/domain/JsonResponse.js +81 -0
- package/lib/esm/domain/JsonResponse.js.map +1 -0
- package/lib/esm/domain/JsonSchema.js +719 -0
- package/lib/esm/domain/JsonSchema.js.map +1 -0
- package/lib/esm/domain/SpecTypes.js +6 -0
- package/lib/esm/domain/SpecTypes.js.map +1 -0
- package/lib/esm/domain/index.js +17 -0
- package/lib/esm/domain/index.js.map +1 -0
- package/lib/esm/hooks/alterIgnore.js +17 -0
- package/lib/esm/hooks/alterIgnore.js.map +1 -0
- package/lib/esm/hooks/alterOneOf.js +10 -0
- package/lib/esm/hooks/alterOneOf.js.map +1 -0
- package/lib/esm/hooks/alterRequiredGroups.js +11 -0
- package/lib/esm/hooks/alterRequiredGroups.js.map +1 -0
- package/lib/esm/index.js +21 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/IgnoreCallback.js +2 -0
- package/lib/esm/interfaces/IgnoreCallback.js.map +1 -0
- package/lib/esm/interfaces/JsonHookContext.js +2 -0
- package/lib/esm/interfaces/JsonHookContext.js.map +1 -0
- package/lib/esm/interfaces/JsonOpenSpec.js +2 -0
- package/lib/esm/interfaces/JsonOpenSpec.js.map +1 -0
- package/lib/esm/interfaces/JsonSchemaOptions.js +2 -0
- package/lib/esm/interfaces/JsonSchemaOptions.js.map +1 -0
- package/lib/esm/interfaces/index.js +5 -0
- package/lib/esm/interfaces/index.js.map +1 -0
- package/lib/esm/registries/JsonSchemaMapperContainer.js +30 -0
- package/lib/esm/registries/JsonSchemaMapperContainer.js.map +1 -0
- package/lib/esm/utils/buildPath.js +9 -0
- package/lib/esm/utils/buildPath.js.map +1 -0
- package/lib/esm/utils/concatParameters.js +12 -0
- package/lib/esm/utils/concatParameters.js.map +1 -0
- package/lib/esm/utils/concatPath.js +4 -0
- package/lib/esm/utils/concatPath.js.map +1 -0
- package/lib/esm/utils/defineStatusModel.js +8 -0
- package/lib/esm/utils/defineStatusModel.js.map +1 -0
- package/lib/esm/utils/from.js +249 -0
- package/lib/esm/utils/from.js.map +1 -0
- package/lib/esm/utils/generics.js +34 -0
- package/lib/esm/utils/generics.js.map +1 -0
- package/lib/esm/utils/getComputedType.js +22 -0
- package/lib/esm/utils/getComputedType.js.map +1 -0
- package/lib/esm/utils/getInheritedStores.js +19 -0
- package/lib/esm/utils/getInheritedStores.js.map +1 -0
- package/lib/esm/utils/getJsonEntityStore.js +14 -0
- package/lib/esm/utils/getJsonEntityStore.js.map +1 -0
- package/lib/esm/utils/getJsonPathParameters.js +69 -0
- package/lib/esm/utils/getJsonPathParameters.js.map +1 -0
- package/lib/esm/utils/getJsonSchema.js +51 -0
- package/lib/esm/utils/getJsonSchema.js.map +1 -0
- package/lib/esm/utils/getJsonType.js +36 -0
- package/lib/esm/utils/getJsonType.js.map +1 -0
- package/lib/esm/utils/getOperationsRoutes.js +32 -0
- package/lib/esm/utils/getOperationsRoutes.js.map +1 -0
- package/lib/esm/utils/getOperationsStores.js +29 -0
- package/lib/esm/utils/getOperationsStores.js.map +1 -0
- package/lib/esm/utils/getPropertiesStores.js +40 -0
- package/lib/esm/utils/getPropertiesStores.js.map +1 -0
- package/lib/esm/utils/getRequiredProperties.js +62 -0
- package/lib/esm/utils/getRequiredProperties.js.map +1 -0
- package/lib/esm/utils/getSpec.js +83 -0
- package/lib/esm/utils/getSpec.js.map +1 -0
- package/lib/esm/utils/isSuccessStatus.js +3 -0
- package/lib/esm/utils/isSuccessStatus.js.map +1 -0
- package/lib/esm/utils/mapHeaders.js +25 -0
- package/lib/esm/utils/mapHeaders.js.map +1 -0
- package/lib/esm/utils/mapNullableType.js +40 -0
- package/lib/esm/utils/mapNullableType.js.map +1 -0
- package/lib/esm/utils/mapRouteOptions.js +22 -0
- package/lib/esm/utils/mapRouteOptions.js.map +1 -0
- package/lib/esm/utils/matchGroups.js +18 -0
- package/lib/esm/utils/matchGroups.js.map +1 -0
- package/lib/esm/utils/mergeOperation.js +40 -0
- package/lib/esm/utils/mergeOperation.js.map +1 -0
- package/lib/esm/utils/mergeSpec.js +42 -0
- package/lib/esm/utils/mergeSpec.js.map +1 -0
- package/lib/esm/utils/operationIdFormatter.js +33 -0
- package/lib/esm/utils/operationIdFormatter.js.map +1 -0
- package/lib/esm/utils/ref.js +59 -0
- package/lib/esm/utils/ref.js.map +1 -0
- package/lib/esm/utils/toJsonMapCollection.js +11 -0
- package/lib/esm/utils/toJsonMapCollection.js.map +1 -0
- package/lib/esm/utils/toJsonRegex.js +8 -0
- package/lib/esm/utils/toJsonRegex.js.map +1 -0
- package/lib/{components → types/components}/anyMapper.d.ts +0 -0
- package/lib/{components → types/components}/classMapper.d.ts +1 -1
- package/lib/{components → types/components}/genericsMapper.d.ts +0 -0
- package/lib/{components → types/components}/index.d.ts +2 -0
- package/lib/{components → types/components}/inheritedClassMapper.d.ts +1 -1
- package/lib/{components → types/components}/itemMapper.d.ts +0 -0
- package/lib/types/components/lazyRefMapper.d.ts +3 -0
- package/lib/{components → types/components}/mapMapper.d.ts +1 -1
- package/lib/{components → types/components}/objectMapper.d.ts +0 -0
- package/lib/types/components/ofMapper.d.ts +3 -0
- package/lib/types/components/propertiesMapper.d.ts +3 -0
- package/lib/{components → types/components}/schemaMapper.d.ts +1 -1
- package/lib/types/constants/httpMethods.d.ts +12 -0
- package/lib/types/constants/httpStatusMessages.d.ts +272 -0
- package/lib/types/decorators/class/children.d.ts +11 -0
- package/lib/{decorators → types/decorators}/collections/collectionContains.d.ts +0 -0
- package/lib/{decorators → types/decorators}/collections/collectionOf.d.ts +1 -1
- package/lib/{decorators → types/decorators}/collections/maxItems.d.ts +0 -0
- package/lib/{decorators → types/decorators}/collections/maxProperties.d.ts +0 -0
- package/lib/{decorators → types/decorators}/collections/minItems.d.ts +0 -0
- package/lib/{decorators → types/decorators}/collections/minProperties.d.ts +0 -0
- package/lib/{decorators → types/decorators}/collections/uniqueItems.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/additionalProperties.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/allOf.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/allow.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/any.d.ts +1 -1
- package/lib/{decorators → types/decorators}/common/anyOf.d.ts +0 -4
- package/lib/{decorators → types/decorators}/common/const.d.ts +1 -1
- package/lib/{decorators → types/decorators}/common/customKey.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/default.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/description.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/enum.d.ts +1 -1
- package/lib/{decorators → types/decorators}/common/example.d.ts +0 -0
- package/lib/types/decorators/common/examples.d.ts +12 -0
- package/lib/{decorators → types/decorators}/common/exclusiveMaximum.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/exclusiveMinimum.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/format.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/forwardGroups.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/groups.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/hidden.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/ignore.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/integer.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/jsonEntityFn.d.ts +2 -2
- package/lib/{decorators → types/decorators}/common/maxLength.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/maximum.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/minLength.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/minimum.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/multipleOf.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/name.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/nullable.d.ts +1 -1
- package/lib/{decorators → types/decorators}/common/oneOf.d.ts +0 -4
- package/lib/{decorators → types/decorators}/common/optional.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/pattern.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/property.d.ts +1 -0
- package/lib/{decorators → types/decorators}/common/readOnly.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/required.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/requiredGroups.d.ts +1 -1
- package/lib/{decorators → types/decorators}/common/schema.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/title.d.ts +0 -0
- package/lib/{decorators → types/decorators}/common/writeOnly.d.ts +0 -0
- package/lib/{decorators → types/decorators}/config/jsonEntityComponent.d.ts +0 -0
- package/lib/{decorators → types/decorators}/generics/genericOf.d.ts +0 -0
- package/lib/{decorators → types/decorators}/generics/generics.d.ts +0 -0
- package/lib/{decorators → types/decorators}/index.d.ts +4 -0
- package/lib/{decorators → types/decorators}/operations/consumes.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/contentType.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/deprecated.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/header.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/in.d.ts +0 -0
- package/lib/types/decorators/operations/inFile.d.ts +25 -0
- package/lib/{decorators → types/decorators}/operations/location.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/operationId.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/operationPath.d.ts +1 -11
- package/lib/{decorators → types/decorators}/operations/partial.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/path.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/produces.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/redirect.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/returns.d.ts +16 -1
- package/lib/types/decorators/operations/route.d.ts +188 -0
- package/lib/{decorators → types/decorators}/operations/security.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/status.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/summary.d.ts +0 -0
- package/lib/{decorators → types/decorators}/operations/tags.d.ts +0 -0
- package/lib/{domain → types/domain}/DecoratorContext.d.ts +7 -2
- package/lib/{domain → types/domain}/JsonAliasMap.d.ts +0 -0
- package/lib/types/domain/JsonClassStore.d.ts +12 -0
- package/lib/types/domain/JsonEntityStore.d.ts +136 -0
- package/lib/{domain → types/domain}/JsonFormatTypes.d.ts +0 -0
- package/lib/{domain → types/domain}/JsonLazyRef.d.ts +0 -0
- package/lib/{domain → types/domain}/JsonMap.d.ts +0 -0
- package/lib/types/domain/JsonMethodStore.d.ts +40 -0
- package/lib/{domain → types/domain}/JsonOperation.d.ts +1 -0
- package/lib/types/domain/JsonOperationPathsMap.d.ts +7 -0
- package/lib/types/domain/JsonOperationRoute.d.ts +24 -0
- package/lib/{domain → types/domain}/JsonParameter.d.ts +3 -1
- package/lib/types/domain/JsonParameterStore.d.ts +30 -0
- package/lib/{domain → types/domain}/JsonParameterTypes.d.ts +0 -0
- package/lib/types/domain/JsonPropertyStore.d.ts +23 -0
- package/lib/{domain → types/domain}/JsonRequestBody.d.ts +0 -0
- package/lib/{domain → types/domain}/JsonResponse.d.ts +0 -0
- package/lib/{domain → types/domain}/JsonSchema.d.ts +6 -12
- package/lib/{domain → types/domain}/SpecTypes.d.ts +0 -1
- package/lib/{domain → types/domain}/index.d.ts +5 -0
- package/lib/{hooks → types/hooks}/alterIgnore.d.ts +0 -0
- package/lib/types/hooks/alterOneOf.d.ts +3 -0
- package/lib/{hooks → types/hooks}/alterRequiredGroups.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +4 -0
- package/lib/{interfaces → types/interfaces}/IgnoreCallback.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/JsonHookContext.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/JsonOpenSpec.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/JsonSchemaOptions.d.ts +2 -2
- package/lib/{interfaces → types/interfaces}/index.d.ts +0 -0
- package/lib/{registries → types/registries}/JsonSchemaMapperContainer.d.ts +3 -2
- package/lib/{utils → types/utils}/buildPath.d.ts +0 -0
- package/lib/{utils → types/utils}/concatParameters.d.ts +0 -0
- package/lib/types/utils/concatPath.d.ts +1 -0
- package/lib/{utils → types/utils}/defineStatusModel.d.ts +0 -0
- package/lib/{utils → types/utils}/from.d.ts +0 -0
- package/lib/{utils → types/utils}/generics.d.ts +0 -0
- package/lib/{utils → types/utils}/getComputedType.d.ts +0 -0
- package/lib/{utils → types/utils}/getInheritedStores.d.ts +2 -2
- package/lib/types/utils/getJsonEntityStore.d.ts +15 -0
- package/lib/{utils → types/utils}/getJsonPathParameters.d.ts +0 -0
- package/lib/types/utils/getJsonSchema.d.ts +4 -0
- package/lib/{utils → types/utils}/getJsonType.d.ts +0 -0
- package/lib/types/utils/getOperationsRoutes.d.ts +8 -0
- package/lib/types/utils/getOperationsStores.d.ts +6 -0
- package/lib/types/utils/getPropertiesStores.d.ts +20 -0
- package/lib/{utils → types/utils}/getRequiredProperties.d.ts +0 -0
- package/lib/types/utils/getSpec.d.ts +29 -0
- package/lib/{utils → types/utils}/isSuccessStatus.d.ts +0 -0
- package/lib/{utils → types/utils}/mapHeaders.d.ts +0 -0
- package/lib/{utils → types/utils}/mapNullableType.d.ts +0 -0
- package/lib/types/utils/mapRouteOptions.d.ts +5 -0
- package/lib/{utils → types/utils}/matchGroups.d.ts +0 -0
- package/lib/{utils → types/utils}/mergeOperation.d.ts +0 -0
- package/lib/{utils → types/utils}/mergeSpec.d.ts +2 -2
- package/lib/{utils → types/utils}/operationIdFormatter.d.ts +0 -0
- package/lib/types/utils/ref.d.ts +14 -0
- package/lib/{utils → types/utils}/toJsonMapCollection.d.ts +0 -0
- package/lib/{utils → types/utils}/toJsonRegex.d.ts +0 -0
- package/package.json +21 -14
- package/tsconfig.compile.esm.json +23 -0
- package/lib/components/lazyRefMapper.d.ts +0 -19
- package/lib/constants/httpStatusMessages.d.ts +0 -5
- package/lib/domain/JsonEntityStore.d.ts +0 -94
- package/lib/index.js +0 -7632
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -7499
- package/lib/index.modern.js.map +0 -1
- package/lib/registries/JsonEntitiesContainer.d.ts +0 -6
- package/lib/utils/getJsonEntityStore.d.ts +0 -6
- package/lib/utils/getJsonSchema.d.ts +0 -5
- package/lib/utils/getOperationsStores.d.ts +0 -6
- package/lib/utils/getPropertiesStores.d.ts +0 -20
- package/lib/utils/getSpec.d.ts +0 -49
- package/lib/utils/isJsonClass.d.ts +0 -4
- package/lib/utils/mergeSpec.benchmark.d.ts +0 -1
- package/lib/utils/ref.d.ts +0 -46
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRef = exports.createRef = exports.createRefName = void 0;
|
|
4
|
+
const pascal_case_1 = require("pascal-case");
|
|
5
|
+
const SpecTypes_1 = require("../domain/SpecTypes");
|
|
6
|
+
const core_1 = require("@tsed/core");
|
|
7
|
+
/**
|
|
8
|
+
* ignore
|
|
9
|
+
* @param options
|
|
10
|
+
*/
|
|
11
|
+
function getHost(options) {
|
|
12
|
+
const { host = `#/${options.specType === "openapi3" ? "components/schemas" : "definitions"}` } = options;
|
|
13
|
+
return host;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @ignore
|
|
17
|
+
*/
|
|
18
|
+
function createRefName(name, options) {
|
|
19
|
+
if (options.groups && options.groups.length) {
|
|
20
|
+
return (0, pascal_case_1.pascalCase)(`${name} ${options.groups.join(" ")}`);
|
|
21
|
+
}
|
|
22
|
+
return name;
|
|
23
|
+
}
|
|
24
|
+
exports.createRefName = createRefName;
|
|
25
|
+
/**
|
|
26
|
+
* @ignore
|
|
27
|
+
*/
|
|
28
|
+
function createRef(name, schema, options) {
|
|
29
|
+
const host = getHost(options);
|
|
30
|
+
const ref = {
|
|
31
|
+
$ref: `${host}/${name}`
|
|
32
|
+
};
|
|
33
|
+
const nullable = schema.isNullable;
|
|
34
|
+
const readOnly = schema.isReadOnly;
|
|
35
|
+
const writeOnly = schema.isWriteOnly;
|
|
36
|
+
if (nullable || readOnly || writeOnly) {
|
|
37
|
+
switch (options.specType) {
|
|
38
|
+
case SpecTypes_1.SpecTypes.OPENAPI:
|
|
39
|
+
return (0, core_1.cleanObject)({
|
|
40
|
+
nullable: nullable ? true : undefined,
|
|
41
|
+
readOnly: readOnly ? true : undefined,
|
|
42
|
+
writeOnly: writeOnly ? true : undefined,
|
|
43
|
+
oneOf: [ref]
|
|
44
|
+
});
|
|
45
|
+
case SpecTypes_1.SpecTypes.JSON:
|
|
46
|
+
return (0, core_1.cleanObject)({
|
|
47
|
+
readOnly,
|
|
48
|
+
writeOnly,
|
|
49
|
+
oneOf: [ref]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return ref;
|
|
54
|
+
}
|
|
55
|
+
exports.createRef = createRef;
|
|
56
|
+
/**
|
|
57
|
+
* @ignore
|
|
58
|
+
*/
|
|
59
|
+
function toRef(value, schema, options) {
|
|
60
|
+
const name = createRefName(value.getName(), options);
|
|
61
|
+
options.schemas[value.getName()] = schema;
|
|
62
|
+
return createRef(name, value, options);
|
|
63
|
+
}
|
|
64
|
+
exports.toRef = toRef;
|
|
65
|
+
//# sourceMappingURL=ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../src/utils/ref.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AAEvC,mDAA8C;AAE9C,qCAAuC;AAEvC;;;GAGG;AACH,SAAS,OAAO,CA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AAK,EAAE,CAAC,GAAG,CAAC;iBACb,CAAC,CAAC;YACL,KAAK,qBAAS,CAAC,IAAI;gBACjB,OAAO,IAAA,kBAAW,EAAC;oBACjB,QAAQ;oBACR,SAAS;oBACT,KAAK,EAAE,CAAC,GAAG,CAAC;iBACb,CAAC,CAAC;SACN;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AA7BD,8BA6BC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,KAAiB,EAAE,MAAW,EAAE,OAA0B;IAC9E,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,OAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC;IAE3C,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAND,sBAMC","sourcesContent":["import {pascalCase} from \"pascal-case\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {cleanObject} from \"@tsed/core\";\n\n/**\n * ignore\n * @param options\n */\nfunction getHost(options: JsonSchemaOptions) {\n const {host = `#/${options.specType === \"openapi3\" ? \"components/schemas\" : \"definitions\"}`} = options;\n\n return host;\n}\n\n/**\n * @ignore\n */\nexport function createRefName(name: string, options: JsonSchemaOptions) {\n if (options.groups && options.groups.length) {\n return pascalCase(`${name} ${options.groups.join(\" \")}`);\n }\n\n return name;\n}\n\n/**\n * @ignore\n */\nexport function createRef(name: string, schema: JsonSchema, options: JsonSchemaOptions) {\n const host = getHost(options);\n const ref = {\n $ref: `${host}/${name}`\n };\n\n const nullable = schema.isNullable;\n const readOnly = schema.isReadOnly;\n const writeOnly = schema.isWriteOnly;\n\n if (nullable || readOnly || writeOnly) {\n switch (options.specType) {\n case SpecTypes.OPENAPI:\n return cleanObject({\n nullable: nullable ? true : undefined,\n readOnly: readOnly ? true : undefined,\n writeOnly: writeOnly ? true : undefined,\n oneOf: [ref]\n });\n case SpecTypes.JSON:\n return cleanObject({\n readOnly,\n writeOnly,\n oneOf: [ref]\n });\n }\n }\n\n return ref;\n}\n\n/**\n * @ignore\n */\nexport function toRef(value: JsonSchema, schema: any, options: JsonSchemaOptions) {\n const name = createRefName(value.getName(), options);\n\n options.schemas![value.getName()] = schema;\n\n return createRef(name, value, options);\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJsonMapCollection = void 0;
|
|
4
|
+
const JsonMap_1 = require("../domain/JsonMap");
|
|
5
|
+
/**
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
function toJsonMapCollection(content, klass = JsonMap_1.JsonMap) {
|
|
9
|
+
return Object.entries(content).reduce((content, [key, value]) => {
|
|
10
|
+
content.set(key, new klass(value));
|
|
11
|
+
return content;
|
|
12
|
+
}, new JsonMap_1.JsonMap());
|
|
13
|
+
}
|
|
14
|
+
exports.toJsonMapCollection = toJsonMapCollection;
|
|
15
|
+
//# sourceMappingURL=toJsonMapCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toJsonMapCollection.js","sourceRoot":"","sources":["../../../src/utils/toJsonMapCollection.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAE1C;;GAEG;AACH,SAAgB,mBAAmB,CAAC,OAA6B,EAAE,KAAK,GAAG,iBAAO;IAChF,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9D,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,IAAI,iBAAO,EAAO,CAAC,CAAC;AACzB,CAAC;AAND,kDAMC","sourcesContent":["import {JsonMap} from \"../domain/JsonMap\";\n\n/**\n * @ignore\n */\nexport function toJsonMapCollection(content: {[key: string]: any}, klass = JsonMap) {\n return Object.entries(content).reduce((content, [key, value]) => {\n content.set(key, new klass(value));\n\n return content;\n }, new JsonMap<any>());\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJsonRegex = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
* @param pattern
|
|
7
|
+
*/
|
|
8
|
+
function toJsonRegex(pattern) {
|
|
9
|
+
return String(pattern).replace(/^(\/)(.*)(\/)$/, "$2");
|
|
10
|
+
}
|
|
11
|
+
exports.toJsonRegex = toJsonRegex;
|
|
12
|
+
//# sourceMappingURL=toJsonRegex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toJsonRegex.js","sourceRoot":"","sources":["../../../src/utils/toJsonRegex.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,WAAW,CAAC,OAAwB;IAClD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC;AAFD,kCAEC","sourcesContent":["/**\n * @ignore\n * @param pattern\n */\nexport function toJsonRegex(pattern: string | RegExp) {\n return String(pattern).replace(/^(\\/)(.*)(\\/)$/, \"$2\");\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JsonLazyRef } from "../domain/JsonLazyRef";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
+
import { mapGenericsOptions } from "../utils/generics";
|
|
4
|
+
import { toRef } from "../utils/ref";
|
|
5
|
+
export function anyMapper(input, options = {}) {
|
|
6
|
+
if (typeof input !== "object" || input === null) {
|
|
7
|
+
return input;
|
|
8
|
+
}
|
|
9
|
+
if (input instanceof JsonLazyRef) {
|
|
10
|
+
return execMapper("lazyRef", input, options);
|
|
11
|
+
}
|
|
12
|
+
if ("toJSON" in input) {
|
|
13
|
+
const schema = input.toJSON(mapGenericsOptions(options));
|
|
14
|
+
return input.canRef ? toRef(input, schema, options) : schema;
|
|
15
|
+
}
|
|
16
|
+
return execMapper("object", input, options);
|
|
17
|
+
}
|
|
18
|
+
registerJsonSchemaMapper("any", anyMapper);
|
|
19
|
+
//# sourceMappingURL=anyMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anyMapper.js","sourceRoot":"","sources":["../../../src/components/anyMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,SAAS,CAAC,KAAU,EAAE,UAA6B,EAAE;IACnE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;QAC/C,OAAO,KAAK,CAAC;KACd;IAED,IAAI,KAAK,YAAY,WAAW,EAAE;QAChC,OAAO,UAAU,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KAC9C;IAED,IAAI,QAAQ,IAAI,KAAK,EAAE;QACrB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;QAEzD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAC9D;IAED,OAAO,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import {JsonLazyRef} from \"../domain/JsonLazyRef\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {mapGenericsOptions} from \"../utils/generics\";\nimport {toRef} from \"../utils/ref\";\n\nexport function anyMapper(input: any, options: JsonSchemaOptions = {}): any {\n if (typeof input !== \"object\" || input === null) {\n return input;\n }\n\n if (input instanceof JsonLazyRef) {\n return execMapper(\"lazyRef\", input, options);\n }\n\n if (\"toJSON\" in input) {\n const schema = input.toJSON(mapGenericsOptions(options));\n\n return input.canRef ? toRef(input, schema, options) : schema;\n }\n\n return execMapper(\"object\", input, options);\n}\n\nregisterJsonSchemaMapper(\"any\", anyMapper);\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { JsonEntityStore } from "../domain/JsonEntityStore";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
+
import { mapGenericsOptions, popGenerics } from "../utils/generics";
|
|
4
|
+
import { createRef, createRefName } from "../utils/ref";
|
|
5
|
+
export function classMapper(value, options) {
|
|
6
|
+
const store = JsonEntityStore.from(value.class);
|
|
7
|
+
const name = createRefName(store.schema.getName() || value.getName(), options);
|
|
8
|
+
if (value.hasGenerics) {
|
|
9
|
+
// Inline generic
|
|
10
|
+
const { type, properties, additionalProperties, items, ...props } = value.toJSON(options);
|
|
11
|
+
const schema = {
|
|
12
|
+
...execMapper("any", store.schema, {
|
|
13
|
+
...options,
|
|
14
|
+
...popGenerics(value),
|
|
15
|
+
root: false
|
|
16
|
+
}),
|
|
17
|
+
...props
|
|
18
|
+
};
|
|
19
|
+
if (schema.title) {
|
|
20
|
+
const name = createRefName(schema.title, options);
|
|
21
|
+
options.schemas[name] = schema;
|
|
22
|
+
delete schema.title;
|
|
23
|
+
return createRef(name, value, options);
|
|
24
|
+
}
|
|
25
|
+
return schema;
|
|
26
|
+
}
|
|
27
|
+
if (options.schemas && !options.schemas[name]) {
|
|
28
|
+
options.schemas[name] = {}; // avoid infinite calls
|
|
29
|
+
options.schemas[name] = execMapper("any", store.schema, mapGenericsOptions({
|
|
30
|
+
...options,
|
|
31
|
+
root: false
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
return createRef(name, value, options);
|
|
35
|
+
}
|
|
36
|
+
registerJsonSchemaMapper("class", classMapper);
|
|
37
|
+
//# sourceMappingURL=classMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classMapper.js","sourceRoot":"","sources":["../../../src/components/classMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAC,SAAS,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAEtD,MAAM,UAAU,WAAW,CAAC,KAAiB,EAAE,OAA0B;IACvE,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAE/E,IAAI,KAAK,CAAC,WAAW,EAAE;QACrB,iBAAiB;QACjB,MAAM,EAAC,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,GAAG,KAAK,EAAC,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACxF,MAAM,MAAM,GAAG;YACb,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE;gBACjC,GAAG,OAAO;gBACV,GAAG,WAAW,CAAC,KAAK,CAAC;gBACrB,IAAI,EAAE,KAAK;aACZ,CAAC;YACF,GAAG,KAAK;SACT,CAAC;QAEF,IAAI,MAAM,CAAC,KAAK,EAAE;YAChB,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAClD,OAAO,CAAC,OAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YAChC,OAAO,MAAM,CAAC,KAAK,CAAC;YAEpB,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACxC;QAED,OAAO,MAAM,CAAC;KACf;IAED,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC7C,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,uBAAuB;QACnD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAU,CAChC,KAAK,EACL,KAAK,CAAC,MAAM,EACZ,kBAAkB,CAAC;YACjB,GAAG,OAAO;YACV,IAAI,EAAE,KAAK;SACZ,CAAC,CACH,CAAC;KACH;IAED,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,wBAAwB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {mapGenericsOptions, popGenerics} from \"../utils/generics\";\nimport {createRef, createRefName} from \"../utils/ref\";\n\nexport function classMapper(value: JsonSchema, options: JsonSchemaOptions) {\n const store = JsonEntityStore.from(value.class);\n const name = createRefName(store.schema.getName() || value.getName(), options);\n\n if (value.hasGenerics) {\n // Inline generic\n const {type, properties, additionalProperties, items, ...props} = value.toJSON(options);\n const schema = {\n ...execMapper(\"any\", store.schema, {\n ...options,\n ...popGenerics(value),\n root: false\n }),\n ...props\n };\n\n if (schema.title) {\n const name = createRefName(schema.title, options);\n options.schemas![name] = schema;\n delete schema.title;\n\n return createRef(name, value, options);\n }\n\n return schema;\n }\n\n if (options.schemas && !options.schemas[name]) {\n options.schemas[name] = {}; // avoid infinite calls\n options.schemas[name] = execMapper(\n \"any\",\n store.schema,\n mapGenericsOptions({\n ...options,\n root: false\n })\n );\n }\n\n return createRef(name, value, options);\n}\n\nregisterJsonSchemaMapper(\"class\", classMapper);\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
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";
|
|
6
|
+
/**
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
9
|
+
export function genericsMapper(obj, options) {
|
|
10
|
+
const { generics } = options;
|
|
11
|
+
if (generics && obj.$ref) {
|
|
12
|
+
if (generics.has(obj.$ref)) {
|
|
13
|
+
let type = generics.get(obj.$ref);
|
|
14
|
+
if (isPrimitiveClass(type)) {
|
|
15
|
+
return {
|
|
16
|
+
type: getJsonType(type)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (type === Date) {
|
|
20
|
+
return {
|
|
21
|
+
type: "string",
|
|
22
|
+
format: "date-time"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (type.toJSON) {
|
|
26
|
+
return type.toJSON({
|
|
27
|
+
...options,
|
|
28
|
+
generics: undefined
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (type === Object) {
|
|
32
|
+
return {
|
|
33
|
+
type: "object"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (isClass(type)) {
|
|
37
|
+
const model = {
|
|
38
|
+
class: type
|
|
39
|
+
};
|
|
40
|
+
if (options.nestedGenerics.length === 0) {
|
|
41
|
+
return execMapper("class", model, {
|
|
42
|
+
...options,
|
|
43
|
+
generics: undefined
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const store = JsonEntityStore.from(model.class);
|
|
47
|
+
return execMapper("schema", store.schema, {
|
|
48
|
+
...options,
|
|
49
|
+
...popGenerics(options),
|
|
50
|
+
root: false
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return obj;
|
|
56
|
+
}
|
|
57
|
+
registerJsonSchemaMapper("generics", genericsMapper);
|
|
58
|
+
//# sourceMappingURL=genericsMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genericsMapper.js","sourceRoot":"","sources":["../../../src/components/genericsMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAkB,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAQ,EAAE,OAAwB;IAC/D,MAAM,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC;IAE3B,IAAI,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE;QACxB,IAAI,QAAQ,CAAC,GAAG,C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veClass} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {GenericsContext, popGenerics} from \"../utils/generics\";\nimport {getJsonType} from \"../utils/getJsonType\";\n\n/**\n * @ignore\n */\nexport function genericsMapper(obj: any, options: GenericsContext) {\n const {generics} = options;\n\n if (generics && obj.$ref) {\n if (generics.has(obj.$ref)) {\n let type = generics.get(obj.$ref);\n\n if (isPrimitiveClass(type)) {\n return {\n type: getJsonType(type)\n };\n }\n\n if (type === Date) {\n return {\n type: \"string\",\n format: \"date-time\"\n };\n }\n\n if (type.toJSON) {\n return type.toJSON({\n ...options,\n generics: undefined\n });\n }\n\n if (type === Object) {\n return {\n type: \"object\"\n };\n }\n\n if (isClass(type)) {\n const model = {\n class: type\n };\n\n if (options.nestedGenerics.length === 0) {\n return execMapper(\"class\", model as any, {\n ...options,\n generics: undefined\n });\n }\n\n const store = JsonEntityStore.from(model.class);\n\n return execMapper(\"schema\", store.schema, {\n ...options,\n ...popGenerics(options),\n root: false\n });\n }\n }\n }\n\n return obj;\n}\n\nregisterJsonSchemaMapper(\"generics\", genericsMapper);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./anyMapper";
|
|
2
|
+
export * from "./classMapper";
|
|
3
|
+
export * from "./genericsMapper";
|
|
4
|
+
export * from "./inheritedClassMapper";
|
|
5
|
+
export * from "./itemMapper";
|
|
6
|
+
export * from "./lazyRefMapper";
|
|
7
|
+
export * from "./mapMapper";
|
|
8
|
+
export * from "./objectMapper";
|
|
9
|
+
export * from "./schemaMapper";
|
|
10
|
+
export * from "./ofMapper";
|
|
11
|
+
export * from "./propertiesMapper";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./anyMapper\";\nexport * from \"./classMapper\";\nexport * from \"./genericsMapper\";\nexport * from \"./inheritedClassMapper\";\nexport * from \"./itemMapper\";\nexport * from \"./lazyRefMapper\";\nexport * from \"./mapMapper\";\nexport * from \"./objectMapper\";\nexport * from \"./schemaMapper\";\nexport * from \"./ofMapper\";\nexport * from \"./propertiesMapper\";\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { classOf, deepMerge } from "@tsed/core";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
+
import { getInheritedStores } from "../utils/getInheritedStores";
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
export function inheritedClassMapper(obj, { target, ...options }) {
|
|
8
|
+
const stores = Array.from(getInheritedStores(target).entries()).filter(([model]) => classOf(model) !== classOf(target));
|
|
9
|
+
if (stores.length) {
|
|
10
|
+
const schema = stores.reduce((obj, [, store]) => {
|
|
11
|
+
return deepMerge(obj, execMapper("schema", store.schema, options));
|
|
12
|
+
}, {});
|
|
13
|
+
obj = deepMerge(schema, obj);
|
|
14
|
+
}
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
registerJsonSchemaMapper("inheritedClass", inheritedClassMapper);
|
|
18
|
+
//# sourceMappingURL=inheritedClassMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritedClassMapper.js","sourceRoot":"","sources":["../../../src/components/inheritedClassMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAQ,EAAE,EAAC,MAAM,EAAE,GAAG,OAAO,EAAoB;IACpF,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAExH,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE;YAC9C,OAAO,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACrE,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wBAAwB,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import {classOf, deepMerge} from \"@tsed/core\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getInheritedStores} from \"../utils/getInheritedStores\";\n\n/**\n * @ignore\n */\nexport function inheritedClassMapper(obj: any, {target, ...options}: JsonSchemaOptions) {\n const stores = Array.from(getInheritedStores(target).entries()).filter(([model]) => classOf(model) !== classOf(target));\n\n if (stores.length) {\n const schema = stores.reduce((obj, [, store]) => {\n return deepMerge(obj, execMapper(\"schema\", store.schema, options));\n }, {});\n\n obj = deepMerge(schema, obj);\n }\n\n return obj;\n}\n\nregisterJsonSchemaMapper(\"inheritedClass\", inheritedClassMapper);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
2
|
+
export function itemMapper(value, options) {
|
|
3
|
+
return value && value.isClass ? execMapper("class", value, options) : execMapper("any", value, options);
|
|
4
|
+
}
|
|
5
|
+
registerJsonSchemaMapper("item", itemMapper);
|
|
6
|
+
//# sourceMappingURL=itemMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemMapper.js","sourceRoot":"","sources":["../../../src/components/itemMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAE7F,MAAM,UAAU,UAAU,CAAC,KAAU,EAAE,OAA0B;IAC/D,OAAO,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1G,CAAC;AAED,wBAAwB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\n\nexport function itemMapper(value: any, options: JsonSchemaOptions) {\n return value && value.isClass ? execMapper(\"class\", value, options) : execMapper(\"any\", value, options);\n}\n\nregisterJsonSchemaMapper(\"item\", itemMapper);\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
2
|
+
import { mapGenericsOptions } from "../utils/generics";
|
|
3
|
+
import { createRef, toRef } from "../utils/ref";
|
|
4
|
+
export function lazyRefMapper(input, options) {
|
|
5
|
+
var _a;
|
|
6
|
+
const name = input.name;
|
|
7
|
+
if ((_a = options.$refs) === null || _a === void 0 ? void 0 : _a.find((t) => t === input.target)) {
|
|
8
|
+
return createRef(name, input.schema, options);
|
|
9
|
+
}
|
|
10
|
+
options.$refs = [...(options.$refs || []), input.target];
|
|
11
|
+
const schema = input.toJSON(mapGenericsOptions(options));
|
|
12
|
+
return toRef(input.schema, schema, options);
|
|
13
|
+
}
|
|
14
|
+
registerJsonSchemaMapper("lazyRef", lazyRefMapper);
|
|
15
|
+
//# sourceMappingURL=lazyRefMapper.js.map
|
|
@@ -0,0 +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;;IAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAExB,IAAI,MAAA,OAAO,CAAC,KAAK,0CAAE,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"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { mapGenericsOptions } from "../utils/generics";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
3
|
+
/**
|
|
4
|
+
* Serialize class which inherit from Map like JsonMap, JsonOperation, JsonParameter.
|
|
5
|
+
* @param input
|
|
6
|
+
* @param ignore
|
|
7
|
+
* @param options
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
export function mapMapper(input, { ignore = [], ...options }) {
|
|
11
|
+
options = mapGenericsOptions(options);
|
|
12
|
+
return Array.from(input.entries()).reduce((obj, [key, value]) => {
|
|
13
|
+
if (ignore.includes(key)) {
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
obj[key] = execMapper("item", value, options);
|
|
17
|
+
return obj;
|
|
18
|
+
}, {});
|
|
19
|
+
}
|
|
20
|
+
registerJsonSchemaMapper("map", mapMapper);
|
|
21
|
+
//# sourceMappingURL=mapMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapMapper.js","sourceRoot":"","sources":["../../../src/components/mapMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAuB,EAAE,EAAC,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,EAAoB;IAC7F,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,OAAO,GAAG,CAAC;SACZ;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,wBAAwB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import {mapGenericsOptions} from \"../utils/generics\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\n\n/**\n * Serialize class which inherit from Map like JsonMap, JsonOperation, JsonParameter.\n * @param input\n * @param ignore\n * @param options\n * @ignore\n */\nexport function mapMapper(input: Map<string, any>, {ignore = [], ...options}: JsonSchemaOptions): any {\n options = mapGenericsOptions(options);\n\n return Array.from(input.entries()).reduce((obj: any, [key, value]) => {\n if (ignore.includes(key)) {\n return obj;\n }\n\n obj[key] = execMapper(\"item\", value, options);\n return obj;\n }, {});\n}\n\nregisterJsonSchemaMapper(\"map\", mapMapper);\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
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";
|
|
5
|
+
/**
|
|
6
|
+
* Serialize Any object to a json schema
|
|
7
|
+
* @param input
|
|
8
|
+
* @param options
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
export function objectMapper(input, options) {
|
|
12
|
+
const { specType, operationIdFormatter, root, schemas, genericTypes, nestedGenerics, useAlias, genericLabels, ...ctx } = options;
|
|
13
|
+
return Object.entries(input).reduce((obj, [key, value]) => {
|
|
14
|
+
if (options.withIgnoredProps !== false && !alterIgnore(value, ctx)) {
|
|
15
|
+
const opts = {
|
|
16
|
+
...options,
|
|
17
|
+
groups: (input === null || input === void 0 ? void 0 : input.$forwardGroups) || (value === null || value === void 0 ? void 0 : value.$forwardGroups) ? options.groups : undefined
|
|
18
|
+
};
|
|
19
|
+
// remove groups to avoid bad schema generation over children models
|
|
20
|
+
obj[key] = execMapper("item", value, opts);
|
|
21
|
+
obj[key] = mapNullableType(obj[key], value, opts);
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}, isArray(input) ? [] : {});
|
|
25
|
+
}
|
|
26
|
+
registerJsonSchemaMapper("object", objectMapper);
|
|
27
|
+
//# sourceMappingURL=objectMapper.js.map
|
|
@@ -0,0 +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,OAA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{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"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
2
|
+
export function ofMapper(input, options, parent) {
|
|
3
|
+
return input.map((value) => {
|
|
4
|
+
return execMapper("item", value, {
|
|
5
|
+
...options,
|
|
6
|
+
genericLabels: parent.genericLabels
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
registerJsonSchemaMapper("anyOf", ofMapper);
|
|
11
|
+
registerJsonSchemaMapper("allOf", ofMapper);
|
|
12
|
+
registerJsonSchemaMapper("oneOf", ofMapper);
|
|
13
|
+
//# sourceMappingURL=ofMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ofMapper.js","sourceRoot":"","sources":["../../../src/components/ofMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAI7F,MAAM,UAAU,QAAQ,CAAC,KAA2B,EAAE,OAA0B,EAAE,MAAkB;IAClG,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAuB,EAAE,EAAE;QAC3C,OAAO,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE;YAC/B,GAAG,OAAO;YACV,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5C,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5C,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport type {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\n\nexport function ofMapper(input: (any | JsonSchema)[], options: JsonSchemaOptions, parent: JsonSchema) {\n return input.map((value: any | JsonSchema) => {\n return execMapper(\"item\", value, {\n ...options,\n genericLabels: parent.genericLabels\n });\n });\n}\n\nregisterJsonSchemaMapper(\"anyOf\", ofMapper);\nregisterJsonSchemaMapper(\"allOf\", ofMapper);\nregisterJsonSchemaMapper(\"oneOf\", ofMapper);\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer";
|
|
2
|
+
export function propertiesMapper(input, options, parent) {
|
|
3
|
+
if (input.isClass) {
|
|
4
|
+
return execMapper("class", input, options);
|
|
5
|
+
}
|
|
6
|
+
return execMapper("any", input, {
|
|
7
|
+
...options,
|
|
8
|
+
genericLabels: parent.genericLabels
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
registerJsonSchemaMapper("properties", propertiesMapper);
|
|
12
|
+
registerJsonSchemaMapper("items", propertiesMapper);
|
|
13
|
+
registerJsonSchemaMapper("additionalProperties", propertiesMapper);
|
|
14
|
+
registerJsonSchemaMapper("propertyNames", propertiesMapper);
|
|
15
|
+
registerJsonSchemaMapper("contains", propertiesMapper);
|
|
16
|
+
registerJsonSchemaMapper("dependencies", propertiesMapper);
|
|
17
|
+
registerJsonSchemaMapper("patternProperties", propertiesMapper);
|
|
18
|
+
registerJsonSchemaMapper("additionalItems", propertiesMapper);
|
|
19
|
+
registerJsonSchemaMapper("not", propertiesMapper);
|
|
20
|
+
registerJsonSchemaMapper("definitions", propertiesMapper);
|
|
21
|
+
//# sourceMappingURL=propertiesMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertiesMapper.js","sourceRoot":"","sources":["../../../src/components/propertiesMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAI7F,MAAM,UAAU,gBAAgB,CAAC,KAAuB,EAAE,OAA0B,EAAE,MAAkB;IACtG,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,OAAO,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KAC5C;IAED,OAAO,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE;QAC9B,GAAG,OAAO;QACV,aAAa,EAAE,MAAM,CAAC,aAAa;KACpC,CAAC,CAAC;AACL,CAAC;AAED,wBAAwB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AACzD,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACpD,wBAAwB,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;AACnE,wBAAwB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAC5D,wBAAwB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACvD,wBAAwB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;AAC3D,wBAAwB,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAChE,wBAAwB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AAC9D,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AAClD,wBAAwB,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import {execMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport type {JsonSchema} from \"../domain/JsonSchema\";\nimport type {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\n\nexport function propertiesMapper(input: any | JsonSchema, options: JsonSchemaOptions, parent: JsonSchema) {\n if (input.isClass) {\n return execMapper(\"class\", input, options);\n }\n\n return execMapper(\"any\", input, {\n ...options,\n genericLabels: parent.genericLabels\n });\n}\n\nregisterJsonSchemaMapper(\"properties\", propertiesMapper);\nregisterJsonSchemaMapper(\"items\", propertiesMapper);\nregisterJsonSchemaMapper(\"additionalProperties\", propertiesMapper);\nregisterJsonSchemaMapper(\"propertyNames\", propertiesMapper);\nregisterJsonSchemaMapper(\"contains\", propertiesMapper);\nregisterJsonSchemaMapper(\"dependencies\", propertiesMapper);\nregisterJsonSchemaMapper(\"patternProperties\", propertiesMapper);\nregisterJsonSchemaMapper(\"additionalItems\", propertiesMapper);\nregisterJsonSchemaMapper(\"not\", propertiesMapper);\nregisterJsonSchemaMapper(\"definitions\", propertiesMapper);\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
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";
|
|
8
|
+
/**
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
const IGNORES = ["name", "$required", "$hooks", "_nestedGenerics", SpecTypes.OPENAPI, SpecTypes.JSON];
|
|
12
|
+
/**
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
const IGNORES_OPENSPEC = ["const"];
|
|
16
|
+
/**
|
|
17
|
+
* @ignore
|
|
18
|
+
*/
|
|
19
|
+
function isEmptyProperties(key, value) {
|
|
20
|
+
return typeof value === "object" && ["items", "properties", "additionalProperties"].includes(key) && Object.keys(value).length === 0;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
function shouldMapAlias(key, value, useAlias) {
|
|
26
|
+
return typeof value === "object" && useAlias && ["properties", "additionalProperties"].includes(key);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
function shouldSkipKey(key, { specType = SpecTypes.JSON, customKeys = false }) {
|
|
32
|
+
return (IGNORES.includes(key) ||
|
|
33
|
+
(key.startsWith("#") && (customKeys === false || specType !== SpecTypes.JSON)) ||
|
|
34
|
+
(specType !== SpecTypes.JSON && IGNORES_OPENSPEC.includes(key)));
|
|
35
|
+
}
|
|
36
|
+
function isExample(key, value, options) {
|
|
37
|
+
return key === "examples" && isObject(value) && SpecTypes.OPENAPI === options.specType;
|
|
38
|
+
}
|
|
39
|
+
export function schemaMapper(schema, options) {
|
|
40
|
+
const { useAlias = true, schemas = {} } = options;
|
|
41
|
+
options = {
|
|
42
|
+
...options,
|
|
43
|
+
useAlias,
|
|
44
|
+
schemas
|
|
45
|
+
};
|
|
46
|
+
let obj = [...schema.keys()]
|
|
47
|
+
.filter((key) => !shouldSkipKey(key, options))
|
|
48
|
+
.reduce((item, key) => {
|
|
49
|
+
let value = schema.get(key);
|
|
50
|
+
key = key.replace(/^#/, "");
|
|
51
|
+
if (key === "type") {
|
|
52
|
+
return {
|
|
53
|
+
...item,
|
|
54
|
+
[key]: schema.getJsonType()
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (isExample(key, value, options)) {
|
|
58
|
+
key = "example";
|
|
59
|
+
value = Object.values(value)[0];
|
|
60
|
+
}
|
|
61
|
+
if (value && typeof value === "object" && hasMapper(key)) {
|
|
62
|
+
value = execMapper(key, value, options, schema);
|
|
63
|
+
if (isEmptyProperties(key, value)) {
|
|
64
|
+
return item;
|
|
65
|
+
}
|
|
66
|
+
if (shouldMapAlias(key, value, useAlias)) {
|
|
67
|
+
value = mapAliasedProperties(value, schema.alias);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
...item,
|
|
72
|
+
[key]: value
|
|
73
|
+
};
|
|
74
|
+
}, {});
|
|
75
|
+
if (schema.isClass) {
|
|
76
|
+
obj = execMapper("inheritedClass", obj, { ...options, root: false, schemas, target: schema.getComputedType() });
|
|
77
|
+
}
|
|
78
|
+
obj = execMapper("generics", obj, { ...options, root: false, schemas });
|
|
79
|
+
if (schema.has(options.specType)) {
|
|
80
|
+
obj = {
|
|
81
|
+
...obj,
|
|
82
|
+
...schema.get(options.specType).toJSON(options)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
obj = getRequiredProperties(obj, schema, { ...options, useAlias });
|
|
86
|
+
obj = mapNullableType(obj, schema, options);
|
|
87
|
+
obj = alterOneOf(obj, schema, options);
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
registerJsonSchemaMapper("schema", schemaMapper);
|
|
91
|
+
//# sourceMappingURL=schemaMapper.js.map
|
|
@@ -0,0 +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;AAE5D,OAAO,EAAC,S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U,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.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"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const HTTP_METHODS = [
|
|
2
|
+
"all",
|
|
3
|
+
"checkout",
|
|
4
|
+
"connect",
|
|
5
|
+
"copy",
|
|
6
|
+
"delete",
|
|
7
|
+
"get",
|
|
8
|
+
"head",
|
|
9
|
+
"lock",
|
|
10
|
+
"merge",
|
|
11
|
+
"mkactivity",
|
|
12
|
+
"mkcol",
|
|
13
|
+
"move",
|
|
14
|
+
"m-search",
|
|
15
|
+
"notify",
|
|
16
|
+
"options",
|
|
17
|
+
"param",
|
|
18
|
+
"patch",
|
|
19
|
+
"post",
|
|
20
|
+
"propfind",
|
|
21
|
+
"propatch",
|
|
22
|
+
"purge",
|
|
23
|
+
"put",
|
|
24
|
+
"report",
|
|
25
|
+
"search",
|
|
26
|
+
"subscribe",
|
|
27
|
+
"trace",
|
|
28
|
+
"unlock",
|
|
29
|
+
"unsuscribe"
|
|
30
|
+
];
|
|
31
|
+
export var OperationMethods;
|
|
32
|
+
(function (OperationMethods) {
|
|
33
|
+
OperationMethods["ALL"] = "ALL";
|
|
34
|
+
OperationMethods["GET"] = "GET";
|
|
35
|
+
OperationMethods["POST"] = "POST";
|
|
36
|
+
OperationMethods["PUT"] = "PUT";
|
|
37
|
+
OperationMethods["PATCH"] = "PATCH";
|
|
38
|
+
OperationMethods["HEAD"] = "HEAD";
|
|
39
|
+
OperationMethods["DELETE"] = "DELETE";
|
|
40
|
+
OperationMethods["OPTIONS"] = "OPTIONS";
|
|
41
|
+
OperationMethods["CUSTOM"] = "CUSTOM";
|
|
42
|
+
})(OperationMethods || (OperationMethods = {}));
|
|
43
|
+
//# sourceMappingURL=httpMethods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpMethods.js","sourceRoot":"","sources":["../../../src/constants/httpMethods.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK;IACL,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,MAAM;IACN,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,QAAQ;IACR,YAAY;CACb,CAAC;AAEF,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;IACX,iCAAa,CAAA;IACb,+BAAW,CAAA;IACX,mCAAe,CAAA;IACf,iCAAa,CAAA;IACb,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACnB,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B","sourcesContent":["export const HTTP_METHODS = [\n \"all\",\n \"checkout\",\n \"connect\",\n \"copy\",\n \"delete\",\n \"get\",\n \"head\",\n \"lock\",\n \"merge\",\n \"mkactivity\",\n \"mkcol\",\n \"move\",\n \"m-search\",\n \"notify\",\n \"options\",\n \"param\",\n \"patch\",\n \"post\",\n \"propfind\",\n \"propatch\",\n \"purge\",\n \"put\",\n \"report\",\n \"search\",\n \"subscribe\",\n \"trace\",\n \"unlock\",\n \"unsuscribe\"\n];\n\nexport enum OperationMethods {\n ALL = \"ALL\", // special key\n GET = \"GET\",\n POST = \"POST\",\n PUT = \"PUT\",\n PATCH = \"PATCH\",\n HEAD = \"HEAD\",\n DELETE = \"DELETE\",\n OPTIONS = \"OPTIONS\",\n CUSTOM = \"CUSTOM\"\n}\n"]}
|