@tsed/schema 7.0.0-alpha.2 → 7.0.0-beta.11
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/{constants → types/constants}/httpMethods.d.ts +0 -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 +0 -0
- 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/{decorators → types/decorators}/operations/route.d.ts +3 -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 +0 -0
- 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/{utils → types/utils}/mapRouteOptions.d.ts +1 -1
- 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 +44 -25
- 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 -65
- package/lib/domain/JsonEntityStore.d.ts +0 -94
- package/lib/domain/index.d.ts +0 -11
- package/lib/index.d.ts +0 -17
- package/lib/index.js +0 -7894
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -7751
- 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,510 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformToOS2 = exports.Converter = exports.transformInformation = exports.transformSecurity = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const HTTP_METHODS = ["get", "put", "post", "delete", "options", "head", "patch", "trace"];
|
|
6
|
+
const SCHEMA_PROPERTIES = [
|
|
7
|
+
"format",
|
|
8
|
+
"minimum",
|
|
9
|
+
"maximum",
|
|
10
|
+
"exclusiveMinimum",
|
|
11
|
+
"exclusiveMaximum",
|
|
12
|
+
"minLength",
|
|
13
|
+
"maxLength",
|
|
14
|
+
"multipleOf",
|
|
15
|
+
"minItems",
|
|
16
|
+
"maxItems",
|
|
17
|
+
"uniqueItems",
|
|
18
|
+
"minProperties",
|
|
19
|
+
"maxProperties",
|
|
20
|
+
"additionalProperties",
|
|
21
|
+
"pattern",
|
|
22
|
+
"enum",
|
|
23
|
+
"default"
|
|
24
|
+
];
|
|
25
|
+
const ARRAY_PROPERTIES = ["type", "items"];
|
|
26
|
+
const APPLICATION_JSON_REGEX = /^(application\/json|[^;\/ \t]+\/[^;\/ \t]+[+]json)[ \t]*(;.*)?$/;
|
|
27
|
+
const SUPPORTED_MIME_TYPES = {
|
|
28
|
+
APPLICATION_X_WWW_URLENCODED: "application/x-www-form-urlencoded",
|
|
29
|
+
MULTIPART_FORM_DATA: "multipart/form-data"
|
|
30
|
+
};
|
|
31
|
+
function fixRef(ref) {
|
|
32
|
+
return ref.replace("#/components/schemas/", "#/definitions/").replace("#/components/", "#/x-components/");
|
|
33
|
+
}
|
|
34
|
+
function fixRefs(obj) {
|
|
35
|
+
if (Array.isArray(obj)) {
|
|
36
|
+
obj.forEach(fixRefs);
|
|
37
|
+
}
|
|
38
|
+
else if (typeof obj === "object") {
|
|
39
|
+
for (let key in obj) {
|
|
40
|
+
if (key === "$ref") {
|
|
41
|
+
obj.$ref = fixRef(obj.$ref);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
fixRefs(obj[key]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function isJsonMimeType(type) {
|
|
50
|
+
return new RegExp(APPLICATION_JSON_REGEX, "i").test(type);
|
|
51
|
+
}
|
|
52
|
+
function getSupportedMimeTypes(content) {
|
|
53
|
+
const MIME_VALUES = Object.keys(SUPPORTED_MIME_TYPES).map((key) => {
|
|
54
|
+
return SUPPORTED_MIME_TYPES[key];
|
|
55
|
+
});
|
|
56
|
+
return Object.keys(content).filter((key) => {
|
|
57
|
+
return MIME_VALUES.indexOf(key) > -1 || isJsonMimeType(key);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function transformSecurity(securitySchemes) {
|
|
61
|
+
function map(security) {
|
|
62
|
+
const { scheme, type, name, bearerFormat, flows, ...props } = security;
|
|
63
|
+
switch (type) {
|
|
64
|
+
case "http":
|
|
65
|
+
if (scheme === "basic") {
|
|
66
|
+
return {
|
|
67
|
+
...props,
|
|
68
|
+
type: scheme
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (scheme === "bearer") {
|
|
72
|
+
return {
|
|
73
|
+
...props,
|
|
74
|
+
type: "apiKey",
|
|
75
|
+
name: "Authorization",
|
|
76
|
+
in: "header"
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
case "oauth2":
|
|
81
|
+
const flowName = Object.keys(flows)[0];
|
|
82
|
+
const flow = flows[flowName];
|
|
83
|
+
let flowType = flowName;
|
|
84
|
+
if (flowType === "clientCredentials") {
|
|
85
|
+
flowType = "application";
|
|
86
|
+
}
|
|
87
|
+
else if (flowType === "authorizationCode") {
|
|
88
|
+
flowType = "accessCode";
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
type,
|
|
92
|
+
flow: flowType,
|
|
93
|
+
authorizationUrl: flow.authorizationUrl,
|
|
94
|
+
tokenUrl: flow.tokenUrl,
|
|
95
|
+
scopes: flow.scopes
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return Object.entries(securitySchemes).reduce((securityDefinitions, [key, security]) => {
|
|
100
|
+
return {
|
|
101
|
+
...securityDefinitions,
|
|
102
|
+
[key]: map(security)
|
|
103
|
+
};
|
|
104
|
+
}, {});
|
|
105
|
+
}
|
|
106
|
+
exports.transformSecurity = transformSecurity;
|
|
107
|
+
function transformInformation(server) {
|
|
108
|
+
let serverUrl = server.url;
|
|
109
|
+
const variables = server["variables"] || {};
|
|
110
|
+
for (const variable in variables) {
|
|
111
|
+
const variableObject = variables[variable] || {};
|
|
112
|
+
if (variableObject["default"]) {
|
|
113
|
+
const re = RegExp(`{${variable}}`, "g");
|
|
114
|
+
serverUrl = serverUrl.replace(re, variableObject["default"]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const url = new URL(serverUrl);
|
|
118
|
+
return {
|
|
119
|
+
host: url.host ? url.host : undefined,
|
|
120
|
+
basePath: url.pathname,
|
|
121
|
+
schemes: url.protocol !== null ? [url.protocol.substring(0, url.protocol.length - 1)] : undefined
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
exports.transformInformation = transformInformation;
|
|
125
|
+
class Converter {
|
|
126
|
+
constructor(spec) {
|
|
127
|
+
this.spec = JSON.parse(JSON.stringify(spec));
|
|
128
|
+
}
|
|
129
|
+
convertInfos() {
|
|
130
|
+
const server = this.spec.servers && this.spec.servers[0];
|
|
131
|
+
if (server) {
|
|
132
|
+
return transformInformation(server);
|
|
133
|
+
}
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
resolveReference(base, obj, shouldClone) {
|
|
137
|
+
if (!obj || !obj.$ref) {
|
|
138
|
+
return obj;
|
|
139
|
+
}
|
|
140
|
+
const ref = obj.$ref;
|
|
141
|
+
if (ref.startsWith("#")) {
|
|
142
|
+
const keys = ref.split("/").map((k) => k.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
143
|
+
keys.shift();
|
|
144
|
+
let cur = base;
|
|
145
|
+
keys.forEach((k) => {
|
|
146
|
+
cur = cur[k];
|
|
147
|
+
});
|
|
148
|
+
return shouldClone ? JSON.parse(JSON.stringify(cur)) : cur;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
convert() {
|
|
152
|
+
const spec = {
|
|
153
|
+
swagger: "2.0",
|
|
154
|
+
...this.convertInfos(),
|
|
155
|
+
paths: this.spec.paths ? this.convertOperations(this.spec.paths, this.spec) : undefined
|
|
156
|
+
};
|
|
157
|
+
if (this.spec.components) {
|
|
158
|
+
this.convertSchemas();
|
|
159
|
+
this.convertSecurityDefinitions();
|
|
160
|
+
this.spec["x-components"] = this.spec.components;
|
|
161
|
+
delete this.spec.components;
|
|
162
|
+
fixRefs(this.spec);
|
|
163
|
+
}
|
|
164
|
+
delete this.spec.servers;
|
|
165
|
+
delete this.spec.openapi;
|
|
166
|
+
delete this.spec["x-components"];
|
|
167
|
+
return (0, core_1.cleanObject)({
|
|
168
|
+
...spec,
|
|
169
|
+
...this.spec
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
convertOperations(paths, spec) {
|
|
173
|
+
return Object.entries(paths).reduce((paths, [path, operation]) => {
|
|
174
|
+
const pathObject = (paths[path] = this.resolveReference({ ...spec, paths }, operation, true));
|
|
175
|
+
this.convertParameters(pathObject); // converts common parameters
|
|
176
|
+
Object.keys(pathObject).forEach((method) => {
|
|
177
|
+
if (HTTP_METHODS.indexOf(method) >= 0) {
|
|
178
|
+
const operation = (pathObject[method] = this.resolveReference({ ...spec, paths }, pathObject[method], true));
|
|
179
|
+
this.convertOperationParameters(operation);
|
|
180
|
+
this.convertResponses(operation);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return paths;
|
|
184
|
+
}, paths);
|
|
185
|
+
}
|
|
186
|
+
convertOperationParameters(operation) {
|
|
187
|
+
let content, contentKey, mediaRanges, mediaTypes;
|
|
188
|
+
operation.parameters = operation.parameters || [];
|
|
189
|
+
if (operation.requestBody) {
|
|
190
|
+
let param = this.resolveReference(this.spec, operation.requestBody, true);
|
|
191
|
+
// fixing external $ref in body
|
|
192
|
+
if (operation.requestBody.content) {
|
|
193
|
+
const type = getSupportedMimeTypes(operation.requestBody.content)[0];
|
|
194
|
+
const structuredObj = { content: {} };
|
|
195
|
+
const data = operation.requestBody.content[type];
|
|
196
|
+
if (data && data.schema && data.schema.$ref && !data.schema.$ref.startsWith("#")) {
|
|
197
|
+
param = this.resolveReference(this.spec, data.schema, true);
|
|
198
|
+
structuredObj["content"][`${type}`] = { schema: param };
|
|
199
|
+
param = structuredObj;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
param.name = "body";
|
|
203
|
+
content = param.content;
|
|
204
|
+
if (content && Object.keys(content).length) {
|
|
205
|
+
mediaRanges = Object.keys(content).filter((mediaRange) => mediaRange.indexOf("/") > 0);
|
|
206
|
+
mediaTypes = mediaRanges.filter((range) => range.indexOf("*") < 0);
|
|
207
|
+
contentKey = getSupportedMimeTypes(content)[0];
|
|
208
|
+
delete param.content;
|
|
209
|
+
if ([SUPPORTED_MIME_TYPES.APPLICATION_X_WWW_URLENCODED, SUPPORTED_MIME_TYPES.MULTIPART_FORM_DATA].includes(contentKey)) {
|
|
210
|
+
operation.consumes = mediaTypes;
|
|
211
|
+
param.in = "formData";
|
|
212
|
+
param.schema = content[contentKey].schema;
|
|
213
|
+
param.schema = this.resolveReference(this.spec, param.schema, true);
|
|
214
|
+
if (param.schema.type === "object" && param.schema.properties) {
|
|
215
|
+
const required = param.schema.required || [];
|
|
216
|
+
Object.keys(param.schema.properties).forEach((name) => {
|
|
217
|
+
var _a;
|
|
218
|
+
const schema = param.schema.properties[name];
|
|
219
|
+
// readOnly properties should not be sent in requests
|
|
220
|
+
if (!schema.readOnly) {
|
|
221
|
+
const formDataParam = {
|
|
222
|
+
name,
|
|
223
|
+
in: "formData",
|
|
224
|
+
schema
|
|
225
|
+
};
|
|
226
|
+
if (required.indexOf(name) >= 0) {
|
|
227
|
+
formDataParam.required = true;
|
|
228
|
+
}
|
|
229
|
+
(_a = operation.parameters) === null || _a === void 0 ? void 0 : _a.push(formDataParam);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
operation.parameters.push(param);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (contentKey) {
|
|
238
|
+
operation.consumes = mediaTypes;
|
|
239
|
+
param.in = "body";
|
|
240
|
+
param.schema = content[contentKey].schema;
|
|
241
|
+
operation.parameters.push(param);
|
|
242
|
+
}
|
|
243
|
+
else if (mediaRanges) {
|
|
244
|
+
operation.consumes = mediaTypes || ["application/octet-stream"];
|
|
245
|
+
param.in = "body";
|
|
246
|
+
param.name = param.name || "file";
|
|
247
|
+
delete param.type;
|
|
248
|
+
param.schema = content[mediaRanges[0]].schema || {
|
|
249
|
+
type: "string",
|
|
250
|
+
format: "binary"
|
|
251
|
+
};
|
|
252
|
+
operation.parameters.push(param);
|
|
253
|
+
}
|
|
254
|
+
if (param.schema) {
|
|
255
|
+
this.convertSchema(param.schema, "request");
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
delete operation.requestBody;
|
|
259
|
+
}
|
|
260
|
+
this.convertParameters(operation);
|
|
261
|
+
}
|
|
262
|
+
convertParameters(obj) {
|
|
263
|
+
if (obj.parameters === undefined) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
obj.parameters = obj.parameters || [];
|
|
267
|
+
(obj.parameters || []).forEach((param, i) => {
|
|
268
|
+
param = obj.parameters[i] = this.resolveReference(this.spec, param, false);
|
|
269
|
+
if (param.in !== "body") {
|
|
270
|
+
this.copySchemaProperties(param, SCHEMA_PROPERTIES);
|
|
271
|
+
this.copySchemaProperties(param, ARRAY_PROPERTIES);
|
|
272
|
+
this.copySchemaXProperties(param);
|
|
273
|
+
if (!param.description) {
|
|
274
|
+
const schema = this.resolveReference(this.spec, param.schema, false);
|
|
275
|
+
if (!!schema && schema.description) {
|
|
276
|
+
param.description = schema.description;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (param.example !== undefined) {
|
|
280
|
+
param["x-example"] = param.example;
|
|
281
|
+
}
|
|
282
|
+
delete param.schema;
|
|
283
|
+
delete param.allowReserved;
|
|
284
|
+
delete param.example;
|
|
285
|
+
}
|
|
286
|
+
if (param.type === "array") {
|
|
287
|
+
let style = param.style || (param.in === "query" || param.in === "cookie" ? "form" : "simple");
|
|
288
|
+
switch (style) {
|
|
289
|
+
case "matrix":
|
|
290
|
+
param.collectionFormat = param.explode ? undefined : "csv";
|
|
291
|
+
break;
|
|
292
|
+
case "label":
|
|
293
|
+
param.collectionFormat = undefined;
|
|
294
|
+
break;
|
|
295
|
+
case "simple":
|
|
296
|
+
param.collectionFormat = "csv";
|
|
297
|
+
break;
|
|
298
|
+
case "spaceDelimited":
|
|
299
|
+
param.collectionFormat = "ssv";
|
|
300
|
+
break;
|
|
301
|
+
case "pipeDelimited":
|
|
302
|
+
param.collectionFormat = "pipes";
|
|
303
|
+
break;
|
|
304
|
+
case "deepOpbject":
|
|
305
|
+
param.collectionFormat = "multi";
|
|
306
|
+
break;
|
|
307
|
+
case "form":
|
|
308
|
+
param.collectionFormat = param.explode === false ? "csv" : "multi";
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
delete param.style;
|
|
313
|
+
delete param.explode;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
copySchemaProperties(obj, props) {
|
|
317
|
+
let schema = this.resolveReference(this.spec, obj.schema, true);
|
|
318
|
+
if (!schema) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
props.forEach((prop) => {
|
|
322
|
+
const value = schema[prop];
|
|
323
|
+
if (prop === "additionalProperties" && typeof value === "boolean") {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (value !== undefined) {
|
|
327
|
+
obj[prop] = value;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
copySchemaXProperties(obj) {
|
|
332
|
+
let schema = this.resolveReference(this.spec, obj.schema, true);
|
|
333
|
+
if (!schema) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
Object.keys(schema).forEach((propName) => {
|
|
337
|
+
if (Reflect.hasOwnProperty.call(schema, propName) && !Reflect.hasOwnProperty.call(obj, propName) && propName.startsWith("x-")) {
|
|
338
|
+
obj[propName] = schema[propName];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
convertResponses(operation) {
|
|
343
|
+
// var anySchema, code, content, jsonSchema, mediaRange, mediaType, response, resolved, headers
|
|
344
|
+
Object.keys(operation.responses || {}).forEach((code) => {
|
|
345
|
+
const response = (operation.responses[code] = this.resolveReference(this.spec, operation.responses[code], true));
|
|
346
|
+
if (response.content) {
|
|
347
|
+
let anySchema = null;
|
|
348
|
+
let jsonSchema = null;
|
|
349
|
+
Object.keys(response.content).forEach((mediaRange) => {
|
|
350
|
+
// produces and examples only allow media types, not ranges
|
|
351
|
+
// use application/octet-stream as a catch-all type
|
|
352
|
+
const mediaType = mediaRange.indexOf("*") < 0 ? mediaRange : "application/octet-stream";
|
|
353
|
+
if (!operation.produces) {
|
|
354
|
+
operation.produces = [mediaType];
|
|
355
|
+
}
|
|
356
|
+
else if (operation.produces.indexOf(mediaType) < 0) {
|
|
357
|
+
operation.produces.push(mediaType);
|
|
358
|
+
}
|
|
359
|
+
const content = response.content[mediaRange];
|
|
360
|
+
anySchema = anySchema || content.schema;
|
|
361
|
+
if (!jsonSchema && isJsonMimeType(mediaType)) {
|
|
362
|
+
jsonSchema = content.schema;
|
|
363
|
+
}
|
|
364
|
+
if (content.example) {
|
|
365
|
+
response.examples = response.examples || {};
|
|
366
|
+
response.examples[mediaType] = content.example;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
if (anySchema) {
|
|
370
|
+
response.schema = jsonSchema || anySchema;
|
|
371
|
+
const resolved = this.resolveReference(this.spec, response.schema, true);
|
|
372
|
+
if (resolved && response.schema.$ref && !response.schema.$ref.startsWith("#")) {
|
|
373
|
+
response.schema = resolved;
|
|
374
|
+
}
|
|
375
|
+
this.convertSchema(response.schema, "response");
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
Object.keys(response.headers || {}).forEach((header) => {
|
|
379
|
+
// Always resolve headers when converting to v2.
|
|
380
|
+
const resolved = this.resolveReference(this.spec, response.headers[header], true);
|
|
381
|
+
// Headers should be converted like parameters.
|
|
382
|
+
if (resolved.schema) {
|
|
383
|
+
resolved.type = resolved.schema.type;
|
|
384
|
+
resolved.format = resolved.schema.format;
|
|
385
|
+
delete resolved.schema;
|
|
386
|
+
}
|
|
387
|
+
response.headers[header] = resolved;
|
|
388
|
+
});
|
|
389
|
+
delete response.content;
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
convertSchema(def, operationDirection) {
|
|
393
|
+
if (def.oneOf) {
|
|
394
|
+
delete def.oneOf;
|
|
395
|
+
if (def.discriminator) {
|
|
396
|
+
delete def.discriminator;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (def.anyOf) {
|
|
400
|
+
delete def.anyOf;
|
|
401
|
+
if (def.discriminator) {
|
|
402
|
+
delete def.discriminator;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (def.allOf) {
|
|
406
|
+
for (const i in def.allOf) {
|
|
407
|
+
this.convertSchema(def.allOf[i], operationDirection);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (def.discriminator) {
|
|
411
|
+
if (def.discriminator.mapping) {
|
|
412
|
+
this.convertDiscriminatorMapping(def.discriminator.mapping);
|
|
413
|
+
}
|
|
414
|
+
def.discriminator = def.discriminator.propertyName;
|
|
415
|
+
}
|
|
416
|
+
switch (def.type) {
|
|
417
|
+
case "object":
|
|
418
|
+
if (def.properties) {
|
|
419
|
+
Object.keys(def.properties).forEach((propName) => {
|
|
420
|
+
if (def.properties[propName].writeOnly === true && operationDirection === "response") {
|
|
421
|
+
delete def.properties[propName];
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
this.convertSchema(def.properties[propName], operationDirection);
|
|
425
|
+
delete def.properties[propName].writeOnly;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
break;
|
|
430
|
+
case "array":
|
|
431
|
+
if (def.items) {
|
|
432
|
+
this.convertSchema(def.items, operationDirection);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (def.nullable) {
|
|
436
|
+
def["x-nullable"] = true;
|
|
437
|
+
delete def.nullable;
|
|
438
|
+
}
|
|
439
|
+
// OpenAPI 3 has boolean "deprecated" on Schema, OpenAPI 2 does not
|
|
440
|
+
// Convert to x-deprecated for Autorest (and perhaps others)
|
|
441
|
+
if (def["deprecated"] !== undefined) {
|
|
442
|
+
// Move to x-deprecated, unless it is already defined
|
|
443
|
+
if (def["x-deprecated"] === undefined) {
|
|
444
|
+
def["x-deprecated"] = def.deprecated;
|
|
445
|
+
}
|
|
446
|
+
delete def.deprecated;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
convertSchemas() {
|
|
450
|
+
this.spec.definitions = this.spec.components.schemas;
|
|
451
|
+
Object.keys(this.spec.definitions || {}).forEach((defName) => {
|
|
452
|
+
this.convertSchema(this.spec.definitions[defName]);
|
|
453
|
+
});
|
|
454
|
+
delete this.spec.components.schemas;
|
|
455
|
+
}
|
|
456
|
+
convertDiscriminatorMapping(mapping) {
|
|
457
|
+
Object.keys(mapping).forEach((payload) => {
|
|
458
|
+
const schemaNameOrRef = mapping[payload];
|
|
459
|
+
if (typeof schemaNameOrRef !== "string") {
|
|
460
|
+
console.warn(`Ignoring ${schemaNameOrRef} for ${payload} in discriminator.mapping.`);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
// payload may be a schema name or JSON Reference string.
|
|
464
|
+
// OAS3 spec limits schema names to ^[a-zA-Z0-9._-]+$
|
|
465
|
+
// Note: Valid schema name could be JSON file name without extension.
|
|
466
|
+
// Prefer schema name, with file name as fallback.
|
|
467
|
+
let schema;
|
|
468
|
+
if (/^[a-zA-Z0-9._-]+$/.test(schemaNameOrRef)) {
|
|
469
|
+
try {
|
|
470
|
+
schema = this.resolveReference(this.spec, { $ref: `#/components/schemas/${schemaNameOrRef}` }, false);
|
|
471
|
+
}
|
|
472
|
+
catch (err) {
|
|
473
|
+
console.debug(`Error resolving ${schemaNameOrRef} for ${payload} as schema name in discriminator.mapping: ${err}`);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
// schemaNameRef is not a schema name. Try to resolve as JSON Ref.
|
|
477
|
+
if (!schema) {
|
|
478
|
+
try {
|
|
479
|
+
schema = this.resolveReference(this.spec, { $ref: schemaNameOrRef }, false);
|
|
480
|
+
}
|
|
481
|
+
catch (err) {
|
|
482
|
+
console.debug(`Error resolving ${schemaNameOrRef} for ${payload} in discriminator.mapping: ${err}`);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (schema) {
|
|
486
|
+
// Swagger Codegen + OpenAPI Generator extension
|
|
487
|
+
// https://github.com/swagger-api/swagger-codegen/pull/4252
|
|
488
|
+
schema["x-discriminator-value"] = payload;
|
|
489
|
+
// AutoRest extension
|
|
490
|
+
// https://github.com/Azure/autorest/pull/474
|
|
491
|
+
schema["x-ms-discriminator-value"] = payload;
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
console.warn(`Unable to resolve ${schemaNameOrRef} for ${payload} in discriminator.mapping.`);
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
convertSecurityDefinitions() {
|
|
499
|
+
if (this.spec.components.securitySchemes) {
|
|
500
|
+
this.spec.securityDefinitions = transformSecurity(this.spec.components.securitySchemes);
|
|
501
|
+
delete this.spec.components.securitySchemes;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
exports.Converter = Converter;
|
|
506
|
+
function transformToOS2(spec) {
|
|
507
|
+
return new Converter(spec).convert();
|
|
508
|
+
}
|
|
509
|
+
exports.transformToOS2 = transformToOS2;
|
|
510
|
+
//# sourceMappingURL=transformToOS2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformToOS2.js","sourceRoot":"","sources":["../../../src/utils/transformToOS2.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,qCAAuC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ACF;YAED,mEAAmE;YACnE,IAAI,CAAC,MAAM,EAAE;gBACX,IAAI;oBACF,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAC,IAAI,EAAE,eAAe,EAAC,EAAE,KAAK,CAAC,CAAC;iBAC3E;gBAAC,OAAO,GAAG,EAAE;oBACZ,OAAO,CAAC,KAAK,CAAC,mBAAmB,eAAe,QAAQ,OAAO,8BAA8B,GAAG,EAAE,CAAC,CAAC;iBACrG;aACF;YAED,IAAI,MAAM,EAAE;gBACV,gDAAgD;gBAChD,2DAA2D;gBAC3D,MAAM,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC;gBAE1C,qBAAqB;gBACrB,6CAA6C;gBAC7C,MAAM,CAAC,0BAA0B,CAAC,GAAG,OAAO,CAAC;aAC9C;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,qBAAqB,eAAe,QAAQ,OAAO,4BAA4B,CAAC,CAAC;aAC/F;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,0BAA0B;QACxB,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE;YACxC,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;YACxF,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;SAC7C;IACH,CAAC;CACF;AA5cD,8BA4cC;AAED,SAAgB,cAAc,CAAC,IAAS;IACtC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACvC,CAAC;AAFD,wCAEC","sourcesContent":["\"use strict\";\nimport {OpenSpec2, OpenSpec3, OS3Operation} from \"@tsed/openspec\";\nimport {cleanObject} from \"@tsed/core\";\n\nconst HTTP_METHODS = [\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\", \"trace\"];\nconst SCHEMA_PROPERTIES = [\n \"format\",\n \"minimum\",\n \"maximum\",\n \"exclusiveMinimum\",\n \"exclusiveMaximum\",\n \"minLength\",\n \"maxLength\",\n \"multipleOf\",\n \"minItems\",\n \"maxItems\",\n \"uniqueItems\",\n \"minProperties\",\n \"maxProperties\",\n \"additionalProperties\",\n \"pattern\",\n \"enum\",\n \"default\"\n];\nconst ARRAY_PROPERTIES = [\"type\", \"items\"];\n\nconst APPLICATION_JSON_REGEX = /^(application\\/json|[^;\\/ \\t]+\\/[^;\\/ \\t]+[+]json)[ \\t]*(;.*)?$/;\nconst SUPPORTED_MIME_TYPES: Record<string, any> = {\n APPLICATION_X_WWW_URLENCODED: \"application/x-www-form-urlencoded\",\n MULTIPART_FORM_DATA: \"multipart/form-data\"\n};\n\nfunction fixRef(ref: string) {\n return ref.replace(\"#/components/schemas/\", \"#/definitions/\").replace(\"#/components/\", \"#/x-components/\");\n}\n\nfunction fixRefs(obj: any) {\n if (Array.isArray(obj)) {\n obj.forEach(fixRefs);\n } else if (typeof obj === \"object\") {\n for (let key in obj) {\n if (key === \"$ref\") {\n obj.$ref = fixRef(obj.$ref);\n } else {\n fixRefs(obj[key]);\n }\n }\n }\n}\n\nfunction isJsonMimeType(type: string) {\n return new RegExp(APPLICATION_JSON_REGEX, \"i\").test(type);\n}\n\nfunction getSupportedMimeTypes(content: any) {\n const MIME_VALUES = Object.keys(SUPPORTED_MIME_TYPES).map((key) => {\n return SUPPORTED_MIME_TYPES[key];\n });\n return Object.keys(content).filter((key) => {\n return MIME_VALUES.indexOf(key) > -1 || isJsonMimeType(key);\n });\n}\n\nexport function transformSecurity(securitySchemes: any) {\n function map(security: any) {\n const {scheme, type, name, bearerFormat, flows, ...props} = security;\n\n switch (type) {\n case \"http\":\n if (scheme === \"basic\") {\n return {\n ...props,\n type: scheme\n };\n }\n\n if (scheme === \"bearer\") {\n return {\n ...props,\n type: \"apiKey\",\n name: \"Authorization\",\n in: \"header\"\n };\n }\n break;\n case \"oauth2\":\n const flowName = Object.keys(flows)[0];\n const flow = flows[flowName];\n let flowType = flowName;\n\n if (flowType === \"clientCredentials\") {\n flowType = \"application\";\n } else if (flowType === \"authorizationCode\") {\n flowType = \"accessCode\";\n }\n\n return {\n type,\n flow: flowType,\n authorizationUrl: flow.authorizationUrl,\n tokenUrl: flow.tokenUrl,\n scopes: flow.scopes\n };\n }\n }\n\n return Object.entries(securitySchemes).reduce((securityDefinitions, [key, security]) => {\n return {\n ...securityDefinitions,\n [key]: map(security)\n };\n }, {});\n}\n\nexport function transformInformation(server: any) {\n let serverUrl = server.url;\n\n const variables = server[\"variables\"] || {};\n\n for (const variable in variables) {\n const variableObject = variables[variable] || {};\n if (variableObject[\"default\"]) {\n const re = RegExp(`{${variable}}`, \"g\");\n serverUrl = serverUrl.replace(re, variableObject[\"default\"]);\n }\n }\n\n const url = new URL(serverUrl);\n\n return {\n host: url.host ? url.host : undefined,\n basePath: url.pathname,\n schemes: url.protocol !== null ? [url.protocol.substring(0, url.protocol.length - 1)] : undefined\n };\n}\n\nexport class Converter {\n private spec: any;\n\n constructor(spec: Partial<OpenSpec3>) {\n this.spec = JSON.parse(JSON.stringify(spec));\n }\n\n convertInfos() {\n const server = this.spec.servers && this.spec.servers[0];\n\n if (server) {\n return transformInformation(server);\n }\n\n return {};\n }\n\n resolveReference(base: any, obj: any, shouldClone: boolean) {\n if (!obj || !obj.$ref) {\n return obj;\n }\n\n const ref: string = obj.$ref;\n\n if (ref.startsWith(\"#\")) {\n const keys = ref.split(\"/\").map((k) => k.replace(/~1/g, \"/\").replace(/~0/g, \"~\"));\n keys.shift();\n\n let cur = base;\n keys.forEach((k) => {\n cur = cur[k];\n });\n\n return shouldClone ? JSON.parse(JSON.stringify(cur)) : cur;\n }\n }\n\n convert() {\n const spec = {\n swagger: \"2.0\",\n ...this.convertInfos(),\n paths: this.spec.paths ? this.convertOperations(this.spec.paths, this.spec) : undefined\n };\n\n if (this.spec.components) {\n this.convertSchemas();\n this.convertSecurityDefinitions();\n\n this.spec[\"x-components\"] = this.spec.components;\n delete this.spec.components;\n\n fixRefs(this.spec);\n }\n\n delete this.spec.servers;\n delete this.spec.openapi;\n delete this.spec[\"x-components\"];\n\n return cleanObject({\n ...spec,\n ...this.spec\n });\n }\n\n convertOperations(paths: any, spec: any) {\n return Object.entries(paths).reduce((paths, [path, operation]) => {\n const pathObject = (paths[path] = this.resolveReference({...spec, paths}, operation, true));\n\n this.convertParameters(pathObject); // converts common parameters\n\n Object.keys(pathObject).forEach((method) => {\n if (HTTP_METHODS.indexOf(method) >= 0) {\n const operation = (pathObject[method] = this.resolveReference({...spec, paths}, pathObject[method], true));\n\n this.convertOperationParameters(operation);\n this.convertResponses(operation);\n }\n });\n\n return paths;\n }, paths);\n }\n\n convertOperationParameters(operation: OS3Operation) {\n let content, contentKey, mediaRanges, mediaTypes;\n operation.parameters = operation.parameters || [];\n\n if (operation.requestBody) {\n let param = this.resolveReference(this.spec, operation.requestBody, true);\n\n // fixing external $ref in body\n if (operation.requestBody.content) {\n const type = getSupportedMimeTypes(operation.requestBody.content)[0];\n const structuredObj: any = {content: {}};\n const data = operation.requestBody.content[type];\n\n if (data && data.schema && data.schema.$ref && !data.schema.$ref.startsWith(\"#\")) {\n param = this.resolveReference(this.spec, data.schema, true);\n structuredObj[\"content\"][`${type}`] = {schema: param};\n param = structuredObj;\n }\n }\n\n param.name = \"body\";\n content = param.content;\n\n if (content && Object.keys(content).length) {\n mediaRanges = Object.keys(content).filter((mediaRange) => mediaRange.indexOf(\"/\") > 0);\n mediaTypes = mediaRanges.filter((range) => range.indexOf(\"*\") < 0);\n contentKey = getSupportedMimeTypes(content)[0];\n\n delete param.content;\n\n if ([SUPPORTED_MIME_TYPES.APPLICATION_X_WWW_URLENCODED, SUPPORTED_MIME_TYPES.MULTIPART_FORM_DATA].includes(contentKey)) {\n (operation as any).consumes = mediaTypes;\n\n param.in = \"formData\";\n param.schema = content[contentKey].schema;\n param.schema = this.resolveReference(this.spec, param.schema, true);\n\n if (param.schema.type === \"object\" && param.schema.properties) {\n const required = param.schema.required || [];\n\n Object.keys(param.schema.properties).forEach((name) => {\n const schema = param.schema.properties[name];\n\n // readOnly properties should not be sent in requests\n if (!schema.readOnly) {\n const formDataParam: any = {\n name,\n in: \"formData\",\n schema\n };\n if (required.indexOf(name) >= 0) {\n formDataParam.required = true;\n }\n\n operation.parameters?.push(formDataParam);\n }\n });\n } else {\n operation.parameters.push(param);\n }\n } else if (contentKey) {\n (operation as any).consumes = mediaTypes;\n param.in = \"body\";\n param.schema = content[contentKey].schema;\n operation.parameters.push(param);\n } else if (mediaRanges) {\n (operation as any).consumes = mediaTypes || [\"application/octet-stream\"];\n param.in = \"body\";\n param.name = param.name || \"file\";\n delete param.type;\n\n param.schema = content[mediaRanges[0]].schema || {\n type: \"string\",\n format: \"binary\"\n };\n\n operation.parameters.push(param);\n }\n\n if (param.schema) {\n this.convertSchema(param.schema, \"request\");\n }\n }\n\n delete operation.requestBody;\n }\n this.convertParameters(operation);\n }\n\n convertParameters(obj: any) {\n if (obj.parameters === undefined) {\n return;\n }\n\n obj.parameters = obj.parameters || [];\n\n (obj.parameters || []).forEach((param: any, i: number) => {\n param = obj.parameters[i] = this.resolveReference(this.spec, param, false);\n\n if (param.in !== \"body\") {\n this.copySchemaProperties(param, SCHEMA_PROPERTIES);\n this.copySchemaProperties(param, ARRAY_PROPERTIES);\n this.copySchemaXProperties(param);\n\n if (!param.description) {\n const schema = this.resolveReference(this.spec, param.schema, false);\n if (!!schema && schema.description) {\n param.description = schema.description;\n }\n }\n\n if (param.example !== undefined) {\n param[\"x-example\"] = param.example;\n }\n\n delete param.schema;\n delete param.allowReserved;\n delete param.example;\n }\n\n if (param.type === \"array\") {\n let style = param.style || (param.in === \"query\" || param.in === \"cookie\" ? \"form\" : \"simple\");\n\n switch (style) {\n case \"matrix\":\n param.collectionFormat = param.explode ? undefined : \"csv\";\n break;\n case \"label\":\n param.collectionFormat = undefined;\n break;\n case \"simple\":\n param.collectionFormat = \"csv\";\n break;\n case \"spaceDelimited\":\n param.collectionFormat = \"ssv\";\n break;\n case \"pipeDelimited\":\n param.collectionFormat = \"pipes\";\n break;\n case \"deepOpbject\":\n param.collectionFormat = \"multi\";\n break;\n case \"form\":\n param.collectionFormat = param.explode === false ? \"csv\" : \"multi\";\n break;\n }\n }\n\n delete param.style;\n delete param.explode;\n });\n }\n\n copySchemaProperties(obj: any, props: any[]) {\n let schema = this.resolveReference(this.spec, obj.schema, true);\n\n if (!schema) {\n return;\n }\n\n props.forEach((prop) => {\n const value = schema[prop];\n\n if (prop === \"additionalProperties\" && typeof value === \"boolean\") {\n return;\n }\n\n if (value !== undefined) {\n obj[prop] = value;\n }\n });\n }\n\n copySchemaXProperties(obj: Record<string, any>) {\n let schema = this.resolveReference(this.spec, obj.schema, true);\n if (!schema) {\n return;\n }\n\n Object.keys(schema).forEach((propName) => {\n if (Reflect.hasOwnProperty.call(schema, propName) && !Reflect.hasOwnProperty.call(obj, propName) && propName.startsWith(\"x-\")) {\n obj[propName] = schema[propName];\n }\n });\n }\n\n convertResponses(operation: Record<string, any>) {\n // var anySchema, code, content, jsonSchema, mediaRange, mediaType, response, resolved, headers\n\n Object.keys(operation.responses || {}).forEach((code) => {\n const response = (operation.responses[code] = this.resolveReference(this.spec, operation.responses[code], true));\n\n if (response.content) {\n let anySchema: any = null;\n let jsonSchema: any = null;\n\n Object.keys(response.content).forEach((mediaRange) => {\n // produces and examples only allow media types, not ranges\n // use application/octet-stream as a catch-all type\n const mediaType = mediaRange.indexOf(\"*\") < 0 ? mediaRange : \"application/octet-stream\";\n\n if (!operation.produces) {\n operation.produces = [mediaType];\n } else if (operation.produces.indexOf(mediaType) < 0) {\n operation.produces.push(mediaType);\n }\n\n const content = response.content[mediaRange];\n anySchema = anySchema || content.schema;\n\n if (!jsonSchema && isJsonMimeType(mediaType)) {\n jsonSchema = content.schema;\n }\n\n if (content.example) {\n response.examples = response.examples || {};\n response.examples[mediaType] = content.example;\n }\n });\n\n if (anySchema) {\n response.schema = jsonSchema || anySchema;\n const resolved = this.resolveReference(this.spec, response.schema, true);\n\n if (resolved && response.schema.$ref && !response.schema.$ref.startsWith(\"#\")) {\n response.schema = resolved;\n }\n\n this.convertSchema(response.schema, \"response\");\n }\n }\n\n Object.keys(response.headers || {}).forEach((header) => {\n // Always resolve headers when converting to v2.\n const resolved = this.resolveReference(this.spec, response.headers[header], true);\n\n // Headers should be converted like parameters.\n if (resolved.schema) {\n resolved.type = resolved.schema.type;\n resolved.format = resolved.schema.format;\n delete resolved.schema;\n }\n\n response.headers[header] = resolved;\n });\n\n delete response.content;\n });\n }\n\n convertSchema(def: any, operationDirection?: any) {\n if (def.oneOf) {\n delete def.oneOf;\n\n if (def.discriminator) {\n delete def.discriminator;\n }\n }\n\n if (def.anyOf) {\n delete def.anyOf;\n\n if (def.discriminator) {\n delete def.discriminator;\n }\n }\n\n if (def.allOf) {\n for (const i in def.allOf) {\n this.convertSchema(def.allOf[i], operationDirection);\n }\n }\n\n if (def.discriminator) {\n if (def.discriminator.mapping) {\n this.convertDiscriminatorMapping(def.discriminator.mapping);\n }\n\n def.discriminator = def.discriminator.propertyName;\n }\n\n switch (def.type) {\n case \"object\":\n if (def.properties) {\n Object.keys(def.properties).forEach((propName) => {\n if (def.properties[propName].writeOnly === true && operationDirection === \"response\") {\n delete def.properties[propName];\n } else {\n this.convertSchema(def.properties[propName], operationDirection);\n delete def.properties[propName].writeOnly;\n }\n });\n }\n break;\n case \"array\":\n if (def.items) {\n this.convertSchema(def.items, operationDirection);\n }\n }\n\n if (def.nullable) {\n def[\"x-nullable\"] = true;\n delete def.nullable;\n }\n\n // OpenAPI 3 has boolean \"deprecated\" on Schema, OpenAPI 2 does not\n // Convert to x-deprecated for Autorest (and perhaps others)\n if (def[\"deprecated\"] !== undefined) {\n // Move to x-deprecated, unless it is already defined\n if (def[\"x-deprecated\"] === undefined) {\n def[\"x-deprecated\"] = def.deprecated;\n }\n delete def.deprecated;\n }\n }\n\n convertSchemas() {\n this.spec.definitions = this.spec.components.schemas;\n\n Object.keys(this.spec.definitions || {}).forEach((defName) => {\n this.convertSchema(this.spec.definitions[defName]);\n });\n\n delete this.spec.components.schemas;\n }\n\n convertDiscriminatorMapping(mapping: any) {\n Object.keys(mapping).forEach((payload) => {\n const schemaNameOrRef = mapping[payload];\n\n if (typeof schemaNameOrRef !== \"string\") {\n console.warn(`Ignoring ${schemaNameOrRef} for ${payload} in discriminator.mapping.`);\n return;\n }\n\n // payload may be a schema name or JSON Reference string.\n // OAS3 spec limits schema names to ^[a-zA-Z0-9._-]+$\n // Note: Valid schema name could be JSON file name without extension.\n // Prefer schema name, with file name as fallback.\n let schema;\n if (/^[a-zA-Z0-9._-]+$/.test(schemaNameOrRef)) {\n try {\n schema = this.resolveReference(this.spec, {$ref: `#/components/schemas/${schemaNameOrRef}`}, false);\n } catch (err) {\n console.debug(`Error resolving ${schemaNameOrRef} for ${payload} as schema name in discriminator.mapping: ${err}`);\n }\n }\n\n // schemaNameRef is not a schema name. Try to resolve as JSON Ref.\n if (!schema) {\n try {\n schema = this.resolveReference(this.spec, {$ref: schemaNameOrRef}, false);\n } catch (err) {\n console.debug(`Error resolving ${schemaNameOrRef} for ${payload} in discriminator.mapping: ${err}`);\n }\n }\n\n if (schema) {\n // Swagger Codegen + OpenAPI Generator extension\n // https://github.com/swagger-api/swagger-codegen/pull/4252\n schema[\"x-discriminator-value\"] = payload;\n\n // AutoRest extension\n // https://github.com/Azure/autorest/pull/474\n schema[\"x-ms-discriminator-value\"] = payload;\n } else {\n console.warn(`Unable to resolve ${schemaNameOrRef} for ${payload} in discriminator.mapping.`);\n }\n });\n }\n\n convertSecurityDefinitions() {\n if (this.spec.components.securitySchemes) {\n this.spec.securityDefinitions = transformSecurity(this.spec.components.securitySchemes);\n delete this.spec.components.securitySchemes;\n }\n }\n}\n\nexport function transformToOS2(spec: any): Partial<OpenSpec2> {\n return new Converter(spec).convert();\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JsonLazyRef } from "../domain/JsonLazyRef.js";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { mapGenericsOptions } from "../utils/generics.js";
|
|
4
|
+
import { toRef } from "../utils/ref.js";
|
|
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.js";
|
|
2
|
+
import { execMapper, registerJsonSchemaMapper } from "../registries/JsonSchemaMapperContainer.js";
|
|
3
|
+
import { mapGenericsOptions, popGenerics } from "../utils/generics.js";
|
|
4
|
+
import { createRef, createRefName } from "../utils/ref.js";
|
|
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,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";\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"]}
|