@tsed/schema 7.0.0-alpha.1 → 7.0.0-beta.10
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/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/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 +26 -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 +26 -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 +11 -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 +27 -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/recordOf.js +63 -0
- package/lib/cjs/decorators/common/recordOf.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/operations/acceptMime.js +28 -0
- package/lib/cjs/decorators/operations/acceptMime.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 +80 -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/decorators/operations/view.js +31 -0
- package/lib/cjs/decorators/operations/view.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 +143 -0
- package/lib/cjs/domain/JsonMethodStore.js.map +1 -0
- package/lib/cjs/domain/JsonOperation.js +235 -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 +60 -0
- package/lib/cjs/domain/JsonOperationRoute.js.map +1 -0
- package/lib/cjs/domain/JsonParameter.js +119 -0
- package/lib/cjs/domain/JsonParameter.js.map +1 -0
- package/lib/cjs/domain/JsonParameterStore.js +99 -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 +72 -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 +76 -0
- package/lib/cjs/domain/JsonResponse.js.map +1 -0
- package/lib/cjs/domain/JsonSchema.js +716 -0
- package/lib/cjs/domain/JsonSchema.js.map +1 -0
- package/lib/cjs/domain/SpecTypes.js +10 -0
- package/lib/cjs/domain/SpecTypes.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 +154 -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/package.json +3 -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 +273 -0
- package/lib/cjs/utils/from.js.map +1 -0
- package/lib/cjs/utils/generateSpec.js +46 -0
- package/lib/cjs/utils/generateSpec.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 +65 -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 +37 -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 +102 -0
- package/lib/cjs/utils/getSpec.js.map +1 -0
- package/lib/cjs/utils/getSpecType.js +21 -0
- package/lib/cjs/utils/getSpecType.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/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/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 +45 -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/serializeEnumValues.js +26 -0
- package/lib/cjs/utils/serializeEnumValues.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/cjs/utils/transformToOS2.js +510 -0
- package/lib/cjs/utils/transformToOS2.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/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 +20 -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 +22 -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 +7 -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 +23 -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/recordOf.js +59 -0
- package/lib/esm/decorators/common/recordOf.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/operations/acceptMime.js +24 -0
- package/lib/esm/decorators/operations/acceptMime.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 +76 -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/decorators/operations/view.js +27 -0
- package/lib/esm/decorators/operations/view.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 +140 -0
- package/lib/esm/domain/JsonMethodStore.js.map +1 -0
- package/lib/esm/domain/JsonOperation.js +231 -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 +56 -0
- package/lib/esm/domain/JsonOperationRoute.js.map +1 -0
- package/lib/esm/domain/JsonParameter.js +115 -0
- package/lib/esm/domain/JsonParameter.js.map +1 -0
- package/lib/esm/domain/JsonParameterStore.js +96 -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 +69 -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 +71 -0
- package/lib/esm/domain/JsonResponse.js.map +1 -0
- package/lib/esm/domain/JsonSchema.js +712 -0
- package/lib/esm/domain/JsonSchema.js.map +1 -0
- package/lib/esm/domain/SpecTypes.js +7 -0
- package/lib/esm/domain/SpecTypes.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 +151 -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/package.json +3 -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 +250 -0
- package/lib/esm/utils/from.js.map +1 -0
- package/lib/esm/utils/generateSpec.js +41 -0
- package/lib/esm/utils/generateSpec.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 +61 -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 +33 -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 +98 -0
- package/lib/esm/utils/getSpec.js.map +1 -0
- package/lib/esm/utils/getSpecType.js +16 -0
- package/lib/esm/utils/getSpecType.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/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 +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 +41 -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/serializeEnumValues.js +21 -0
- package/lib/esm/utils/serializeEnumValues.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/esm/utils/transformToOS2.js +504 -0
- package/lib/esm/utils/transformToOS2.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}/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 +11 -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 -0
- 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 +1 -1
- 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 -0
- 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/types/decorators/common/recordOf.d.ts +46 -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/types/decorators/operations/acceptMime.d.ts +19 -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 +1 -1
- 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/types/decorators/operations/view.d.ts +23 -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 +1 -1
- package/lib/types/domain/JsonMethodStore.d.ts +89 -0
- package/lib/{domain → types/domain}/JsonOperation.d.ts +3 -1
- package/lib/types/domain/JsonOperationPathsMap.d.ts +7 -0
- package/lib/types/domain/JsonOperationRoute.d.ts +26 -0
- package/lib/{domain → types/domain}/JsonParameter.d.ts +5 -2
- package/lib/types/domain/JsonParameterStore.d.ts +52 -0
- package/lib/{domain → types/domain}/JsonParameterTypes.d.ts +0 -0
- package/lib/types/domain/JsonPropertyStore.d.ts +30 -0
- package/lib/{domain → types/domain}/JsonRequestBody.d.ts +0 -0
- package/lib/{domain → types/domain}/JsonResponse.d.ts +2 -1
- package/lib/{domain → types/domain}/JsonSchema.d.ts +8 -14
- package/lib/{domain → types/domain}/SpecTypes.d.ts +0 -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/types/index.d.ts +150 -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 +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/types/utils/generateSpec.d.ts +16 -0
- package/lib/{utils → types/utils}/generics.d.ts +1 -1
- 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 +14 -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 +30 -0
- package/lib/types/utils/getSpecType.d.ts +12 -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 +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/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 +0 -0
- package/lib/{utils → types/utils}/operationIdFormatter.d.ts +0 -0
- package/lib/types/utils/ref.d.ts +14 -0
- package/lib/types/utils/serializeEnumValues.d.ts +5 -0
- package/lib/{utils → types/utils}/toJsonMapCollection.d.ts +0 -0
- package/lib/{utils → types/utils}/toJsonRegex.d.ts +0 -0
- package/lib/types/utils/transformToOS2.d.ts +25 -0
- package/package.json +43 -21
- package/readme.md +1 -0
- package/tsconfig.compile.esm.json +13 -0
- package/lib/components/index.d.ts +0 -9
- package/lib/components/lazyRefMapper.d.ts +0 -19
- package/lib/constants/httpStatusMessages.d.ts +0 -5
- package/lib/decorators/index.d.ts +0 -64
- package/lib/domain/JsonEntityStore.d.ts +0 -94
- package/lib/domain/index.d.ts +0 -11
- package/lib/index.d.ts +0 -16
- 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/interfaces/index.d.ts +0 -4
- 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,250 @@
|
|
|
1
|
+
import { isClass } from "@tsed/core";
|
|
2
|
+
import { JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
3
|
+
import { JsonFormatTypes } from "../domain/JsonFormatTypes.js";
|
|
4
|
+
import { JsonLazyRef } from "../domain/JsonLazyRef.js";
|
|
5
|
+
import { JsonSchema } from "../domain/JsonSchema.js";
|
|
6
|
+
import { getJsonEntityStore } from "./getJsonEntityStore.js";
|
|
7
|
+
/**
|
|
8
|
+
* Create a new model from the given type.
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* from(String)
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
15
|
+
*
|
|
16
|
+
* @schemaFunctional
|
|
17
|
+
*/
|
|
18
|
+
export function from(type = Object) {
|
|
19
|
+
if (isClass(type)) {
|
|
20
|
+
const { schema } = getJsonEntityStore(type);
|
|
21
|
+
schema.properties = function properties(obj) {
|
|
22
|
+
Object.entries(obj).forEach(([propertyKey, propSchema]) => {
|
|
23
|
+
getJsonEntityStore(type.prototype, propertyKey).schema.assign(propSchema);
|
|
24
|
+
});
|
|
25
|
+
return this;
|
|
26
|
+
};
|
|
27
|
+
return schema;
|
|
28
|
+
}
|
|
29
|
+
return JsonSchema.from({ type });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Declare a new number model.
|
|
33
|
+
*
|
|
34
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
35
|
+
*
|
|
36
|
+
* @schemaFunctional
|
|
37
|
+
*/
|
|
38
|
+
export function number() {
|
|
39
|
+
return from(Number);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Declare a new integer model.
|
|
43
|
+
*
|
|
44
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
45
|
+
*
|
|
46
|
+
* @schemaFunctional
|
|
47
|
+
*/
|
|
48
|
+
export function integer() {
|
|
49
|
+
return from(Number).integer();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Declare a new string model.
|
|
53
|
+
*
|
|
54
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
55
|
+
*
|
|
56
|
+
* @schemaFunctional
|
|
57
|
+
*/
|
|
58
|
+
export function string() {
|
|
59
|
+
return from(String);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Declare a new boolean model.
|
|
63
|
+
*
|
|
64
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
65
|
+
*
|
|
66
|
+
* @schemaFunctional
|
|
67
|
+
*/
|
|
68
|
+
export function boolean() {
|
|
69
|
+
return from(Boolean);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Declare a new string model with `format: date`.
|
|
73
|
+
*
|
|
74
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
75
|
+
*
|
|
76
|
+
* @schemaFunctional
|
|
77
|
+
*/
|
|
78
|
+
export function date() {
|
|
79
|
+
return from(Date).format(JsonFormatTypes.DATE);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Declare a new string model with `format: datetime`.
|
|
83
|
+
*
|
|
84
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
85
|
+
*
|
|
86
|
+
* @schemaFunctional
|
|
87
|
+
*/
|
|
88
|
+
export function datetime() {
|
|
89
|
+
return from(Date).format(JsonFormatTypes.DATE_TIME);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Declare a new string model with `format: time`.
|
|
93
|
+
*
|
|
94
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
95
|
+
*
|
|
96
|
+
* @schemaFunctional
|
|
97
|
+
*/
|
|
98
|
+
export function time() {
|
|
99
|
+
return from(Date).format(JsonFormatTypes.TIME);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Declare a new string model with `format: email`.
|
|
103
|
+
*
|
|
104
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
105
|
+
*
|
|
106
|
+
* @schemaFunctional
|
|
107
|
+
*/
|
|
108
|
+
export function email() {
|
|
109
|
+
return from(String).format(JsonFormatTypes.EMAIL);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Declare a new string model with `format: uri`.
|
|
113
|
+
*
|
|
114
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
115
|
+
*
|
|
116
|
+
* @schemaFunctional
|
|
117
|
+
*/
|
|
118
|
+
export function uri() {
|
|
119
|
+
return from(String).format(JsonFormatTypes.URI);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Declare a new string model with `format: url`.
|
|
123
|
+
*
|
|
124
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
125
|
+
*
|
|
126
|
+
* @schemaFunctional
|
|
127
|
+
*/
|
|
128
|
+
export function url() {
|
|
129
|
+
return from(String).format(JsonFormatTypes.URL);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Declare a new object model with `additionalProperties: true`.
|
|
133
|
+
*
|
|
134
|
+
* ```json
|
|
135
|
+
* {
|
|
136
|
+
* "type": "array"
|
|
137
|
+
* }
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
141
|
+
*
|
|
142
|
+
* @schemaFunctional
|
|
143
|
+
*/
|
|
144
|
+
export function array() {
|
|
145
|
+
return from(Array);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Declare a new object model with `additionalProperties: true`.
|
|
149
|
+
*
|
|
150
|
+
* ```json
|
|
151
|
+
* {
|
|
152
|
+
* "type": "object",
|
|
153
|
+
* "additionalProperties": true
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
158
|
+
*
|
|
159
|
+
* @schemaFunctional
|
|
160
|
+
*/
|
|
161
|
+
export function map() {
|
|
162
|
+
return from(Map).unknown(true);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Declare a new array model with `uniqueItems: true`.
|
|
166
|
+
*
|
|
167
|
+
* ```json
|
|
168
|
+
* {
|
|
169
|
+
* "type": "array",
|
|
170
|
+
* "uniqueItems": true
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
175
|
+
*
|
|
176
|
+
* @schemaFunctional
|
|
177
|
+
*/
|
|
178
|
+
export function set() {
|
|
179
|
+
return from(Array).uniqueItems(true);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Declare a new object model.
|
|
183
|
+
*
|
|
184
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
185
|
+
*
|
|
186
|
+
* @schemaFunctional
|
|
187
|
+
*/
|
|
188
|
+
export function object(properties = {}) {
|
|
189
|
+
return from(Object).properties(properties);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)
|
|
193
|
+
*
|
|
194
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
195
|
+
*
|
|
196
|
+
* @schemaFunctional
|
|
197
|
+
*/
|
|
198
|
+
export function any(...types) {
|
|
199
|
+
return from().any(...types);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
203
|
+
*
|
|
204
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
205
|
+
*
|
|
206
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
207
|
+
* @schemaFunctional
|
|
208
|
+
*/
|
|
209
|
+
export function anyOf(...anyOf) {
|
|
210
|
+
return from().anyOf(anyOf);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
214
|
+
*
|
|
215
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
216
|
+
*
|
|
217
|
+
* @schemaFunctional
|
|
218
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
219
|
+
*/
|
|
220
|
+
export function oneOf(...oneOf) {
|
|
221
|
+
return from().oneOf(oneOf);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
225
|
+
*
|
|
226
|
+
* * See @@JsonSchema@@ to discover available methods.
|
|
227
|
+
*
|
|
228
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
229
|
+
* @schemaFunctional
|
|
230
|
+
*/
|
|
231
|
+
export function allOf(...allOf) {
|
|
232
|
+
return from().allOf(allOf);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.
|
|
236
|
+
*
|
|
237
|
+
* @schemaFunctional
|
|
238
|
+
*/
|
|
239
|
+
export function lazyRef(cb) {
|
|
240
|
+
try {
|
|
241
|
+
// solve issue with a self referenced model
|
|
242
|
+
if (cb()) {
|
|
243
|
+
// type is already accessible
|
|
244
|
+
return JsonEntityStore.from(cb()).schema;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch (er) { }
|
|
248
|
+
return new JsonLazyRef(cb);
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=from.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from.js","sourceRoot":"","sources":["../../../src/utils/from.ts"],"names":[],"mappings":"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","sourcesContent":["import {isClass, Type} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {JsonFormatTypes} from \"../domain/JsonFormatTypes\";\nimport {JsonLazyRef} from \"../domain/JsonLazyRef\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\n\n/**\n * Create a new model from the given type.\n *\n * ```typescript\n * from(String)\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function from(type: Type<any> = Object) {\n if (isClass(type)) {\n const {schema} = getJsonEntityStore(type);\n\n schema.properties = function properties(obj: {[key: string]: JsonSchema}) {\n Object.entries(obj).forEach(([propertyKey, propSchema]) => {\n getJsonEntityStore(type.prototype, propertyKey).schema.assign(propSchema);\n });\n\n return this;\n };\n\n return schema;\n }\n\n return JsonSchema.from({type});\n}\n\n/**\n * Declare a new number model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function number() {\n return from(Number);\n}\n\n/**\n * Declare a new integer model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function integer() {\n return from(Number).integer();\n}\n\n/**\n * Declare a new string model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function string() {\n return from(String);\n}\n\n/**\n * Declare a new boolean model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function boolean() {\n return from(Boolean);\n}\n\n/**\n * Declare a new string model with `format: date`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function date() {\n return from(Date).format(JsonFormatTypes.DATE);\n}\n\n/**\n * Declare a new string model with `format: datetime`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function datetime() {\n return from(Date).format(JsonFormatTypes.DATE_TIME);\n}\n\n/**\n * Declare a new string model with `format: time`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function time() {\n return from(Date).format(JsonFormatTypes.TIME);\n}\n\n/**\n * Declare a new string model with `format: email`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function email() {\n return from(String).format(JsonFormatTypes.EMAIL);\n}\n\n/**\n * Declare a new string model with `format: uri`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function uri() {\n return from(String).format(JsonFormatTypes.URI);\n}\n\n/**\n * Declare a new string model with `format: url`.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function url() {\n return from(String).format(JsonFormatTypes.URL);\n}\n\n/**\n * Declare a new object model with `additionalProperties: true`.\n *\n * ```json\n * {\n * \"type\": \"array\"\n * }\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function array() {\n return from(Array);\n}\n\n/**\n * Declare a new object model with `additionalProperties: true`.\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"additionalProperties\": true\n * }\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function map() {\n return from(Map).unknown(true);\n}\n\n/**\n * Declare a new array model with `uniqueItems: true`.\n *\n * ```json\n * {\n * \"type\": \"array\",\n * \"uniqueItems\": true\n * }\n * ```\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function set() {\n return from(Array).uniqueItems(true);\n}\n\n/**\n * Declare a new object model.\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function object(properties: {[key: string]: JsonSchema} = {}) {\n return from(Object).properties(properties);\n}\n\n/**\n * Declare a model with any type (By default: `integer`, `number`, `string`, `boolean`, `array`, `object`, `null`)\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n */\nexport function any(...types: any[]) {\n return from().any(...types);\n}\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n * @schemaFunctional\n */\nexport function anyOf(...anyOf: any[]) {\n return from().anyOf(anyOf);\n}\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @schemaFunctional\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n */\nexport function oneOf(...oneOf: any[]) {\n return from().oneOf(oneOf);\n}\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n *\n * * See @@JsonSchema@@ to discover available methods.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n * @schemaFunctional\n */\nexport function allOf(...allOf: any[]) {\n return from().allOf(allOf);\n}\n\n/**\n * Declare a sub schema which will be resolved later. Use this function when you have a circular reference between two schemes.\n *\n * @schemaFunctional\n */\nexport function lazyRef(cb: () => Type<any>) {\n try {\n // solve issue with a self referenced model\n if (cb()) {\n // type is already accessible\n return JsonEntityStore.from(cb()).schema as any;\n }\n } catch (er) {}\n\n return new JsonLazyRef(cb);\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import { getValue } from "@tsed/core";
|
|
3
|
+
import { mapOpenSpec } from "./mapOpenSpec.js";
|
|
4
|
+
import { getSpec } from "./getSpec.js";
|
|
5
|
+
import { getSpecTypeFromSpec } from "./getSpecType.js";
|
|
6
|
+
import { mergeSpec } from "./mergeSpec.js";
|
|
7
|
+
import { SpecTypes } from "../domain/SpecTypes.js";
|
|
8
|
+
import { transformToOS2 } from "./transformToOS2.js";
|
|
9
|
+
async function readSpec(path) {
|
|
10
|
+
if (fs.existsSync(path)) {
|
|
11
|
+
try {
|
|
12
|
+
return await fs.readJSON(path, { encoding: "utf8" });
|
|
13
|
+
}
|
|
14
|
+
catch (e) { }
|
|
15
|
+
}
|
|
16
|
+
/* istanbul ignore next */
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate OpenAPI spec from multiple sources (models, files, conf)
|
|
21
|
+
* @param tokens
|
|
22
|
+
* @param options
|
|
23
|
+
*/
|
|
24
|
+
export async function generateSpec({ tokens, ...options }) {
|
|
25
|
+
const { version = "1.0.0", acceptMimes, specPath, specVersion } = options;
|
|
26
|
+
const fileSpec = specPath ? await readSpec(specPath) : {};
|
|
27
|
+
const defaultSpec = mapOpenSpec(getValue(options, "spec", {}), {
|
|
28
|
+
fileSpec,
|
|
29
|
+
version,
|
|
30
|
+
specVersion,
|
|
31
|
+
acceptMimes
|
|
32
|
+
});
|
|
33
|
+
const specType = getSpecTypeFromSpec(defaultSpec);
|
|
34
|
+
let controllersSpec = getSpec(tokens, options);
|
|
35
|
+
const spec = mergeSpec(defaultSpec, controllersSpec);
|
|
36
|
+
if (specType === SpecTypes.SWAGGER) {
|
|
37
|
+
return transformToOS2(spec);
|
|
38
|
+
}
|
|
39
|
+
return spec;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=generateSpec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,OAAO,EAA0C,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAWhD,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACvB,IAAI;YACF,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;SACpD;QAAC,OAAO,CAAC,EAAE,GAAE;KACf;IAED,0BAA0B;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAC,MAAM,EAAE,GAAG,OAAO,EAAsB;IAC1E,MAAM,EAAC,OAAO,GAAG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAC,GAAG,OAAO,CAAC;IACxE,MAAM,QAAQ,GAAmC,QAAQ,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1F,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE;QAC7D,QAAQ;QACR,OAAO;QACP,WAAW;QACX,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAElD,IAAI,eAAe,GAAQ,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,IAAI,GAAQ,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAE1D,IAAI,QAAQ,KAAK,SAAS,CAAC,OAAO,EAAE;QAClC,OAAO,cAAc,CAAC,IAAI,CAAQ,CAAC;KACpC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import fs from \"fs-extra\";\nimport {getValue} from \"@tsed/core\";\nimport {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {mapOpenSpec} from \"./mapOpenSpec\";\nimport {getSpec, JsonTokenOptions, SpecSerializerOptions} from \"./getSpec\";\nimport {getSpecTypeFromSpec} from \"./getSpecType\";\nimport {mergeSpec} from \"./mergeSpec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {transformToOS2} from \"./transformToOS2\";\n\nexport interface GenerateSpecOptions extends Omit<SpecSerializerOptions, \"specType\"> {\n tokens: JsonTokenOptions;\n version?: string;\n acceptMimes?: string;\n specPath?: string;\n specVersion?: string;\n spec?: any;\n}\n\nasync function readSpec(path: string) {\n if (fs.existsSync(path)) {\n try {\n return await fs.readJSON(path, {encoding: \"utf8\"});\n } catch (e) {}\n }\n\n /* istanbul ignore next */\n return {};\n}\n\n/**\n * Generate OpenAPI spec from multiple sources (models, files, conf)\n * @param tokens\n * @param options\n */\nexport async function generateSpec({tokens, ...options}: GenerateSpecOptions): Promise<OpenSpec2 | OpenSpec3> {\n const {version = \"1.0.0\", acceptMimes, specPath, specVersion} = options;\n const fileSpec: Partial<OpenSpec2 | OpenSpec3> = specPath ? await readSpec(specPath) : {};\n\n const defaultSpec = mapOpenSpec(getValue(options, \"spec\", {}), {\n fileSpec,\n version,\n specVersion,\n acceptMimes\n });\n\n const specType = getSpecTypeFromSpec(defaultSpec);\n\n let controllersSpec: any = getSpec(tokens, options);\n const spec: any = mergeSpec(defaultSpec, controllersSpec);\n\n if (specType === SpecTypes.SWAGGER) {\n return transformToOS2(spec) as any;\n }\n\n return spec;\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignore
|
|
3
|
+
* @param genericLabels
|
|
4
|
+
* @param genericTypes
|
|
5
|
+
*/
|
|
6
|
+
export function getGenericsMap(genericLabels, genericTypes) {
|
|
7
|
+
return genericLabels.reduce((map, item, index) => map.set(item, genericTypes[index]), new Map());
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
* @param options
|
|
12
|
+
*/
|
|
13
|
+
export function mapGenericsOptions(options) {
|
|
14
|
+
if (options.genericLabels && options.genericTypes) {
|
|
15
|
+
const { genericLabels, genericTypes, ...ops } = options;
|
|
16
|
+
return {
|
|
17
|
+
...ops,
|
|
18
|
+
generics: getGenericsMap(genericLabels, genericTypes)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return options;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @ignore
|
|
25
|
+
* @param value
|
|
26
|
+
*/
|
|
27
|
+
export function popGenerics(value) {
|
|
28
|
+
const [genericTypes, ...out] = value.nestedGenerics;
|
|
29
|
+
return {
|
|
30
|
+
genericTypes,
|
|
31
|
+
nestedGenerics: out
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=generics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generics.js","sourceRoot":"","sources":["../../../src/utils/generics.ts"],"names":[],"mappings":"AA4CA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,aAAuB,EAAE,YAA4B;IAClF,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,GAAqB,EAAE,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AACrI,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA8C;IAC/E,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,YAAY,EAAE;QACjD,MAAM,EAAC,aAAa,EAAE,YAAY,EAAE,GAAG,GAAG,EAAC,GAAG,OAAO,CAAC;QAEtD,OAAO;YACL,GAAG,GAAG;YACN,QAAQ,EAAE,cAAc,CAAC,aAAa,EAAE,YAAY,CAAC;SACtD,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAqB;IAC/C,MAAM,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC;IAEpD,OAAO;QACL,YAAY;QACZ,cAAc,EAAE,GAAG;KACpB,CAAC;AACJ,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\n\nexport type GenericValue = Type<any> | JsonSchema | any;\n\n/**\n * @ignore\n */\nexport type GenericsMap = Map<string, GenericValue>;\n\n/**\n * @ignore\n */\nexport interface GenericTypes {\n genericTypes: Type<any>[];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface GenericLabels {\n genericLabels: string[];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface NestedGenerics {\n nestedGenerics: GenericValue[][];\n\n [key: string]: any;\n}\n\n/**\n * @ignore\n */\nexport interface GenericsContext extends GenericTypes, GenericLabels, NestedGenerics {\n generics: GenericsMap;\n}\n\n/**\n * @ignore\n * @param genericLabels\n * @param genericTypes\n */\nexport function getGenericsMap(genericLabels: string[], genericTypes: GenericValue[]): GenericsMap {\n return genericLabels.reduce((map: Map<string, any>, item: string, index: number) => map.set(item, genericTypes[index]), new Map());\n}\n\n/**\n * @ignore\n * @param options\n */\nexport function mapGenericsOptions(options: Partial<GenericTypes & GenericLabels>) {\n if (options.genericLabels && options.genericTypes) {\n const {genericLabels, genericTypes, ...ops} = options;\n\n return {\n ...ops,\n generics: getGenericsMap(genericLabels, genericTypes)\n };\n }\n\n return options;\n}\n\n/**\n * @ignore\n * @param value\n */\nexport function popGenerics(value: NestedGenerics): NestedGenerics & GenericTypes {\n const [genericTypes, ...out] = value.nestedGenerics;\n\n return {\n genericTypes,\n nestedGenerics: out\n };\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { classOf, isArrowFn, isClass, isClassObject, isCollection, isDate, isPrimitiveOrPrimitiveClass, isPromise, isSymbol } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export function getComputedType(target) {
|
|
6
|
+
if (isPromise(target)) {
|
|
7
|
+
return Object;
|
|
8
|
+
}
|
|
9
|
+
if (isClass(target) ||
|
|
10
|
+
isSymbol(target) ||
|
|
11
|
+
isPrimitiveOrPrimitiveClass(target) ||
|
|
12
|
+
isClassObject(target) ||
|
|
13
|
+
isDate(target) ||
|
|
14
|
+
isCollection(target)) {
|
|
15
|
+
return classOf(target);
|
|
16
|
+
}
|
|
17
|
+
if (isArrowFn(target)) {
|
|
18
|
+
return target();
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=getComputedType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getComputedType.js","sourceRoot":"","sources":["../../../src/utils/getComputedType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,aAAa,EACb,YAAY,EACZ,MAAM,EACN,2BAA2B,EAC3B,SAAS,EACT,QAAQ,EAET,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAW;IACzC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;QACrB,OAAO,MAAM,CAAC;KACf;IAED,IACE,OAAO,CAAC,MAAM,CAAC;QACf,QAAQ,CAAC,MAAM,CAAC;QAChB,2BAA2B,CAAC,MAAM,CAAC;QACnC,aAAa,CAAC,MAAM,CAAC;QACrB,MAAM,CAAC,MAAM,CAAC;QACd,YAAY,CAAC,MAAM,CAAC,EACpB;QACA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;KACxB;IAED,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;QACrB,OAAQ,MAAc,EAAE,CAAC;KAC1B;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n classOf,\n isArrowFn,\n isClass,\n isClassObject,\n isCollection,\n isDate,\n isPrimitiveOrPrimitiveClass,\n isPromise,\n isSymbol,\n Type\n} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport function getComputedType(target: any): Type<any> {\n if (isPromise(target)) {\n return Object;\n }\n\n if (\n isClass(target) ||\n isSymbol(target) ||\n isPrimitiveOrPrimitiveClass(target) ||\n isClassObject(target) ||\n isDate(target) ||\n isCollection(target)\n ) {\n return classOf(target);\n }\n\n if (isArrowFn(target)) {\n return (target as any)();\n }\n\n return target;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ancestorsOf } from "@tsed/core";
|
|
2
|
+
import { getJsonEntityStore } from "./getJsonEntityStore.js";
|
|
3
|
+
/**
|
|
4
|
+
* Return store and his inherited stores
|
|
5
|
+
* @param target
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
export function getInheritedStores(target) {
|
|
9
|
+
const store = target.isStore ? target : getJsonEntityStore(target);
|
|
10
|
+
if (!store.$inherited) {
|
|
11
|
+
store.$inherited = ancestorsOf(store.target)
|
|
12
|
+
.reverse()
|
|
13
|
+
.reduce((context, model) => {
|
|
14
|
+
return context.set(model, getJsonEntityStore(model));
|
|
15
|
+
}, new Map());
|
|
16
|
+
}
|
|
17
|
+
return store.$inherited;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=getInheritedStores.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInheritedStores.js","sourceRoot":"","sources":["../../../src/utils/getInheritedStores.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAO,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAuB;IACxD,MAAM,KAAK,GAAmB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAiB,MAAM,CAAC,CAAC;IAEnG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;QACrB,KAAK,CAAC,UAAU,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;aACzC,OAAO,EAAE;aACT,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YACzB,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;QACvD,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;KACjB;IAED,OAAO,KAAK,CAAC,UAAU,CAAC;AAC1B,CAAC","sourcesContent":["import {ancestorsOf, Type} from \"@tsed/core\";\nimport type {JsonClassStore} from \"../domain/JsonClassStore\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\n\n/**\n * Return store and his inherited stores\n * @param target\n * @ignore\n */\nexport function getInheritedStores(target: Type<any> | any): Map<Type<any>, JsonClassStore> {\n const store: JsonClassStore = target.isStore ? target : getJsonEntityStore<JsonClassStore>(target);\n\n if (!store.$inherited) {\n store.$inherited = ancestorsOf(store.target)\n .reverse()\n .reduce((context, model) => {\n return context.set(model, getJsonEntityStore(model));\n }, new Map());\n }\n\n return store.$inherited;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DecoratorTypes } from "@tsed/core";
|
|
2
|
+
import { JsonEntitiesContainer, JsonEntityStore } from "../domain/JsonEntityStore.js";
|
|
3
|
+
import { JsonClassStore } from "../domain/JsonClassStore.js";
|
|
4
|
+
import { JsonPropertyStore } from "../domain/JsonPropertyStore.js";
|
|
5
|
+
import { JsonParameterStore } from "../domain/JsonParameterStore.js";
|
|
6
|
+
import { JsonMethodStore } from "../domain/JsonMethodStore.js";
|
|
7
|
+
JsonEntitiesContainer.set(DecoratorTypes.CLASS, JsonClassStore);
|
|
8
|
+
JsonEntitiesContainer.set(DecoratorTypes.PROP, JsonPropertyStore);
|
|
9
|
+
JsonEntitiesContainer.set(DecoratorTypes.PARAM, JsonParameterStore);
|
|
10
|
+
JsonEntitiesContainer.set(DecoratorTypes.METHOD, JsonMethodStore);
|
|
11
|
+
export function getJsonEntityStore(...args) {
|
|
12
|
+
return JsonEntityStore.from(...args);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=getJsonEntityStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJsonEntityStore.js","sourceRoot":"","sources":["../../../src/utils/getJsonEntityStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAO,MAAM,YAAY,CAAC;AAChD,OAAO,EAAC,qBAAqB,EAAE,eAAe,EAAC,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAChE,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAClE,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AACpE,qBAAqB,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAsBlE,MAAM,UAAU,kBAAkB,CAA8C,GAAG,IAAW;IAC5F,OAAO,eAAe,CAAC,IAAI,CAAI,GAAG,IAAI,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import {DecoratorTypes, Type} from \"@tsed/core\";\nimport {JsonEntitiesContainer, JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {JsonClassStore} from \"../domain/JsonClassStore\";\nimport {JsonPropertyStore} from \"../domain/JsonPropertyStore\";\nimport {JsonParameterStore} from \"../domain/JsonParameterStore\";\nimport {JsonMethodStore} from \"../domain/JsonMethodStore\";\n\nJsonEntitiesContainer.set(DecoratorTypes.CLASS, JsonClassStore);\nJsonEntitiesContainer.set(DecoratorTypes.PROP, JsonPropertyStore);\nJsonEntitiesContainer.set(DecoratorTypes.PARAM, JsonParameterStore);\nJsonEntitiesContainer.set(DecoratorTypes.METHOD, JsonMethodStore);\n\n/**\n * Get entity store from decorator args\n * @param target\n */\nexport function getJsonEntityStore<T extends JsonClassStore = JsonClassStore>(target: Type<any>): T;\nexport function getJsonEntityStore<T extends JsonPropertyStore = JsonPropertyStore>(\n target: Type<any> | any,\n propertyKey: string | symbol\n): T;\nexport function getJsonEntityStore<T extends JsonParameterStore = JsonParameterStore>(\n target: Type<any> | any,\n propertyKey: string | symbol,\n index: number\n): T;\nexport function getJsonEntityStore<T extends JsonMethodStore = JsonMethodStore>(\n target: Type<any> | any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor\n): T;\nexport function getJsonEntityStore<T extends JsonEntityStore = JsonEntityStore>(...args: any[]): T;\nexport function getJsonEntityStore<T extends JsonEntityStore = JsonEntityStore>(...args: any[]): T {\n return JsonEntityStore.from<T>(...args);\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignore
|
|
3
|
+
*/
|
|
4
|
+
function getVariable(subpath) {
|
|
5
|
+
const [prefix, right] = subpath.split("=");
|
|
6
|
+
const splited = (right || prefix).split(".");
|
|
7
|
+
const name = splited.splice(0, 1)[0];
|
|
8
|
+
return {
|
|
9
|
+
prefix: right && prefix ? `${prefix}=` : "",
|
|
10
|
+
name,
|
|
11
|
+
postfix: splited.length ? `.${splited.join(".")}` : ""
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
export function getJsonPathParameters(base, path = "") {
|
|
18
|
+
if (path instanceof RegExp) {
|
|
19
|
+
path = path.toString().replace(/^\//, "").replace(/\/$/, "").replace(/\\/, "");
|
|
20
|
+
}
|
|
21
|
+
const params = [];
|
|
22
|
+
const paths = [];
|
|
23
|
+
let isOptional = false;
|
|
24
|
+
let current = "";
|
|
25
|
+
`${base}${path}`
|
|
26
|
+
.replace(/\((.*)\)/gi, "")
|
|
27
|
+
.split("/")
|
|
28
|
+
.filter((o) => !!o)
|
|
29
|
+
.map((key) => {
|
|
30
|
+
const subpath = key.replace(":", "").replace("?", "");
|
|
31
|
+
if (key.includes(":")) {
|
|
32
|
+
const optional = key.includes("?");
|
|
33
|
+
// Append previous config
|
|
34
|
+
if (optional && !isOptional) {
|
|
35
|
+
isOptional = true;
|
|
36
|
+
paths.push({
|
|
37
|
+
path: current,
|
|
38
|
+
parameters: [].concat(params)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const { prefix, name, postfix } = getVariable(subpath);
|
|
42
|
+
current += `/${prefix}{${name}}${postfix}`;
|
|
43
|
+
params.push({
|
|
44
|
+
in: "path",
|
|
45
|
+
name,
|
|
46
|
+
type: "string",
|
|
47
|
+
required: true
|
|
48
|
+
});
|
|
49
|
+
if (optional && isOptional) {
|
|
50
|
+
paths.push({
|
|
51
|
+
path: current,
|
|
52
|
+
parameters: [].concat(params)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
current += `/${key}`;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return paths.length
|
|
61
|
+
? paths
|
|
62
|
+
: [
|
|
63
|
+
{
|
|
64
|
+
path: current,
|
|
65
|
+
parameters: [].concat(params)
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=getJsonPathParameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJsonPathParameters.js","sourceRoot":"","sources":["../../../src/utils/getJsonPathParameters.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @ignore\n */\nfunction getVariable(subpath: string) {\n const [prefix, right] = subpath.split(\"=\");\n const splited = (right || prefix).split(\".\");\n const name = splited.splice(0, 1)[0];\n\n return {\n prefix: right && prefix ? `${prefix}=` : \"\",\n name,\n postfix: splited.length ? `.${splited.join(\".\")}` : \"\"\n };\n}\n\n/**\n * @ignore\n */\nexport function getJsonPathParameters(base: string, path: string | RegExp | (string | RegExp)[] = \"\"): {path: string; parameters: any[]}[] {\n if (path instanceof RegExp) {\n path = path.toString().replace(/^\\//, \"\").replace(/\\/$/, \"\").replace(/\\\\/, \"\");\n }\n\n const params: any[] = [];\n const paths: any[] = [];\n let isOptional = false;\n let current = \"\";\n\n `${base}${path}`\n .replace(/\\((.*)\\)/gi, \"\")\n .split(\"/\")\n .filter((o) => !!o)\n .map((key) => {\n const subpath = key.replace(\":\", \"\").replace(\"?\", \"\");\n\n if (key.includes(\":\")) {\n const optional = key.includes(\"?\");\n\n // Append previous config\n if (optional && !isOptional) {\n isOptional = true;\n\n paths.push({\n path: current,\n parameters: [].concat(params as any)\n });\n }\n\n const {prefix, name, postfix} = getVariable(subpath);\n current += `/${prefix}{${name}}${postfix}`;\n\n params.push({\n in: \"path\",\n name,\n type: \"string\",\n required: true\n });\n\n if (optional && isOptional) {\n paths.push({\n path: current,\n parameters: [].concat(params as any)\n });\n }\n } else {\n current += `/${key}`;\n }\n });\n\n return paths.length\n ? paths\n : [\n {\n path: current,\n parameters: [].concat(params as any)\n }\n ];\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SpecTypes } from "../domain/SpecTypes.js";
|
|
2
|
+
import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { getJsonEntityStore } from "./getJsonEntityStore.js";
|
|
4
|
+
import "../components/anyMapper.js";
|
|
5
|
+
import "../components/classMapper.js";
|
|
6
|
+
import "../components/genericsMapper.js";
|
|
7
|
+
import "../components/inheritedClassMapper.js";
|
|
8
|
+
import "../components/itemMapper.js";
|
|
9
|
+
import "../components/lazyRefMapper.js";
|
|
10
|
+
import "../components/mapMapper.js";
|
|
11
|
+
import "../components/objectMapper.js";
|
|
12
|
+
import "../components/ofMapper.js";
|
|
13
|
+
import "../components/propertiesMapper.js";
|
|
14
|
+
import "../components/schemaMapper.js";
|
|
15
|
+
/**
|
|
16
|
+
* @ignore
|
|
17
|
+
*/
|
|
18
|
+
const CACHE_KEY = "$cache:schemes";
|
|
19
|
+
/**
|
|
20
|
+
* @ignore
|
|
21
|
+
*/
|
|
22
|
+
function getKey(options) {
|
|
23
|
+
return JSON.stringify(options);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @ignore
|
|
27
|
+
*/
|
|
28
|
+
function get(entity, options) {
|
|
29
|
+
const cache = entity.store.get(CACHE_KEY) || new Map();
|
|
30
|
+
const key = getKey(options);
|
|
31
|
+
if (!cache.has(key)) {
|
|
32
|
+
const schema = execMapper("schema", entity.schema, options);
|
|
33
|
+
if (Object.keys(options.schemas).length) {
|
|
34
|
+
schema.definitions = options.schemas;
|
|
35
|
+
}
|
|
36
|
+
cache.set(key, schema);
|
|
37
|
+
}
|
|
38
|
+
entity.store.set(CACHE_KEY, cache);
|
|
39
|
+
return cache.get(key);
|
|
40
|
+
}
|
|
41
|
+
export function getJsonSchema(model, options = {}) {
|
|
42
|
+
var _a;
|
|
43
|
+
const entity = getJsonEntityStore(model);
|
|
44
|
+
options = {
|
|
45
|
+
endpoint: true,
|
|
46
|
+
groups: [],
|
|
47
|
+
...options,
|
|
48
|
+
specType: options.specType || SpecTypes.JSON,
|
|
49
|
+
schemas: {}
|
|
50
|
+
};
|
|
51
|
+
if (entity.decoratorType === "parameter") {
|
|
52
|
+
options = {
|
|
53
|
+
...options,
|
|
54
|
+
genericTypes: entity.nestedGenerics[0],
|
|
55
|
+
nestedGenerics: entity.nestedGenerics,
|
|
56
|
+
groups: (_a = entity.parameter) === null || _a === void 0 ? void 0 : _a.groups
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return get(entity, options);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=getJsonSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/utils/getJsonSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AACtC,OAAO,oCAAoC,CAAC;AAC5C,OAAO,0BAA0B,CAAC;AAClC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CAAC;AACxC,OAAO,4BAA4B,CAAC;AAEpC;;GAEG;AACH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,MAAM,CAAC,OAAY;IAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,GAAG,CAAC,MAAuB,EAAE,OAAY;IAChD,MAAM,KAAK,GAAqB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;IACzE,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE5D,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YACvC,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;SACtC;QAED,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KACxB;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAsB,EAAE,UAA6B,EAAE;;IACnF,MAAM,MAAM,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,GAAG;QACR,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE;QACV,GAAG,OAAO;QACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI;QAC5C,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,IAAI,MAAM,CAAC,aAAa,KAAK,WAAW,EAAE;QACxC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YACtC,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAA,MAAM,CAAC,SAAS,0CAAE,MAAM;SACjC,CAAC;KACH;IAED,OAAO,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../domain/JsonEntityStore\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getJsonEntityStore} from \"./getJsonEntityStore\";\nimport \"../components/anyMapper\";\nimport \"../components/classMapper\";\nimport \"../components/genericsMapper\";\nimport \"../components/inheritedClassMapper\";\nimport \"../components/itemMapper\";\nimport \"../components/lazyRefMapper\";\nimport \"../components/mapMapper\";\nimport \"../components/objectMapper\";\nimport \"../components/ofMapper\";\nimport \"../components/propertiesMapper\";\nimport \"../components/schemaMapper\";\n\n/**\n * @ignore\n */\nconst CACHE_KEY = \"$cache:schemes\";\n\n/**\n * @ignore\n */\nfunction getKey(options: any) {\n return JSON.stringify(options);\n}\n\n/**\n * @ignore\n */\nfunction get(entity: JsonEntityStore, options: any) {\n const cache: Map<string, any> = entity.store.get(CACHE_KEY) || new Map();\n const key = getKey(options);\n\n if (!cache.has(key)) {\n const schema = execMapper(\"schema\", entity.schema, options);\n\n if (Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n cache.set(key, schema);\n }\n\n entity.store.set(CACHE_KEY, cache);\n\n return cache.get(key);\n}\n\nexport function getJsonSchema(model: Type<any> | any, options: JsonSchemaOptions = {}) {\n const entity = getJsonEntityStore(model);\n\n options = {\n endpoint: true,\n groups: [],\n ...options,\n specType: options.specType || SpecTypes.JSON,\n schemas: {}\n };\n\n if (entity.decoratorType === \"parameter\") {\n options = {\n ...options,\n genericTypes: entity.nestedGenerics[0],\n nestedGenerics: entity.nestedGenerics,\n groups: entity.parameter?.groups\n };\n }\n\n return get(entity, options);\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isArray, isBuffer, isDate, isPrimitiveOrPrimitiveClass, primitiveOf } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export const JSON_TYPES = ["string", "number", "integer", "boolean", "object", "array", "null", "any"];
|
|
6
|
+
export function getJsonType(value) {
|
|
7
|
+
if (value === null) {
|
|
8
|
+
return "null";
|
|
9
|
+
}
|
|
10
|
+
if (isPrimitiveOrPrimitiveClass(value)) {
|
|
11
|
+
if (JSON_TYPES.indexOf(value) > -1) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
if (value === "file") {
|
|
16
|
+
return "file";
|
|
17
|
+
}
|
|
18
|
+
return "generic";
|
|
19
|
+
}
|
|
20
|
+
return primitiveOf(value);
|
|
21
|
+
}
|
|
22
|
+
if (value === Array) {
|
|
23
|
+
return "array";
|
|
24
|
+
}
|
|
25
|
+
if (isArray(value)) {
|
|
26
|
+
return value.map(getJsonType);
|
|
27
|
+
}
|
|
28
|
+
if (value === Set) {
|
|
29
|
+
return "array";
|
|
30
|
+
}
|
|
31
|
+
if (isDate(value) || isBuffer(value)) {
|
|
32
|
+
return "string";
|
|
33
|
+
}
|
|
34
|
+
return "object";
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=getJsonType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJsonType.js","sourceRoot":"","sources":["../../../src/utils/getJsonType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,2BAA2B,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAEvG,MAAM,UAAU,WAAW,CAAC,KAAU;IACpC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,OAAO,MAAM,CAAC;KACf;IAED,IAAI,2BAA2B,CAAC,KAAK,CAAC,EAAE;QACtC,IAAI,UAAU,CAAC,OAAO,CAAC,KAAe,CAAC,GAAG,CAAC,CAAC,EAAE;YAC5C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAAI,KAAK,KAAK,MAAM,EAAE;gBACpB,OAAO,MAAM,CAAC;aACf;YAED,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;KAC3B;IAED,IAAI,KAAK,KAAK,KAAK,EAAE;QACnB,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAQ,CAAC;KACtC;IAED,IAAI,KAAK,KAAK,GAAG,EAAE;QACjB,OAAO,OAAO,CAAC;KAChB;IAED,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACpC,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import {isArray, isBuffer, isDate, isPrimitiveOrPrimitiveClass, primitiveOf} from \"@tsed/core\";\n\n/**\n * @ignore\n */\nexport const JSON_TYPES = [\"string\", \"number\", \"integer\", \"boolean\", \"object\", \"array\", \"null\", \"any\"];\n\nexport function getJsonType(value: any): string {\n if (value === null) {\n return \"null\";\n }\n\n if (isPrimitiveOrPrimitiveClass(value)) {\n if (JSON_TYPES.indexOf(value as string) > -1) {\n return value;\n }\n\n if (typeof value === \"string\") {\n if (value === \"file\") {\n return \"file\";\n }\n\n return \"generic\";\n }\n\n return primitiveOf(value);\n }\n\n if (value === Array) {\n return \"array\";\n }\n\n if (isArray(value)) {\n return value.map(getJsonType) as any;\n }\n\n if (value === Set) {\n return \"array\";\n }\n\n if (isDate(value) || isBuffer(value)) {\n return \"string\";\n }\n\n return \"object\";\n}\n"]}
|