ts-openapi-codegen 2.0.0-beta.1 → 2.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/README.md +149 -103
- package/README.rus.md +149 -101
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +2 -1
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/checkConfig.js +14 -6
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +2 -1
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/updateConfig.js +13 -5
- package/dist/cli/{generate/runGenerateOpenApi.d.ts → generateOpenApiClient/generateOpenApiClient.d.ts} +2 -2
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -0
- package/dist/cli/{generate/runGenerateOpenApi.js → generateOpenApiClient/generateOpenApiClient.js} +31 -11
- package/dist/cli/index.js +29 -8
- package/dist/cli/initOpenApiConfig/Types.d.ts +4 -4
- package/dist/cli/initOpenApiConfig/Types.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/init.d.ts +6 -0
- package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/init.js +53 -0
- package/dist/cli/initOpenApiConfig/initConfig.d.ts +11 -0
- package/dist/cli/initOpenApiConfig/initConfig.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/initConfig.js +102 -0
- package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts +3 -0
- package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/initCustomRequest.js +23 -0
- package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts +21 -0
- package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/buildConfig.js +107 -0
- package/dist/cli/initOpenApiConfig/utils/findSpecFiles.d.ts +8 -0
- package/dist/cli/initOpenApiConfig/utils/findSpecFiles.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/findSpecFiles.js +40 -0
- package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts +3 -0
- package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.js +53 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts +7 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFile.js +23 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.d.ts +11 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFiles.js +24 -0
- package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts +11 -0
- package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/writeConfigFile.js +31 -0
- package/dist/cli/previewChanges/previewChanges.d.ts +8 -0
- package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -0
- package/dist/cli/previewChanges/previewChanges.js +189 -0
- package/dist/cli/previewChanges/utils/compareFiles.d.ts +6 -0
- package/dist/cli/previewChanges/utils/compareFiles.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/compareFiles.js +50 -0
- package/dist/cli/previewChanges/utils/formatDiff.d.ts +6 -0
- package/dist/cli/previewChanges/utils/formatDiff.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/formatDiff.js +30 -0
- package/dist/cli/previewChanges/utils/isDirectoryEmpty.d.ts +5 -0
- package/dist/cli/previewChanges/utils/isDirectoryEmpty.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/isDirectoryEmpty.js +17 -0
- package/dist/cli/previewChanges/utils/readDirectoryRecursive.d.ts +5 -0
- package/dist/cli/previewChanges/utils/readDirectoryRecursive.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/readDirectoryRecursive.js +28 -0
- package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts +10 -0
- package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/updateOutputPaths.js +106 -0
- package/dist/cli/schemas/base.d.ts +22 -0
- package/dist/cli/schemas/base.d.ts.map +1 -0
- package/dist/cli/schemas/base.js +23 -0
- package/dist/cli/schemas/checkConfig.d.ts +6 -0
- package/dist/cli/schemas/checkConfig.d.ts.map +1 -0
- package/dist/cli/schemas/checkConfig.js +5 -0
- package/dist/cli/schemas/generate.d.ts +8 -0
- package/dist/cli/schemas/generate.d.ts.map +1 -0
- package/dist/cli/schemas/generate.js +45 -0
- package/dist/cli/schemas/index.d.ts +8 -0
- package/dist/cli/schemas/index.d.ts.map +1 -0
- package/dist/cli/schemas/index.js +22 -0
- package/dist/cli/schemas/init.d.ts +10 -0
- package/dist/cli/schemas/init.d.ts.map +1 -0
- package/dist/cli/schemas/init.js +11 -0
- package/dist/cli/schemas/previewChanges.d.ts +9 -0
- package/dist/cli/schemas/previewChanges.d.ts.map +1 -0
- package/dist/cli/schemas/previewChanges.js +11 -0
- package/dist/cli/schemas/updateConfig.d.ts +6 -0
- package/dist/cli/schemas/updateConfig.d.ts.map +1 -0
- package/dist/cli/schemas/updateConfig.js +5 -0
- package/dist/common/Consts.d.ts +5 -0
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +9 -2
- package/dist/common/LoggerMessages.js +1 -1
- package/dist/common/TRawOptions.d.ts +4 -36
- package/dist/common/TRawOptions.d.ts.map +1 -1
- package/dist/common/Validation/formatZodError.d.ts +10 -0
- package/dist/common/Validation/formatZodError.d.ts.map +1 -0
- package/dist/common/Validation/formatZodError.js +114 -0
- package/dist/common/Validation/index.d.ts +3 -0
- package/dist/common/Validation/index.d.ts.map +1 -0
- package/dist/common/Validation/index.js +18 -0
- package/dist/common/Validation/validateZodOptions.d.ts +27 -0
- package/dist/common/Validation/validateZodOptions.d.ts.map +1 -0
- package/dist/common/Validation/validateZodOptions.js +35 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +10 -4
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +6 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +8 -8
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +28 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +25 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +37 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +37 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +38 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +34 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +40 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.js +36 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +65 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +31 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +53 -29
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +44 -62
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +9 -16
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +25 -5
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.js +34 -17
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +25 -5
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +28 -19
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +25 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +29 -2
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +25 -5
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +30 -14
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +23 -5
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +33 -18
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -2
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.js +18 -11
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +2 -5
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +22 -5
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.js +30 -12
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +22 -5
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.js +27 -13
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +22 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +28 -2
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +22 -5
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +31 -12
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -2
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.js +15 -9
- package/dist/common/VersionedSchema/Types.d.ts +5 -5
- package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts +16 -0
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +85 -0
- package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts +2 -0
- package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.js +23 -0
- package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts +2 -0
- package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +75 -0
- package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts +12 -0
- package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/buildVersionedSchema.js +13 -0
- package/dist/common/VersionedSchema/Utils/compareShapes.d.ts +16 -0
- package/dist/common/VersionedSchema/Utils/compareShapes.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/compareShapes.js +30 -0
- package/dist/common/VersionedSchema/Utils/createFieldTransformationMigration.d.ts +32 -0
- package/dist/common/VersionedSchema/Utils/createFieldTransformationMigration.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/createFieldTransformationMigration.js +40 -0
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +2 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +5 -5
- package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +2 -2
- package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +15 -7
- package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts +16 -0
- package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.js +23 -0
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts +2 -2
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +16 -3
- package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.js +19 -2
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +2 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +10 -9
- package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +4 -0
- package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -0
- package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.js +43 -0
- package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts +4 -0
- package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts.map +1 -0
- package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.js +21 -0
- package/dist/common/defaultOptions.d.ts.map +1 -1
- package/dist/common/defaultOptions.js +2 -1
- package/dist/common/utils/__tests__/convertArrayToObject.test.js +5 -6
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
- package/dist/common/utils/convertArrayToObject.js +1 -2
- package/dist/common/utils/fileSystemHelpers.d.ts +3 -1
- package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -1
- package/dist/common/utils/fileSystemHelpers.js +3 -0
- package/dist/core/Context.d.ts +25 -2
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +144 -4
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +54 -13
- package/dist/core/WriteClient.d.ts +6 -13
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +32 -22
- package/dist/core/__tests__/WriteClient.test.js +7 -2
- package/dist/core/api/v2/Parser.d.ts +1 -1
- package/dist/core/api/v2/Parser.d.ts.map +1 -1
- package/dist/core/api/v2/Parser.js +2 -2
- package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModel.js +2 -5
- package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModelProperties.js +1 -3
- package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModels.js +2 -4
- package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationParameter.js +2 -5
- package/dist/core/api/v2/parser/getOperationParameters.js +1 -1
- package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponse.js +1 -3
- package/dist/core/api/v2/parser/getOperationResponses.js +1 -1
- package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getServices.js +4 -3
- package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getType.js +16 -9
- package/dist/core/api/v3/Parser.d.ts +1 -1
- package/dist/core/api/v3/Parser.d.ts.map +1 -1
- package/dist/core/api/v3/Parser.js +2 -2
- package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModel.js +2 -5
- package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModelProperties.js +1 -3
- package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModels.js +2 -4
- package/dist/core/api/v3/parser/getOperation.js +1 -1
- package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationParameter.js +2 -5
- package/dist/core/api/v3/parser/getOperationParameters.js +1 -1
- package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationRequestBody.js +1 -3
- package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponse.js +1 -3
- package/dist/core/api/v3/parser/getOperationResponses.js +1 -1
- package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getServices.js +4 -3
- package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getType.js +16 -9
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/types/base/ClientArtifacts.model.d.ts +1 -1
- package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +1 -1
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/Templates.model.d.ts +32 -0
- package/dist/core/types/base/Templates.model.d.ts.map +1 -0
- package/dist/core/types/enums/ValidationLibrary.enum.d.ts +8 -0
- package/dist/core/types/enums/ValidationLibrary.enum.d.ts.map +1 -0
- package/dist/core/types/enums/ValidationLibrary.enum.js +11 -0
- package/dist/core/utils/__mocks__/templates.d.ts +1 -1
- package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
- package/dist/core/utils/__mocks__/templates.js +5 -1
- package/dist/core/utils/__tests__/getRelativeModelPath.test.js +9 -3
- package/dist/core/utils/__tests__/isSubdirectory.test.js +2 -2
- package/dist/core/utils/__tests__/modelHelpers.test.d.ts +2 -0
- package/dist/core/utils/__tests__/modelHelpers.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/modelHelpers.test.js +151 -0
- package/dist/core/utils/__tests__/postProcessModelImports.test.d.ts +2 -0
- package/dist/core/utils/__tests__/postProcessModelImports.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/postProcessModelImports.test.js +67 -0
- package/dist/core/utils/__tests__/postProcessServiceImports.test.d.ts +2 -0
- package/dist/core/utils/__tests__/postProcessServiceImports.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/postProcessServiceImports.test.js +26 -0
- package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +2 -0
- package/dist/core/utils/__tests__/resolveRefPath.test.d.ts +2 -0
- package/dist/core/utils/__tests__/resolveRefPath.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/resolveRefPath.test.js +22 -0
- package/dist/core/utils/__tests__/serviceHelpers.test.d.ts +2 -0
- package/dist/core/utils/__tests__/serviceHelpers.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/serviceHelpers.test.js +121 -0
- package/dist/core/utils/__tests__/writeClientExecutor.test.d.ts +2 -0
- package/dist/core/utils/__tests__/writeClientExecutor.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/writeClientExecutor.test.js +20 -0
- package/dist/core/utils/__tests__/writeClientSchemas.test.js +2 -0
- package/dist/core/utils/getOpenApiSpec.d.ts +0 -6
- package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +26 -23
- package/dist/core/utils/modelHelpers.d.ts.map +1 -1
- package/dist/core/utils/modelHelpers.js +37 -3
- package/dist/core/utils/postProcessModelImports.d.ts.map +1 -1
- package/dist/core/utils/postProcessModelImports.js +14 -1
- package/dist/core/utils/postProcessServiceImports.d.ts.map +1 -1
- package/dist/core/utils/postProcessServiceImports.js +1 -2
- package/dist/core/utils/precompileTemplates.js +7 -0
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +85 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts +3 -27
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +97 -6
- package/dist/core/utils/resolveRefPath.d.ts.map +1 -1
- package/dist/core/utils/resolveRefPath.js +1 -4
- package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
- package/dist/core/utils/serviceHelpers.js +32 -6
- package/dist/core/utils/stripNamespace.js +1 -1
- package/dist/core/utils/validateRawOptions.d.ts +3 -0
- package/dist/core/utils/validateRawOptions.d.ts.map +1 -0
- package/dist/core/utils/validateRawOptions.js +15 -0
- package/dist/core/utils/writeClientCore.d.ts +1 -1
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +7 -4
- package/dist/core/utils/writeClientCoreIndex.d.ts +1 -1
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientExecutor.d.ts +13 -0
- package/dist/core/utils/writeClientExecutor.d.ts.map +1 -0
- package/dist/core/utils/writeClientExecutor.js +30 -0
- package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientFullIndex.js +1 -1
- package/dist/core/utils/writeClientModels.d.ts +1 -1
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModelsIndex.d.ts +1 -1
- package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.d.ts +3 -1
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +23 -20
- package/dist/core/utils/writeClientSchemasIndex.d.ts +1 -1
- package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.d.ts +1 -1
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServicesIndex.d.ts +1 -1
- package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSimpleIndex.js +1 -1
- package/dist/templatesCompiled/cli/customRequest.d.ts +11 -0
- package/dist/templatesCompiled/cli/customRequest.d.ts.map +1 -0
- package/dist/templatesCompiled/cli/customRequest.js +27 -0
- package/dist/templatesCompiled/cli/customRequestExecutor.d.ts +11 -0
- package/dist/templatesCompiled/cli/customRequestExecutor.d.ts.map +1 -0
- package/dist/templatesCompiled/cli/customRequestExecutor.js +27 -0
- package/dist/templatesCompiled/cli/openApiConfig.d.ts +2 -1
- package/dist/templatesCompiled/cli/openApiConfig.d.ts.map +1 -1
- package/dist/templatesCompiled/cli/openApiConfig.js +76 -4
- package/dist/templatesCompiled/client/core/ApiError.js +1 -1
- package/dist/templatesCompiled/client/core/CancelablePromise.d.ts +1 -0
- package/dist/templatesCompiled/client/core/CancelablePromise.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/CancelablePromise.js +9 -2
- package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts +1 -0
- package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/HttpStatusCode.js +9 -2
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts +12 -0
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.js +32 -0
- package/dist/templatesCompiled/client/core/{legacy-request-adapter.d.ts → executor/requestExecutor.d.ts} +1 -1
- package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/executor/requestExecutor.js +18 -0
- package/dist/templatesCompiled/client/core/functions/catchErrors.js +1 -1
- package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts +8 -0
- package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.js +18 -0
- package/dist/templatesCompiled/client/core/{request-executor.d.ts → interceptors/interceptors.d.ts} +2 -1
- package/dist/templatesCompiled/client/core/interceptors/interceptors.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/interceptors/interceptors.js +18 -0
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts +8 -0
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +18 -0
- package/dist/templatesCompiled/client/exportClient.d.ts +10 -0
- package/dist/templatesCompiled/client/exportClient.d.ts.map +1 -0
- package/dist/templatesCompiled/client/exportClient.js +53 -0
- package/dist/templatesCompiled/client/exportService.js +1 -1
- package/dist/templatesCompiled/client/indexCore.js +2 -2
- package/dist/templatesCompiled/client/indexFull.d.ts +13 -9
- package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexFull.js +72 -46
- package/dist/templatesCompiled/client/indexSimple.d.ts +1 -0
- package/dist/templatesCompiled/client/indexSimple.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexSimple.js +5 -1
- package/dist/templatesCompiled/client/joi/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/joi/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/exportSchema.js +71 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchema.js +129 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.d.ts +16 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaArray.js +84 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.d.ts +18 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.js +96 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.d.ts +14 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaDictionary.js +72 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.d.ts +14 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaEnum.js +74 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts +35 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.js +201 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts +14 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.js +50 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/joi/partials/joiSchemaReference.js +25 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.js +69 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.js +129 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.d.ts +16 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.js +74 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.d.ts +16 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.js +84 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.d.ts +13 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.js +56 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.d.ts +12 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum.js +49 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.d.ts +29 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaGeneric.js +175 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts +15 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.js +63 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaReference.js +25 -0
- package/dist/templatesCompiled/client/partials/exportComposition.d.ts +2 -0
- package/dist/templatesCompiled/client/partials/exportComposition.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/exportComposition.js +17 -9
- package/dist/templatesCompiled/client/partials/parameters.js +1 -1
- package/dist/templatesCompiled/client/partials/serviceOption.d.ts +2 -4
- package/dist/templatesCompiled/client/partials/serviceOption.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/serviceOption.js +32 -46
- package/dist/templatesCompiled/client/yup/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/yup/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/exportSchema.js +73 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchema.js +129 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.d.ts +16 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaArray.js +84 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.d.ts +18 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.js +96 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.d.ts +14 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaDictionary.js +72 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.d.ts +14 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaEnum.js +74 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts +34 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.js +201 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts +14 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.js +50 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/yup/partials/yupSchemaReference.js +25 -0
- package/dist/templatesCompiled/client/zod/exportSchema.d.ts +11 -0
- package/dist/templatesCompiled/client/zod/exportSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/exportSchema.js +67 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchema.d.ts +22 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchema.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchema.js +129 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts +14 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.js +65 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts +15 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.js +70 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts +12 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.js +53 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.d.ts +15 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaEnum.js +86 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts +34 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.js +193 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts +14 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.js +50 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.d.ts +9 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.d.ts.map +1 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaReference.js +25 -0
- package/package.json +9 -4
- package/dist/cli/generate/runGenerateOpenApi.d.ts.map +0 -1
- package/dist/cli/initOpenApiConfig/Enums.d.ts +0 -5
- package/dist/cli/initOpenApiConfig/Enums.d.ts.map +0 -1
- package/dist/cli/initOpenApiConfig/Enums.js +0 -8
- package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts +0 -3
- package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts.map +0 -1
- package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.js +0 -70
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts +0 -3
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts.map +0 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.js +0 -28
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts +0 -7
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts.map +0 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.js +0 -42
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts.map +0 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.js +0 -10
- package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts +0 -6
- package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts.map +0 -1
- package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.js +0 -7
- package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts +0 -6
- package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts.map +0 -1
- package/dist/common/VersionedSchema/Utils/joiHandlers.js +0 -59
- package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts.map +0 -1
- package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.js +0 -12
- package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts +0 -3
- package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts.map +0 -1
- package/dist/common/VersionedSchema/Utils/traverseObjectStructure.js +0 -31
- package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts +0 -19
- package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
- package/dist/common/utils/__tests__/__mock__/mockJoiSchema.js +0 -14
- package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts +0 -2
- package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
- package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.js +0 -38
- package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts +0 -2
- package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
- package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.js +0 -20
- package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts +0 -2
- package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
- package/dist/common/utils/__tests__/mergeObjectSchemas.test.js +0 -35
- package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts +0 -2
- package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
- package/dist/common/utils/__tests__/migrationForMultiOptions.test.js +0 -112
- package/dist/common/utils/__tests__/migrationForOptions.test.d.ts +0 -2
- package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +0 -1
- package/dist/common/utils/__tests__/migrationForOptions.test.js +0 -56
- package/dist/core/types/base/RefWithtype.model.d.ts +0 -11
- package/dist/core/types/base/RefWithtype.model.d.ts.map +0 -1
- package/dist/core/types/enums/TypeRef.enum.d.ts +0 -8
- package/dist/core/types/enums/TypeRef.enum.d.ts.map +0 -1
- package/dist/core/types/enums/TypeRef.enum.js +0 -11
- package/dist/core/utils/__tests__/getGatheringRefs.test.d.ts +0 -2
- package/dist/core/utils/__tests__/getGatheringRefs.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/getGatheringRefs.test.js +0 -26
- package/dist/core/utils/__tests__/getRefFromSchema.test.d.ts +0 -2
- package/dist/core/utils/__tests__/getRefFromSchema.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/getRefFromSchema.test.js +0 -167
- package/dist/core/utils/__tests__/refResolver.test.d.ts +0 -2
- package/dist/core/utils/__tests__/refResolver.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/refResolver.test.js +0 -55
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts +0 -2
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +0 -376
- package/dist/core/utils/advancedDeduplicatePath.d.ts +0 -5
- package/dist/core/utils/advancedDeduplicatePath.d.ts.map +0 -1
- package/dist/core/utils/advancedDeduplicatePath.js +0 -29
- package/dist/core/utils/findCommonParent.d.ts +0 -7
- package/dist/core/utils/findCommonParent.d.ts.map +0 -1
- package/dist/core/utils/findCommonParent.js +0 -20
- package/dist/core/utils/getGatheringRefs.d.ts +0 -4
- package/dist/core/utils/getGatheringRefs.d.ts.map +0 -1
- package/dist/core/utils/getGatheringRefs.js +0 -68
- package/dist/core/utils/getRefFromSchema.d.ts +0 -3
- package/dist/core/utils/getRefFromSchema.d.ts.map +0 -1
- package/dist/core/utils/getRefFromSchema.js +0 -9
- package/dist/core/utils/isBoolean.d.ts +0 -2
- package/dist/core/utils/isBoolean.d.ts.map +0 -1
- package/dist/core/utils/isBoolean.js +0 -12
- package/dist/core/utils/isFileName.d.ts +0 -7
- package/dist/core/utils/isFileName.d.ts.map +0 -1
- package/dist/core/utils/isFileName.js +0 -30
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts +0 -10
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +0 -1
- package/dist/core/utils/mapPathToTargetDirSafe.js +0 -48
- package/dist/core/utils/normalizeAllRefs.d.ts +0 -6
- package/dist/core/utils/normalizeAllRefs.d.ts.map +0 -1
- package/dist/core/utils/normalizeAllRefs.js +0 -35
- package/dist/core/utils/resolveRefToImportPath.d.ts +0 -13
- package/dist/core/utils/resolveRefToImportPath.d.ts.map +0 -1
- package/dist/core/utils/resolveRefToImportPath.js +0 -105
- package/dist/templatesCompiled/client/core/legacy-request-adapter.d.ts.map +0 -1
- package/dist/templatesCompiled/client/core/legacy-request-adapter.js +0 -18
- package/dist/templatesCompiled/client/core/request-executor.d.ts.map +0 -1
- package/dist/templatesCompiled/client/core/request-executor.js +0 -11
- /package/dist/core/types/base/{RefWithtype.model.js → Templates.model.js} +0 -0
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const node_assert_1 = require("node:assert");
|
|
4
|
-
const node_test_1 = require("node:test");
|
|
5
|
-
const fileSystemHelpers_1 = require("../../../common/utils/fileSystemHelpers");
|
|
6
|
-
const Consts_1 = require("../../types/Consts");
|
|
7
|
-
const resolveRefToImportPath_1 = require("../resolveRefToImportPath");
|
|
8
|
-
// Normalization of paths for cross-platform
|
|
9
|
-
const normalizePath = (p) => p.replace(Consts_1.REGEX_BACKSLASH, '/');
|
|
10
|
-
(0, node_test_1.describe)('@unit resolveRefToImportPath — correctly resolves links to components', () => {
|
|
11
|
-
const mainSpecPath = '/Users/user/Developer/my_app/openapi/app/openapi_spec.yaml';
|
|
12
|
-
const outputModelsPath = '/Users/user/Developer/openapi-codegen/generated/account/models';
|
|
13
|
-
const originalIsDirectory = fileSystemHelpers_1.fileSystemHelpers.isDirectory;
|
|
14
|
-
const originalIsPathToFile = fileSystemHelpers_1.fileSystemHelpers.isPathToFile;
|
|
15
|
-
(0, node_test_1.beforeEach)(() => {
|
|
16
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn(() => false);
|
|
17
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn(() => true);
|
|
18
|
-
});
|
|
19
|
-
(0, node_test_1.afterEach)(() => {
|
|
20
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = originalIsDirectory;
|
|
21
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = originalIsPathToFile;
|
|
22
|
-
});
|
|
23
|
-
(0, node_test_1.describe)('HTTP_URL', () => {
|
|
24
|
-
(0, node_test_1.test)('http URL → returns URL as is', () => {
|
|
25
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
26
|
-
mainSpecPath,
|
|
27
|
-
parentFilePath: mainSpecPath,
|
|
28
|
-
refValuePath: 'http://example.com/schema.json',
|
|
29
|
-
outputModelsPath,
|
|
30
|
-
});
|
|
31
|
-
node_assert_1.strict.equal(result, 'http://example.com/schema.json');
|
|
32
|
-
});
|
|
33
|
-
(0, node_test_1.test)('https URL → returns URL as is', () => {
|
|
34
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
35
|
-
mainSpecPath,
|
|
36
|
-
parentFilePath: mainSpecPath,
|
|
37
|
-
refValuePath: 'https://api.example.com/schemas/user.yaml',
|
|
38
|
-
outputModelsPath,
|
|
39
|
-
});
|
|
40
|
-
node_assert_1.strict.equal(result, 'https://api.example.com/schemas/user.yaml');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
(0, node_test_1.describe)('LOCAL_FRAGMENT', () => {
|
|
44
|
-
(0, node_test_1.test)('internal link in the child file → path to the model by schema name', () => {
|
|
45
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
46
|
-
mainSpecPath,
|
|
47
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml#/components/schemas/AccountField',
|
|
48
|
-
refValuePath: '#/components/schemas/AccountField',
|
|
49
|
-
outputModelsPath,
|
|
50
|
-
});
|
|
51
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/AccountField');
|
|
52
|
-
});
|
|
53
|
-
(0, node_test_1.test)('internal link in the main file → model in the root output', () => {
|
|
54
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
55
|
-
mainSpecPath,
|
|
56
|
-
parentFilePath: mainSpecPath,
|
|
57
|
-
refValuePath: '#/components/schemas/MainUser',
|
|
58
|
-
outputModelsPath,
|
|
59
|
-
});
|
|
60
|
-
node_assert_1.strict.equal(normalizePath(result), './MainUser');
|
|
61
|
-
});
|
|
62
|
-
(0, node_test_1.test)('internal link without parentFilePath → uses mainSpecPath', () => {
|
|
63
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
64
|
-
mainSpecPath,
|
|
65
|
-
parentFilePath: '',
|
|
66
|
-
refValuePath: '#/components/schemas/MainUser',
|
|
67
|
-
outputModelsPath,
|
|
68
|
-
});
|
|
69
|
-
node_assert_1.strict.equal(normalizePath(result), './MainUser');
|
|
70
|
-
});
|
|
71
|
-
(0, node_test_1.test)('embedded internal link → folder structure is saved', () => {
|
|
72
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
73
|
-
mainSpecPath,
|
|
74
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/nested/admin/schemas.yaml#/components/schemas/AdminUser',
|
|
75
|
-
refValuePath: '#/components/schemas/AdminUser',
|
|
76
|
-
outputModelsPath,
|
|
77
|
-
});
|
|
78
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/nested/admin/AdminUser');
|
|
79
|
-
});
|
|
80
|
-
(0, node_test_1.test)('deep nesting — the path is built correctly', () => {
|
|
81
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
82
|
-
mainSpecPath,
|
|
83
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/very/deep/config/models.yaml#/components/schemas/ConfigDto',
|
|
84
|
-
refValuePath: '#/components/schemas/ConfigDto',
|
|
85
|
-
outputModelsPath,
|
|
86
|
-
});
|
|
87
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/very/deep/config/ConfigDto');
|
|
88
|
-
});
|
|
89
|
-
(0, node_test_1.test)('LOCAL_FRAGMENT with responses component', () => {
|
|
90
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
91
|
-
mainSpecPath,
|
|
92
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
93
|
-
refValuePath: '#/components/responses/ErrorResponse',
|
|
94
|
-
outputModelsPath,
|
|
95
|
-
});
|
|
96
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/ErrorResponse');
|
|
97
|
-
});
|
|
98
|
-
(0, node_test_1.test)('LOCAL_FRAGMENT with parameters component', () => {
|
|
99
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
100
|
-
mainSpecPath,
|
|
101
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
102
|
-
refValuePath: '#/components/parameters/PageParam',
|
|
103
|
-
outputModelsPath,
|
|
104
|
-
});
|
|
105
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/PageParam');
|
|
106
|
-
});
|
|
107
|
-
(0, node_test_1.test)('LOCAL_FRAGMENT with mainSpecPath as directory', () => {
|
|
108
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn(() => true);
|
|
109
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn(() => false);
|
|
110
|
-
const mainSpecDir = '/Users/user/Developer/my_app/openapi/app';
|
|
111
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
112
|
-
mainSpecPath: mainSpecDir,
|
|
113
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
114
|
-
refValuePath: '#/components/schemas/AccountField',
|
|
115
|
-
outputModelsPath,
|
|
116
|
-
});
|
|
117
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/AccountField');
|
|
118
|
-
});
|
|
119
|
-
(0, node_test_1.test)('LOCAL_FRAGMENT when mapPathToTargetDirSafe maps correctly → returns relative path', () => {
|
|
120
|
-
// Even with different output path, mapPathToTargetDirSafe finds common parent
|
|
121
|
-
// and maps the path, so function returns relative path, not fallback
|
|
122
|
-
const externalOutputPath = '/Users/user/Developer/other_project/generated/models';
|
|
123
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
124
|
-
mainSpecPath,
|
|
125
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
126
|
-
refValuePath: '#/components/schemas/AccountField',
|
|
127
|
-
outputModelsPath: externalOutputPath,
|
|
128
|
-
});
|
|
129
|
-
// The path is still mapped correctly via common parent
|
|
130
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/AccountField');
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
(0, node_test_1.describe)('EXTERNAL_FILE_FRAGMENT', () => {
|
|
134
|
-
(0, node_test_1.test)('external file with fragment → resolves to correct model path', () => {
|
|
135
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
136
|
-
mainSpecPath,
|
|
137
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
138
|
-
refValuePath: './users-list.yaml#/components/schemas/UserList',
|
|
139
|
-
outputModelsPath,
|
|
140
|
-
});
|
|
141
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/UserList');
|
|
142
|
-
});
|
|
143
|
-
(0, node_test_1.test)('external file fragment with nested path', () => {
|
|
144
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
145
|
-
mainSpecPath,
|
|
146
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
147
|
-
refValuePath: '../shared/common.yaml#/components/schemas/CommonModel',
|
|
148
|
-
outputModelsPath,
|
|
149
|
-
});
|
|
150
|
-
// Should resolve relative to parent file directory
|
|
151
|
-
const normalized = normalizePath(result);
|
|
152
|
-
node_assert_1.strict.ok(normalized.includes('CommonModel') || normalized.includes('common'));
|
|
153
|
-
});
|
|
154
|
-
(0, node_test_1.test)('external file fragment without parentFilePath', () => {
|
|
155
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
156
|
-
mainSpecPath,
|
|
157
|
-
parentFilePath: '',
|
|
158
|
-
refValuePath: './shared/models.yaml#/components/schemas/SharedModel',
|
|
159
|
-
outputModelsPath,
|
|
160
|
-
});
|
|
161
|
-
const normalized = normalizePath(result);
|
|
162
|
-
node_assert_1.strict.ok(normalized.includes('SharedModel') || normalized.includes('shared'));
|
|
163
|
-
});
|
|
164
|
-
(0, node_test_1.test)('external file fragment with responses component', () => {
|
|
165
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
166
|
-
mainSpecPath,
|
|
167
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
168
|
-
refValuePath: './responses.yaml#/components/responses/ApiResponse',
|
|
169
|
-
outputModelsPath,
|
|
170
|
-
});
|
|
171
|
-
const normalized = normalizePath(result);
|
|
172
|
-
node_assert_1.strict.ok(normalized.includes('ApiResponse') || normalized.includes('spec'));
|
|
173
|
-
});
|
|
174
|
-
(0, node_test_1.test)('EXTERNAL_FILE_FRAGMENT when path is outside outputModelsPath → returns fallback', () => {
|
|
175
|
-
const externalOutputPath = '/Users/user/Developer/other_project/generated/models';
|
|
176
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
177
|
-
mainSpecPath,
|
|
178
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
179
|
-
refValuePath: './users-list.yaml#/components/schemas/UserList',
|
|
180
|
-
outputModelsPath: externalOutputPath,
|
|
181
|
-
});
|
|
182
|
-
// mapPathToTargetDirSafe finds common parent and still maps the path,
|
|
183
|
-
// so it returns relative path instead of fallback
|
|
184
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/UserList');
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
(0, node_test_1.describe)('EXTERNAL_FILE', () => {
|
|
188
|
-
(0, node_test_1.test)('external link to the file → correct name via getClassName', () => {
|
|
189
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
190
|
-
mainSpecPath,
|
|
191
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
192
|
-
refValuePath: './users-list.yaml',
|
|
193
|
-
outputModelsPath,
|
|
194
|
-
});
|
|
195
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/UsersList');
|
|
196
|
-
});
|
|
197
|
-
(0, node_test_1.test)('the link to the file without the extension → is processed correctly', () => {
|
|
198
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
199
|
-
mainSpecPath,
|
|
200
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/shared.yaml',
|
|
201
|
-
refValuePath: './common/error',
|
|
202
|
-
outputModelsPath,
|
|
203
|
-
});
|
|
204
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/common/Error');
|
|
205
|
-
});
|
|
206
|
-
(0, node_test_1.test)('external file with relative path up directory', () => {
|
|
207
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
208
|
-
mainSpecPath,
|
|
209
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/nested/accountSpec.yaml',
|
|
210
|
-
refValuePath: '../shared/common.yaml',
|
|
211
|
-
outputModelsPath,
|
|
212
|
-
});
|
|
213
|
-
const normalized = normalizePath(result);
|
|
214
|
-
node_assert_1.strict.ok(normalized.includes('Common') || normalized.includes('spec/shared'));
|
|
215
|
-
});
|
|
216
|
-
(0, node_test_1.test)('external file with absolute path', () => {
|
|
217
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
218
|
-
mainSpecPath,
|
|
219
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
220
|
-
refValuePath: '/Users/user/Developer/my_app/openapi/shared/models.yaml',
|
|
221
|
-
outputModelsPath,
|
|
222
|
-
});
|
|
223
|
-
const normalized = normalizePath(result);
|
|
224
|
-
// Absolute paths are handled in default case
|
|
225
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
226
|
-
});
|
|
227
|
-
(0, node_test_1.test)('EXTERNAL_FILE when path is outside outputModelsPath → returns fallback', () => {
|
|
228
|
-
const externalOutputPath = '/Users/user/Developer/other_project/generated/models';
|
|
229
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
230
|
-
mainSpecPath,
|
|
231
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
232
|
-
refValuePath: './users-list.yaml',
|
|
233
|
-
outputModelsPath: externalOutputPath,
|
|
234
|
-
});
|
|
235
|
-
// mapPathToTargetDirSafe finds common parent and still maps the path,
|
|
236
|
-
// so it returns relative path instead of fallback
|
|
237
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/UsersList');
|
|
238
|
-
});
|
|
239
|
-
(0, node_test_1.test)('external file reference from main spec file', () => {
|
|
240
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
241
|
-
mainSpecPath,
|
|
242
|
-
parentFilePath: mainSpecPath,
|
|
243
|
-
refValuePath: './schemas/user.yaml',
|
|
244
|
-
outputModelsPath,
|
|
245
|
-
});
|
|
246
|
-
const normalized = normalizePath(result);
|
|
247
|
-
node_assert_1.strict.ok(normalized.includes('User') || normalized === './User');
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
(0, node_test_1.describe)('ABSOLUTE_PATH (default case)', () => {
|
|
251
|
-
(0, node_test_1.test)('absolute path to file → resolves correctly', () => {
|
|
252
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
253
|
-
mainSpecPath,
|
|
254
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
255
|
-
refValuePath: '/Users/user/Developer/my_app/openapi/shared/models/user.yaml',
|
|
256
|
-
outputModelsPath,
|
|
257
|
-
});
|
|
258
|
-
const normalized = normalizePath(result);
|
|
259
|
-
node_assert_1.strict.ok(typeof normalized === 'string' && normalized.length > 0);
|
|
260
|
-
});
|
|
261
|
-
(0, node_test_1.test)('absolute path when isPathToFile returns true', () => {
|
|
262
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn(() => false);
|
|
263
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn((path) => {
|
|
264
|
-
return path.includes('user.yaml');
|
|
265
|
-
});
|
|
266
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
267
|
-
mainSpecPath,
|
|
268
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
269
|
-
refValuePath: '/Users/user/Developer/my_app/openapi/shared/models/user.yaml',
|
|
270
|
-
outputModelsPath,
|
|
271
|
-
});
|
|
272
|
-
const normalized = normalizePath(result);
|
|
273
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
274
|
-
});
|
|
275
|
-
(0, node_test_1.test)('absolute path when isPathToFile returns false (directory)', () => {
|
|
276
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn((path) => {
|
|
277
|
-
return path.includes('models');
|
|
278
|
-
});
|
|
279
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn(() => false);
|
|
280
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
281
|
-
mainSpecPath,
|
|
282
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
283
|
-
refValuePath: '/Users/user/Developer/my_app/openapi/shared/models',
|
|
284
|
-
outputModelsPath,
|
|
285
|
-
});
|
|
286
|
-
const normalized = normalizePath(result);
|
|
287
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
288
|
-
});
|
|
289
|
-
(0, node_test_1.test)('absolute path when path is outside outputModelsPath → returns fallback', () => {
|
|
290
|
-
const externalOutputPath = '/Users/user/Developer/other_project/generated/models';
|
|
291
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn(() => false);
|
|
292
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn(() => true);
|
|
293
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
294
|
-
mainSpecPath,
|
|
295
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
296
|
-
refValuePath: '/Users/user/Developer/my_app/openapi/shared/models/user.yaml',
|
|
297
|
-
outputModelsPath: externalOutputPath,
|
|
298
|
-
});
|
|
299
|
-
// Should return fallback with basename
|
|
300
|
-
const normalized = normalizePath(result);
|
|
301
|
-
node_assert_1.strict.ok(normalized.includes('User') || normalized === './User');
|
|
302
|
-
});
|
|
303
|
-
(0, node_test_1.test)('absolute path with parentFilePath as directory', () => {
|
|
304
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn((path) => {
|
|
305
|
-
return path.includes('app');
|
|
306
|
-
});
|
|
307
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn((path) => {
|
|
308
|
-
return !path.includes('app');
|
|
309
|
-
});
|
|
310
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
311
|
-
mainSpecPath,
|
|
312
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app',
|
|
313
|
-
refValuePath: '/Users/user/Developer/my_app/openapi/shared/models/user.yaml',
|
|
314
|
-
outputModelsPath,
|
|
315
|
-
});
|
|
316
|
-
const normalized = normalizePath(result);
|
|
317
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
(0, node_test_1.describe)('Edge cases', () => {
|
|
321
|
-
(0, node_test_1.test)('parentFilePath with fragment but refValuePath is external file', () => {
|
|
322
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
323
|
-
mainSpecPath,
|
|
324
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml#/components/schemas/Account',
|
|
325
|
-
refValuePath: './users-list.yaml',
|
|
326
|
-
outputModelsPath,
|
|
327
|
-
});
|
|
328
|
-
node_assert_1.strict.equal(normalizePath(result), './spec/UsersList');
|
|
329
|
-
});
|
|
330
|
-
(0, node_test_1.test)('refValuePath starts with parent baseName → removes prefix correctly', () => {
|
|
331
|
-
fileSystemHelpers_1.fileSystemHelpers.isDirectory = node_test_1.mock.fn(() => false);
|
|
332
|
-
fileSystemHelpers_1.fileSystemHelpers.isPathToFile = node_test_1.mock.fn(() => true);
|
|
333
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
334
|
-
mainSpecPath,
|
|
335
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/spec/accountSpec.yaml',
|
|
336
|
-
refValuePath: 'accountSpec.yaml/nested/model.yaml',
|
|
337
|
-
outputModelsPath,
|
|
338
|
-
});
|
|
339
|
-
const normalized = normalizePath(result);
|
|
340
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
341
|
-
});
|
|
342
|
-
(0, node_test_1.test)('empty refValuePath with default handling', () => {
|
|
343
|
-
// parseRef returns LOCAL_FRAGMENT for empty/invalid refs
|
|
344
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
345
|
-
mainSpecPath,
|
|
346
|
-
parentFilePath: mainSpecPath,
|
|
347
|
-
refValuePath: '',
|
|
348
|
-
outputModelsPath,
|
|
349
|
-
});
|
|
350
|
-
const normalized = normalizePath(result);
|
|
351
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
352
|
-
});
|
|
353
|
-
(0, node_test_1.test)('parentFilePath without filePath in parsed result', () => {
|
|
354
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
355
|
-
mainSpecPath,
|
|
356
|
-
parentFilePath: '#/components/schemas/Parent',
|
|
357
|
-
refValuePath: './child.yaml',
|
|
358
|
-
outputModelsPath,
|
|
359
|
-
});
|
|
360
|
-
const normalized = normalizePath(result);
|
|
361
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
362
|
-
});
|
|
363
|
-
(0, node_test_1.test)('when absModelPath equals absOutputModelsPath', () => {
|
|
364
|
-
// This tests the condition: absModelPath !== absOutputModelsPath
|
|
365
|
-
const customOutputPath = '/Users/user/Developer/openapi-codegen/generated/models';
|
|
366
|
-
const result = (0, resolveRefToImportPath_1.resolveRefToImportPath)({
|
|
367
|
-
mainSpecPath: '/Users/user/Developer/my_app/openapi/app/openapi_spec.yaml',
|
|
368
|
-
parentFilePath: '/Users/user/Developer/my_app/openapi/app/openapi_spec.yaml',
|
|
369
|
-
refValuePath: '#/components/schemas/MainUser',
|
|
370
|
-
outputModelsPath: customOutputPath,
|
|
371
|
-
});
|
|
372
|
-
const normalized = normalizePath(result);
|
|
373
|
-
node_assert_1.strict.ok(typeof normalized === 'string');
|
|
374
|
-
});
|
|
375
|
-
});
|
|
376
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advancedDeduplicatePath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/advancedDeduplicatePath.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2B5D"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.advancedDeduplicatePath = advancedDeduplicatePath;
|
|
4
|
-
/**
|
|
5
|
-
* Advanced path deduplication - remove consecutive duplicate segments
|
|
6
|
-
*/
|
|
7
|
-
function advancedDeduplicatePath(path) {
|
|
8
|
-
const segments = path.split('/');
|
|
9
|
-
const result = [];
|
|
10
|
-
for (let i = 0; i < segments.length; i++) {
|
|
11
|
-
const segment = segments[i];
|
|
12
|
-
if (segment === '' || segment === '.') {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
if (segment === '..') {
|
|
16
|
-
if (result.length > 0) {
|
|
17
|
-
result.pop();
|
|
18
|
-
}
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
// Check if this segment is a duplicate of the previous one
|
|
22
|
-
if (result.length > 0 && result[result.length - 1] === segment) {
|
|
23
|
-
// Skip duplicate segment
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
result.push(segment);
|
|
27
|
-
}
|
|
28
|
-
return result.length > 0 ? '/' + result.join('/') : '';
|
|
29
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Finds the common parent directory of two paths
|
|
3
|
-
* @param path1 The value of the path
|
|
4
|
-
* @param path2 The value of the path
|
|
5
|
-
*/
|
|
6
|
-
export declare function findCommonParent(path1: string, path2: string): string | null;
|
|
7
|
-
//# sourceMappingURL=findCommonParent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findCommonParent.d.ts","sourceRoot":"","sources":["../../../src/core/utils/findCommonParent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa5E"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findCommonParent = findCommonParent;
|
|
4
|
-
/**
|
|
5
|
-
* Finds the common parent directory of two paths
|
|
6
|
-
* @param path1 The value of the path
|
|
7
|
-
* @param path2 The value of the path
|
|
8
|
-
*/
|
|
9
|
-
function findCommonParent(path1, path2) {
|
|
10
|
-
const pathSep = '/';
|
|
11
|
-
const parts1 = path1.split(pathSep).filter(Boolean);
|
|
12
|
-
const parts2 = path2.split(pathSep).filter(Boolean);
|
|
13
|
-
let i = 0;
|
|
14
|
-
while (i < parts1.length && i < parts2.length && parts1[i] === parts2[i]) {
|
|
15
|
-
i++;
|
|
16
|
-
}
|
|
17
|
-
if (i === 0)
|
|
18
|
-
return null;
|
|
19
|
-
return pathSep + parts1.slice(0, i).join(pathSep);
|
|
20
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Context } from '../Context';
|
|
2
|
-
import { RefWithType } from '../types/base/RefWithtype.model';
|
|
3
|
-
export declare function getGatheringRefs(context: Context, object: Record<string, any>, references?: RefWithType[], root?: string, isSchema?: boolean): RefWithType[];
|
|
4
|
-
//# sourceMappingURL=getGatheringRefs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getGatheringRefs.d.ts","sourceRoot":"","sources":["../../../src/core/utils/getGatheringRefs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAe9D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,GAAE,WAAW,EAAO,EAAE,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,OAAe,GAAG,WAAW,EAAE,CAqD3K"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getGatheringRefs = getGatheringRefs;
|
|
7
|
-
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
8
|
-
const TypeRef_enum_1 = require("../types/enums/TypeRef.enum");
|
|
9
|
-
const normalizeRef_1 = require("./normalizeRef");
|
|
10
|
-
const parseRef_1 = require("./parseRef");
|
|
11
|
-
const resolveRefPath_1 = require("./resolveRefPath");
|
|
12
|
-
function includes(references, value) {
|
|
13
|
-
return references.findIndex(item => (0, fast_deep_equal_1.default)(item.value, value)) !== -1;
|
|
14
|
-
}
|
|
15
|
-
function extractBasePath(path) {
|
|
16
|
-
// Extracting the base path to the last `#`
|
|
17
|
-
return path.includes('#') ? path.split('#')[0] : path;
|
|
18
|
-
}
|
|
19
|
-
function getGatheringRefs(context, object, references = [], root = '', isSchema = false) {
|
|
20
|
-
// If the object is not valid, we return the links
|
|
21
|
-
if (!object || typeof object !== 'object') {
|
|
22
|
-
return references;
|
|
23
|
-
}
|
|
24
|
-
if (object.$ref) {
|
|
25
|
-
// Parse the reference to understand its type
|
|
26
|
-
const baseRoot = extractBasePath(root);
|
|
27
|
-
const parsedRef = (0, parseRef_1.parseRef)(object.$ref);
|
|
28
|
-
// Create normalized reference for context.get
|
|
29
|
-
const normalizedRef = (0, normalizeRef_1.normalizeRef)(object.$ref, baseRoot);
|
|
30
|
-
if (includes(references, normalizedRef)) {
|
|
31
|
-
return references;
|
|
32
|
-
}
|
|
33
|
-
references.push({ value: normalizedRef, type: isSchema ? TypeRef_enum_1.TypeRef.SCHEMA : TypeRef_enum_1.TypeRef.OTHERS });
|
|
34
|
-
const newObject = context.get(normalizedRef);
|
|
35
|
-
// For recursive processing, determine the correct root path
|
|
36
|
-
let newRoot;
|
|
37
|
-
if (parsedRef.type === 'local_fragment') {
|
|
38
|
-
// For local fragments, keep the same root
|
|
39
|
-
newRoot = baseRoot;
|
|
40
|
-
}
|
|
41
|
-
else if (parsedRef.type === 'external_file' || parsedRef.type === 'external_file_fragment') {
|
|
42
|
-
// For external files, use the resolved file path
|
|
43
|
-
const resolvedPath = (0, resolveRefPath_1.resolveRefPath)(parsedRef, baseRoot);
|
|
44
|
-
newRoot = resolvedPath;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
// For other types, use the normalized path without fragment
|
|
48
|
-
const [filePath] = normalizedRef.split('#');
|
|
49
|
-
newRoot = filePath;
|
|
50
|
-
}
|
|
51
|
-
return getGatheringRefs(context, newObject, references, newRoot, isSchema);
|
|
52
|
-
}
|
|
53
|
-
else if (object.schema) {
|
|
54
|
-
Object.values(object).forEach(value => {
|
|
55
|
-
if (value instanceof Object) {
|
|
56
|
-
getGatheringRefs(context, value, references, root, true);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
Object.values(object).forEach(value => {
|
|
62
|
-
if (value instanceof Object) {
|
|
63
|
-
getGatheringRefs(context, value, references, root, isSchema);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return references;
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRefFromSchema.d.ts","sourceRoot":"","sources":["../../../src/core/utils/getRefFromSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE,CAGxF"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRefFromSchema = getRefFromSchema;
|
|
4
|
-
const TypeRef_enum_1 = require("../types/enums/TypeRef.enum");
|
|
5
|
-
const getGatheringRefs_1 = require("./getGatheringRefs");
|
|
6
|
-
function getRefFromSchema(context, object) {
|
|
7
|
-
const references = (0, getGatheringRefs_1.getGatheringRefs)(context, object);
|
|
8
|
-
return references.filter(item => item.type === TypeRef_enum_1.TypeRef.SCHEMA).map(value => value.value);
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isBoolean.d.ts","sourceRoot":"","sources":["../../../src/core/utils/isBoolean.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,UAAQ,OAUzD"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBoolean = isBoolean;
|
|
4
|
-
function isBoolean(value, defaultValue = false) {
|
|
5
|
-
if (value === null || value === undefined) {
|
|
6
|
-
return defaultValue;
|
|
7
|
-
}
|
|
8
|
-
if (value === true || value === false) {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
return defaultValue;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isFileName.d.ts","sourceRoot":"","sources":["../../../src/core/utils/isFileName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmB/C"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFileName = isFileName;
|
|
4
|
-
/**
|
|
5
|
-
* Checks if the string is just a file name (with an extension)
|
|
6
|
-
* @param str - the line to check
|
|
7
|
-
* @returns true, if this is the file name
|
|
8
|
-
*/
|
|
9
|
-
function isFileName(str) {
|
|
10
|
-
if (typeof str !== 'string' || !str)
|
|
11
|
-
return false;
|
|
12
|
-
// 1. Does not contain path separators
|
|
13
|
-
if (str.includes('/') || str.includes('\\'))
|
|
14
|
-
return false;
|
|
15
|
-
// 2. Does not start with ./, ../, \
|
|
16
|
-
if (/^\.\.?[\\/\\]/.test(str))
|
|
17
|
-
return false;
|
|
18
|
-
if (str.startsWith('/'))
|
|
19
|
-
return false;
|
|
20
|
-
// 3. Contains at least one dot and does not end with a dot.
|
|
21
|
-
const parts = str.split('.');
|
|
22
|
-
if (parts.length < 2)
|
|
23
|
-
return false;
|
|
24
|
-
if (parts[parts.length - 1] === '')
|
|
25
|
-
return false; // ends with .
|
|
26
|
-
// 4. The file name is not empty
|
|
27
|
-
if (parts[0] === '')
|
|
28
|
-
return false;
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safely muppit the path from SourceDir → targetDir
|
|
3
|
-
* Works even if the file is outside SourceDir, but in a common parent
|
|
4
|
-
* @param filePath
|
|
5
|
-
* @param sourceDir
|
|
6
|
-
* @param targetDir
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare function mapPathToTargetDirSafe(filePath: string, sourceDir: string, targetDir: string): string;
|
|
10
|
-
//# sourceMappingURL=mapPathToTargetDirSafe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapPathToTargetDirSafe.d.ts","sourceRoot":"","sources":["../../../src/core/utils/mapPathToTargetDirSafe.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CA0CrG"}
|