ts-openapi-codegen 2.0.0-beta.8 → 2.0.0
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 +88 -18
- package/README.rus.md +88 -21
- 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/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +5 -0
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +24 -13
- package/dist/cli/index.js +10 -8
- package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/init.js +5 -13
- package/dist/cli/initOpenApiConfig/initConfig.js +3 -3
- package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
- package/dist/cli/previewChanges/previewChanges.js +119 -28
- package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -1
- package/dist/cli/previewChanges/utils/updateOutputPaths.js +6 -0
- package/dist/cli/schemas/base.d.ts +6 -1
- package/dist/cli/schemas/base.d.ts.map +1 -1
- package/dist/cli/schemas/base.js +10 -6
- package/dist/cli/schemas/checkConfig.d.ts +1 -1
- package/dist/cli/schemas/generate.d.ts +1 -25
- package/dist/cli/schemas/generate.d.ts.map +1 -1
- package/dist/cli/schemas/generate.js +21 -32
- package/dist/cli/schemas/index.d.ts +2 -1
- package/dist/cli/schemas/index.d.ts.map +1 -1
- package/dist/cli/schemas/index.js +1 -0
- package/dist/cli/schemas/init.d.ts +5 -5
- package/dist/cli/schemas/init.d.ts.map +1 -1
- package/dist/cli/schemas/init.js +4 -5
- 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 +1 -1
- package/dist/common/Consts.d.ts +2 -0
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +8 -2
- package/dist/common/LoggerMessages.d.ts +1 -0
- package/dist/common/LoggerMessages.d.ts.map +1 -1
- package/dist/common/LoggerMessages.js +2 -1
- package/dist/common/TRawOptions.d.ts +1 -1
- 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/{cli/validation/errorFormatter.js → common/Validation/formatZodError.js} +14 -13
- package/dist/common/Validation/index.d.ts +3 -0
- package/dist/common/Validation/index.d.ts.map +1 -0
- package/dist/{cli/validation → common/Validation}/index.js +2 -2
- package/dist/{cli/validation/validateCLIOptions.d.ts → common/Validation/validateZodOptions.d.ts} +4 -4
- package/dist/common/Validation/validateZodOptions.d.ts.map +1 -0
- package/dist/{cli/validation/validateCLIOptions.js → common/Validation/validateZodOptions.js} +7 -10
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +14 -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 -14
- 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 +36 -6
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +33 -37
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +37 -6
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +30 -37
- 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/UnifiedOptionsSchemaV4.d.ts +42 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.js +38 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +192 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +27 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +61 -30
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +56 -73
- 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/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 +104 -0
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.d.ts +2 -0
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.js +185 -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 +40 -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 +93 -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/determineBestMatchingSchemaVersion.d.ts +6 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +70 -25
- 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/getUniqueKeysFromSchemas.d.ts +3 -3
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +17 -4
- 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 +12 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +41 -22
- 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/utils/__tests__/convertArrayToObject.test.js +64 -169
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
- package/dist/common/utils/convertArrayToObject.js +51 -14
- package/dist/core/Context.d.ts +6 -5
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +69 -26
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +24 -9
- package/dist/core/WriteClient.d.ts +8 -1
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +48 -7
- package/dist/core/__tests__/WriteClient.test.js +2 -0
- 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 +1 -2
- 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 +4 -3
- 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 +1 -2
- 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 +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/types/base/Templates.model.d.ts +1 -1
- package/dist/core/types/base/Templates.model.d.ts.map +1 -1
- package/dist/core/types/enums/EmptySchemaStrategy.enum.d.ts +6 -0
- package/dist/core/types/enums/EmptySchemaStrategy.enum.d.ts.map +1 -0
- package/dist/core/types/enums/EmptySchemaStrategy.enum.js +9 -0
- 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__/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.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +14 -1
- 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 +1 -0
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +25 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +42 -41
- 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/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/writeClientExecutor.d.ts +4 -1
- package/dist/core/utils/writeClientExecutor.d.ts.map +1 -1
- package/dist/core/utils/writeClientExecutor.js +17 -2
- package/dist/core/utils/writeClientSchemas.d.ts +4 -1
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +11 -2
- package/dist/templatesCompiled/client/core/ApiError.js +1 -1
- package/dist/templatesCompiled/client/core/ApiResult.js +1 -1
- package/dist/templatesCompiled/client/core/axios/request.js +3 -3
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts +2 -0
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.js +13 -8
- package/dist/templatesCompiled/client/core/executor/requestExecutor.js +1 -1
- package/dist/templatesCompiled/client/core/fetch/request.js +3 -3
- package/dist/templatesCompiled/client/core/functions/catchErrors.js +1 -1
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +1 -1
- package/dist/templatesCompiled/client/core/node/request.js +3 -3
- package/dist/templatesCompiled/client/core/xhr/request.js +3 -3
- package/dist/templatesCompiled/client/exportClient.d.ts +4 -0
- package/dist/templatesCompiled/client/exportClient.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportClient.js +51 -13
- package/dist/templatesCompiled/client/exportSchema.d.ts +5 -1
- package/dist/templatesCompiled/client/exportSchema.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportSchema.js +37 -7
- package/dist/templatesCompiled/client/exportService.d.ts +2 -0
- package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportService.js +71 -31
- package/dist/templatesCompiled/client/indexFull.d.ts +1 -0
- package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexFull.js +4 -1
- 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 +4 -1
- package/dist/templatesCompiled/client/joi/exportSchema.js +5 -5
- package/dist/templatesCompiled/client/joi/partials/joiSchema.js +7 -7
- package/dist/templatesCompiled/client/joi/partials/joiSchemaComposition.js +4 -4
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts +5 -3
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.d.ts.map +1 -1
- package/dist/templatesCompiled/client/joi/partials/joiSchemaInterface.js +39 -12
- package/dist/templatesCompiled/client/jsonschema/exportSchema.js +5 -5
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchema.js +7 -7
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaArray.js +5 -5
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaComposition.js +2 -2
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaDictionary.js +5 -5
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts +3 -1
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.d.ts.map +1 -1
- package/dist/templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface.js +45 -15
- 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/yup/exportSchema.js +3 -3
- package/dist/templatesCompiled/client/yup/partials/yupSchema.js +7 -7
- package/dist/templatesCompiled/client/yup/partials/yupSchemaComposition.js +4 -4
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts +5 -3
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.d.ts.map +1 -1
- package/dist/templatesCompiled/client/yup/partials/yupSchemaInterface.js +39 -12
- package/dist/templatesCompiled/client/zod/exportSchema.js +3 -3
- package/dist/templatesCompiled/client/zod/partials/zodSchema.js +7 -7
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts +5 -6
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.d.ts.map +1 -1
- package/dist/templatesCompiled/client/zod/partials/zodSchemaArray.js +14 -28
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts +3 -0
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.d.ts.map +1 -1
- package/dist/templatesCompiled/client/zod/partials/zodSchemaComposition.js +32 -8
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts +3 -4
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.d.ts.map +1 -1
- package/dist/templatesCompiled/client/zod/partials/zodSchemaDictionary.js +9 -23
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts +4 -2
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.d.ts.map +1 -1
- package/dist/templatesCompiled/client/zod/partials/zodSchemaInterface.js +18 -7
- package/package.json +2 -2
- package/dist/cli/validation/errorFormatter.d.ts +0 -6
- package/dist/cli/validation/errorFormatter.d.ts.map +0 -1
- package/dist/cli/validation/index.d.ts +0 -3
- package/dist/cli/validation/index.d.ts.map +0 -1
- package/dist/cli/validation/validateCLIOptions.d.ts.map +0 -1
- 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/defaultOptions.d.ts +0 -3
- package/dist/common/defaultOptions.d.ts.map +0 -1
- package/dist/common/defaultOptions.js +0 -28
- package/dist/common/schemas/configSchemas.d.ts +0 -91
- package/dist/common/schemas/configSchemas.d.ts.map +0 -1
- package/dist/common/schemas/configSchemas.js +0 -131
- 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/utils/advancedDeduplicatePath.d.ts +0 -5
- package/dist/core/utils/advancedDeduplicatePath.d.ts.map +0 -1
- package/dist/core/utils/advancedDeduplicatePath.js +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRefPath.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/resolveRefPath.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const parseRef_1 = require("../parseRef");
|
|
9
|
+
const resolveRefPath_1 = require("../resolveRefPath");
|
|
10
|
+
(0, node_test_1.describe)('@unit: resolveRefPath', () => {
|
|
11
|
+
(0, node_test_1.test)('should keep repeated folder names in absolute path', () => {
|
|
12
|
+
const parsedRef = {
|
|
13
|
+
type: parseRef_1.RefType.EXTERNAL_FILE,
|
|
14
|
+
originalRef: 'schemas/base/ModelWithString.yml',
|
|
15
|
+
filePath: 'schemas/base/ModelWithString.yml',
|
|
16
|
+
fragment: undefined,
|
|
17
|
+
};
|
|
18
|
+
const parentFilePath = '/home/runner/work/openapi-codegen/openapi-codegen/test/spec/v3.withDifferentRefs.yml';
|
|
19
|
+
const result = (0, resolveRefPath_1.resolveRefPath)(parsedRef, parentFilePath);
|
|
20
|
+
node_assert_1.default.strictEqual(result, '/home/runner/work/openapi-codegen/openapi-codegen/test/spec/schemas/base/ModelWithString.yml');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceHelpers.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/serviceHelpers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const serviceHelpers_1 = require("../serviceHelpers");
|
|
9
|
+
function createModel(overrides = {}) {
|
|
10
|
+
return {
|
|
11
|
+
name: 'Model',
|
|
12
|
+
alias: '',
|
|
13
|
+
path: 'Model',
|
|
14
|
+
export: 'reference',
|
|
15
|
+
type: 'Model',
|
|
16
|
+
base: 'Model',
|
|
17
|
+
template: null,
|
|
18
|
+
link: null,
|
|
19
|
+
description: null,
|
|
20
|
+
isDefinition: false,
|
|
21
|
+
isReadOnly: false,
|
|
22
|
+
isRequired: false,
|
|
23
|
+
isNullable: false,
|
|
24
|
+
imports: [],
|
|
25
|
+
enum: [],
|
|
26
|
+
enums: [],
|
|
27
|
+
properties: [],
|
|
28
|
+
...overrides,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function createOperationParameter(overrides = {}) {
|
|
32
|
+
return {
|
|
33
|
+
...createModel(overrides),
|
|
34
|
+
in: 'query',
|
|
35
|
+
prop: 'value',
|
|
36
|
+
mediaType: null,
|
|
37
|
+
...overrides,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function createOperationResponse(overrides = {}) {
|
|
41
|
+
return {
|
|
42
|
+
...createModel(overrides),
|
|
43
|
+
in: 'response',
|
|
44
|
+
code: 200,
|
|
45
|
+
...overrides,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
(0, node_test_1.describe)('@unit: serviceHelpers', () => {
|
|
49
|
+
(0, node_test_1.test)('finalizeServiceImports should assign duplicate aliases and propagate to params/results', () => {
|
|
50
|
+
const importFooA = { name: 'Foo', alias: '', path: 'models/a/Foo' };
|
|
51
|
+
const importFooB = { name: 'Foo', alias: '', path: 'models/b/Foo' };
|
|
52
|
+
const paramFooA = createOperationParameter({
|
|
53
|
+
name: 'paramFooA',
|
|
54
|
+
path: './models/a/Foo',
|
|
55
|
+
type: 'Foo',
|
|
56
|
+
base: 'Foo',
|
|
57
|
+
imports: [{ ...importFooA }],
|
|
58
|
+
});
|
|
59
|
+
const paramFooBArray = createOperationParameter({
|
|
60
|
+
name: 'paramFooBArray',
|
|
61
|
+
export: 'array',
|
|
62
|
+
type: 'Foo',
|
|
63
|
+
base: 'Foo',
|
|
64
|
+
imports: [{ ...importFooB }],
|
|
65
|
+
link: createModel({
|
|
66
|
+
path: './models/b/Foo',
|
|
67
|
+
type: 'Foo',
|
|
68
|
+
base: 'Foo',
|
|
69
|
+
imports: [{ ...importFooB }],
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
const resultFooB = createOperationResponse({
|
|
73
|
+
name: 'resultFooB',
|
|
74
|
+
path: './models/b/Foo',
|
|
75
|
+
type: 'Foo',
|
|
76
|
+
base: 'Foo',
|
|
77
|
+
imports: [{ ...importFooB }],
|
|
78
|
+
});
|
|
79
|
+
const operation = {
|
|
80
|
+
service: 'PetService',
|
|
81
|
+
name: 'getPet',
|
|
82
|
+
summary: null,
|
|
83
|
+
description: null,
|
|
84
|
+
deprecated: false,
|
|
85
|
+
method: 'GET',
|
|
86
|
+
path: '/pets/{id}',
|
|
87
|
+
imports: [],
|
|
88
|
+
parameters: [paramFooA, paramFooBArray],
|
|
89
|
+
parametersPath: [],
|
|
90
|
+
parametersQuery: [],
|
|
91
|
+
parametersForm: [],
|
|
92
|
+
parametersCookie: [],
|
|
93
|
+
parametersHeader: [],
|
|
94
|
+
parametersBody: null,
|
|
95
|
+
errors: [],
|
|
96
|
+
results: [resultFooB],
|
|
97
|
+
responseHeader: null,
|
|
98
|
+
};
|
|
99
|
+
const service = {
|
|
100
|
+
name: 'PetService',
|
|
101
|
+
originName: 'PetService',
|
|
102
|
+
operations: [operation],
|
|
103
|
+
imports: [importFooA, importFooB],
|
|
104
|
+
};
|
|
105
|
+
(0, serviceHelpers_1.finalizeServiceImports)(service);
|
|
106
|
+
const aliasByPath = new Map(service.imports.map(item => [item.path, item.alias]));
|
|
107
|
+
const aliasA = aliasByPath.get('models/a/Foo');
|
|
108
|
+
const aliasB = aliasByPath.get('models/b/Foo');
|
|
109
|
+
node_assert_1.default.ok(aliasA);
|
|
110
|
+
node_assert_1.default.ok(aliasB);
|
|
111
|
+
node_assert_1.default.notEqual(aliasA, aliasB);
|
|
112
|
+
node_assert_1.default.equal(paramFooA.base, aliasA);
|
|
113
|
+
node_assert_1.default.equal(paramFooA.type, aliasA);
|
|
114
|
+
node_assert_1.default.equal(paramFooBArray.base, aliasB);
|
|
115
|
+
node_assert_1.default.equal(paramFooBArray.type, aliasB);
|
|
116
|
+
node_assert_1.default.equal(paramFooBArray.link?.base, aliasB);
|
|
117
|
+
node_assert_1.default.equal(paramFooBArray.link?.type, aliasB);
|
|
118
|
+
node_assert_1.default.equal(operation.results[0].base, aliasB);
|
|
119
|
+
node_assert_1.default.equal(operation.results[0].type, aliasB);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeClientExecutor.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/writeClientExecutor.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const writeClientExecutor_1 = require("../writeClientExecutor");
|
|
9
|
+
(0, node_test_1.describe)('@unit: writeClientExecutor', () => {
|
|
10
|
+
(0, node_test_1.test)('deduplicateServicesByName should keep first service by name', () => {
|
|
11
|
+
const services = [
|
|
12
|
+
{ name: 'V2Service', originName: 'V2Service', operations: [], imports: [] },
|
|
13
|
+
{ name: 'V2Service', originName: 'V2ServiceCopy', operations: [], imports: [] },
|
|
14
|
+
{ name: 'SimpleService', originName: 'SimpleService', operations: [], imports: [] },
|
|
15
|
+
];
|
|
16
|
+
const result = (0, writeClientExecutor_1.deduplicateServicesByName)(services);
|
|
17
|
+
node_assert_1.default.deepStrictEqual(result.map(item => item.name), ['V2Service', 'SimpleService']);
|
|
18
|
+
node_assert_1.default.equal(result[0].originName, 'V2Service');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
7
|
const node_test_1 = require("node:test");
|
|
8
8
|
const fileSystemHelpers_1 = require("../../../common/utils/fileSystemHelpers");
|
|
9
|
+
const EmptySchemaStrategy_enum_1 = require("../../types/enums/EmptySchemaStrategy.enum");
|
|
9
10
|
const HttpClient_enum_1 = require("../../types/enums/HttpClient.enum");
|
|
10
11
|
const ValidationLibrary_enum_1 = require("../../types/enums/ValidationLibrary.enum");
|
|
11
12
|
const WriteClient_1 = require("../../WriteClient");
|
|
@@ -47,6 +48,7 @@ const templates_1 = require("../__mocks__/templates");
|
|
|
47
48
|
httpClient: HttpClient_enum_1.HttpClient.FETCH,
|
|
48
49
|
useUnionTypes: false,
|
|
49
50
|
validationLibrary: ValidationLibrary_enum_1.ValidationLibrary.NONE,
|
|
51
|
+
emptySchemaStrategy: EmptySchemaStrategy_enum_1.EmptySchemaStrategy.KEEP,
|
|
50
52
|
});
|
|
51
53
|
node_assert_1.default.ok(writeFileCalls.some(([filePath, content]) => filePath.toString().includes('MyModelSchema.ts') && content.toString().includes('schema')), 'Expected writeFile to be called with schema content for MyModelSchema.ts');
|
|
52
54
|
// Restoring the original function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOpenApiSpec.d.ts","sourceRoot":"","sources":["../../../src/core/utils/getOpenApiSpec.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"getOpenApiSpec.d.ts","sourceRoot":"","sources":["../../../src/core/utils/getOpenApiSpec.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAqC5F"}
|
|
@@ -17,7 +17,20 @@ async function getOpenApiSpec(context, input) {
|
|
|
17
17
|
throw new Error(`OpenAPI spec not found: ${absoluteInput}`);
|
|
18
18
|
}
|
|
19
19
|
const parser = new swagger_parser_1.default();
|
|
20
|
-
const
|
|
20
|
+
const previousCwd = process.cwd();
|
|
21
|
+
const inputDir = (0, pathHelpers_1.dirNameHelper)(absoluteInput);
|
|
22
|
+
if (previousCwd !== inputDir) {
|
|
23
|
+
process.chdir(inputDir);
|
|
24
|
+
}
|
|
25
|
+
let resolved;
|
|
26
|
+
try {
|
|
27
|
+
resolved = await parser.resolve(absoluteInput);
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
if (process.cwd() !== previousCwd) {
|
|
31
|
+
process.chdir(previousCwd);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
21
34
|
context.addRefs(resolved);
|
|
22
35
|
// Получить основную схему
|
|
23
36
|
const raw = resolved.get(absoluteInput);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/modelHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modelHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/modelHelpers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAkBjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,GAAG,KAAK,EAAE,CA4ErF"}
|
|
@@ -52,8 +52,36 @@ function setDuplicateModelAliases(models) {
|
|
|
52
52
|
* @returns the same array of models (modified)
|
|
53
53
|
*/
|
|
54
54
|
function resolveModelImports(models, outputModelsDir) {
|
|
55
|
+
const normalizeImportPath = (value) => (value.startsWith('./') ? value.slice(2) : value);
|
|
56
|
+
const applyAliasToModel = (model, imprt) => {
|
|
57
|
+
const modelPath = normalizeImportPath(model.path);
|
|
58
|
+
const importPath = normalizeImportPath(imprt.path);
|
|
59
|
+
if (modelPath === importPath && model.type === imprt.name && imprt.alias) {
|
|
60
|
+
model.alias = imprt.alias;
|
|
61
|
+
model.base = imprt.alias;
|
|
62
|
+
model.type = imprt.alias;
|
|
63
|
+
}
|
|
64
|
+
if (imprt.alias && model.imports?.some(item => normalizeImportPath(item.path) === importPath && item.name === imprt.name)) {
|
|
65
|
+
if (model.base === imprt.name) {
|
|
66
|
+
model.base = imprt.alias;
|
|
67
|
+
}
|
|
68
|
+
if (model.type === imprt.name) {
|
|
69
|
+
model.type = imprt.alias;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (model.link) {
|
|
73
|
+
applyAliasToModel(model.link, imprt);
|
|
74
|
+
}
|
|
75
|
+
if (model.properties?.length) {
|
|
76
|
+
model.properties.forEach(child => applyAliasToModel(child, imprt));
|
|
77
|
+
}
|
|
78
|
+
if (model.enums?.length) {
|
|
79
|
+
model.enums.forEach(child => applyAliasToModel(child, imprt));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
55
82
|
models.forEach(model => {
|
|
56
|
-
|
|
83
|
+
const importsWithSourcePath = model.imports.map(imprt => {
|
|
84
|
+
const sourcePath = imprt.path;
|
|
57
85
|
const importModel = models.find(value => {
|
|
58
86
|
const normalizedPath = !value.path.startsWith('./') ? `./${value.path}` : value.path;
|
|
59
87
|
return normalizedPath === imprt.path && value.name === imprt.name;
|
|
@@ -69,16 +97,22 @@ function resolveModelImports(models, outputModelsDir) {
|
|
|
69
97
|
importPath = `./${file}`;
|
|
70
98
|
}
|
|
71
99
|
else if (relativePath.startsWith('./')) {
|
|
72
|
-
importPath = `${relativePath}
|
|
100
|
+
importPath = `${relativePath}/${file}`;
|
|
73
101
|
}
|
|
74
102
|
else {
|
|
75
103
|
importPath = `${relativePath}/${file}`;
|
|
76
104
|
}
|
|
77
105
|
}
|
|
78
|
-
|
|
106
|
+
const mappedImport = Object.assign(imprt, {
|
|
79
107
|
alias: importAlias,
|
|
80
108
|
path: importPath,
|
|
81
109
|
});
|
|
110
|
+
return { mappedImport, sourcePath };
|
|
111
|
+
});
|
|
112
|
+
model.imports = importsWithSourcePath.map(item => item.mappedImport);
|
|
113
|
+
importsWithSourcePath.forEach(item => {
|
|
114
|
+
applyAliasToModel(model, item.mappedImport);
|
|
115
|
+
applyAliasToModel(model, Object.assign({}, item.mappedImport, { path: item.sourcePath }));
|
|
82
116
|
});
|
|
83
117
|
});
|
|
84
118
|
return models;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postProcessModelImports.d.ts","sourceRoot":"","sources":["../../../src/core/utils/postProcessModelImports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postProcessModelImports.d.ts","sourceRoot":"","sources":["../../../src/core/utils/postProcessModelImports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAQzD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAY9D"}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.postProcessModelImports = postProcessModelImports;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
4
8
|
const sort_1 = require("./sort");
|
|
5
9
|
const unique_1 = require("./unique");
|
|
10
|
+
function normalizePath(value) {
|
|
11
|
+
return value.startsWith('./') ? value.slice(2) : value;
|
|
12
|
+
}
|
|
6
13
|
/**
|
|
7
14
|
* Set unique imports, sorted by name
|
|
8
15
|
* @param model The model that is post-processed
|
|
9
16
|
*/
|
|
10
17
|
function postProcessModelImports(model) {
|
|
18
|
+
const currentModelPath = normalizePath(model.path);
|
|
19
|
+
const currentModelDir = path_1.default.posix.dirname(currentModelPath);
|
|
11
20
|
return model?.imports
|
|
12
21
|
?.filter(unique_1.unique)
|
|
13
22
|
?.sort(sort_1.sort)
|
|
14
|
-
?.filter(item =>
|
|
23
|
+
?.filter(item => {
|
|
24
|
+
const importPath = normalizePath(item.path);
|
|
25
|
+
const resolvedFromCurrentModel = path_1.default.posix.normalize(path_1.default.posix.join(currentModelDir, importPath));
|
|
26
|
+
return resolvedFromCurrentModel !== currentModelPath;
|
|
27
|
+
});
|
|
15
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postProcessServiceImports.d.ts","sourceRoot":"","sources":["../../../src/core/utils/postProcessServiceImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI7D;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"postProcessServiceImports.d.ts","sourceRoot":"","sources":["../../../src/core/utils/postProcessServiceImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI7D;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAIpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarHelpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAK5D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"registerHandlebarHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarHelpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAK5D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAgM5H"}
|
|
@@ -168,6 +168,31 @@ function registerHandlebarHelpers(root) {
|
|
|
168
168
|
return 'Joi.any()';
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
+
Handlebars.registerHelper('zodBaseSchema', function (base) {
|
|
172
|
+
if (!base)
|
|
173
|
+
return 'z.any()';
|
|
174
|
+
const baseLower = base.toLowerCase();
|
|
175
|
+
switch (baseLower) {
|
|
176
|
+
case 'string':
|
|
177
|
+
return 'z.string()';
|
|
178
|
+
case 'number':
|
|
179
|
+
return 'z.number()';
|
|
180
|
+
case 'integer':
|
|
181
|
+
case 'int':
|
|
182
|
+
return 'z.number().int()';
|
|
183
|
+
case 'boolean':
|
|
184
|
+
return 'z.boolean()';
|
|
185
|
+
case 'null':
|
|
186
|
+
return 'z.null()';
|
|
187
|
+
case 'uuid':
|
|
188
|
+
return 'z.uuid()';
|
|
189
|
+
case 'file':
|
|
190
|
+
case 'any':
|
|
191
|
+
return 'z.any()';
|
|
192
|
+
default:
|
|
193
|
+
return `${base}Schema`;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
171
196
|
Handlebars.registerHelper('getRequiredFields', function (properties) {
|
|
172
197
|
const required = properties
|
|
173
198
|
.filter(prop => prop.isRequired)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AA8FA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AA2C1E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CAAE,GAAG,SAAS,CAqK1K"}
|
|
@@ -89,6 +89,7 @@ const getResponseHeader_4 = __importDefault(require("../../templatesCompiled/cli
|
|
|
89
89
|
const request_5 = __importDefault(require("../../templatesCompiled/client/core/xhr/request"));
|
|
90
90
|
const sendRequest_4 = __importDefault(require("../../templatesCompiled/client/core/xhr/sendRequest"));
|
|
91
91
|
const exportClient_1 = __importDefault(require("../../templatesCompiled/client/exportClient"));
|
|
92
|
+
const exportSchema_1 = __importDefault(require("../../templatesCompiled/client/exportSchema"));
|
|
92
93
|
const exportModel_1 = __importDefault(require("../../templatesCompiled/client/exportModel"));
|
|
93
94
|
const exportService_1 = __importDefault(require("../../templatesCompiled/client/exportService"));
|
|
94
95
|
const indexFull_1 = __importDefault(require("../../templatesCompiled/client/indexFull"));
|
|
@@ -130,7 +131,7 @@ const typeReference_1 = __importDefault(require("../../templatesCompiled/client/
|
|
|
130
131
|
const typeUnion_1 = __importDefault(require("../../templatesCompiled/client/partials/typeUnion"));
|
|
131
132
|
const registerHandlebarHelpers_1 = require("./registerHandlebarHelpers");
|
|
132
133
|
const ValidationLibrary_enum_1 = require("../types/enums/ValidationLibrary.enum");
|
|
133
|
-
const
|
|
134
|
+
const exportSchema_2 = __importDefault(require("../../templatesCompiled/client/zod/exportSchema"));
|
|
134
135
|
const zodSchema_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchema"));
|
|
135
136
|
const zodSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaInterface"));
|
|
136
137
|
const zodSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaEnum"));
|
|
@@ -139,7 +140,7 @@ const zodSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
|
|
|
139
140
|
const zodSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaGeneric"));
|
|
140
141
|
const zodSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaReference"));
|
|
141
142
|
const zodSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/zod/partials/zodSchemaComposition"));
|
|
142
|
-
const
|
|
143
|
+
const exportSchema_3 = __importDefault(require("../../templatesCompiled/client/yup/exportSchema"));
|
|
143
144
|
const yupSchema_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchema"));
|
|
144
145
|
const yupSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaInterface"));
|
|
145
146
|
const yupSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaEnum"));
|
|
@@ -148,7 +149,7 @@ const yupSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
|
|
|
148
149
|
const yupSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaGeneric"));
|
|
149
150
|
const yupSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaReference"));
|
|
150
151
|
const yupSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/yup/partials/yupSchemaComposition"));
|
|
151
|
-
const
|
|
152
|
+
const exportSchema_4 = __importDefault(require("../../templatesCompiled/client/joi/exportSchema"));
|
|
152
153
|
const joiSchema_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchema"));
|
|
153
154
|
const joiSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaInterface"));
|
|
154
155
|
const joiSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaEnum"));
|
|
@@ -157,7 +158,7 @@ const joiSchemaDictionary_1 = __importDefault(require("../../templatesCompiled/c
|
|
|
157
158
|
const joiSchemaGeneric_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaGeneric"));
|
|
158
159
|
const joiSchemaReference_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaReference"));
|
|
159
160
|
const joiSchemaComposition_1 = __importDefault(require("../../templatesCompiled/client/joi/partials/joiSchemaComposition"));
|
|
160
|
-
const
|
|
161
|
+
const exportSchema_5 = __importDefault(require("../../templatesCompiled/client/jsonschema/exportSchema"));
|
|
161
162
|
const jsonschemaSchema_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchema"));
|
|
162
163
|
const jsonschemaSchemaInterface_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaInterface"));
|
|
163
164
|
const jsonschemaSchemaEnum_1 = __importDefault(require("../../templatesCompiled/client/jsonschema/partials/jsonschemaSchemaEnum"));
|
|
@@ -185,7 +186,7 @@ function registerHandlebarTemplates(root) {
|
|
|
185
186
|
exports: {
|
|
186
187
|
client: Handlebars.template(exportClient_1.default),
|
|
187
188
|
model: Handlebars.template(exportModel_1.default),
|
|
188
|
-
schema:
|
|
189
|
+
schema: Handlebars.template(exportSchema_1.default),
|
|
189
190
|
service: Handlebars.template(exportService_1.default),
|
|
190
191
|
},
|
|
191
192
|
core: {
|
|
@@ -277,50 +278,50 @@ function registerHandlebarTemplates(root) {
|
|
|
277
278
|
Handlebars.registerPartial('axios/request', Handlebars.template(request_1.default));
|
|
278
279
|
// Register Zod partials if validationLibrary is ZOD
|
|
279
280
|
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.ZOD) {
|
|
280
|
-
|
|
281
|
-
Handlebars.registerPartial('zodSchema', Handlebars.template(zodSchema_1.default));
|
|
282
|
-
Handlebars.registerPartial('zodSchemaInterface', Handlebars.template(zodSchemaInterface_1.default));
|
|
283
|
-
Handlebars.registerPartial('zodSchemaEnum', Handlebars.template(zodSchemaEnum_1.default));
|
|
284
|
-
Handlebars.registerPartial('zodSchemaArray', Handlebars.template(zodSchemaArray_1.default));
|
|
285
|
-
Handlebars.registerPartial('zodSchemaDictionary', Handlebars.template(zodSchemaDictionary_1.default));
|
|
286
|
-
Handlebars.registerPartial('zodSchemaGeneric', Handlebars.template(zodSchemaGeneric_1.default));
|
|
287
|
-
Handlebars.registerPartial('zodSchemaReference', Handlebars.template(zodSchemaReference_1.default));
|
|
288
|
-
Handlebars.registerPartial('zodSchemaComposition', Handlebars.template(zodSchemaComposition_1.default));
|
|
281
|
+
Handlebars.registerPartial('zod/exportSchema', Handlebars.template(exportSchema_2.default));
|
|
282
|
+
Handlebars.registerPartial('zod/zodSchema', Handlebars.template(zodSchema_1.default));
|
|
283
|
+
Handlebars.registerPartial('zod/zodSchemaInterface', Handlebars.template(zodSchemaInterface_1.default));
|
|
284
|
+
Handlebars.registerPartial('zod/zodSchemaEnum', Handlebars.template(zodSchemaEnum_1.default));
|
|
285
|
+
Handlebars.registerPartial('zod/zodSchemaArray', Handlebars.template(zodSchemaArray_1.default));
|
|
286
|
+
Handlebars.registerPartial('zod/zodSchemaDictionary', Handlebars.template(zodSchemaDictionary_1.default));
|
|
287
|
+
Handlebars.registerPartial('zod/zodSchemaGeneric', Handlebars.template(zodSchemaGeneric_1.default));
|
|
288
|
+
Handlebars.registerPartial('zod/zodSchemaReference', Handlebars.template(zodSchemaReference_1.default));
|
|
289
|
+
Handlebars.registerPartial('zod/zodSchemaComposition', Handlebars.template(zodSchemaComposition_1.default));
|
|
289
290
|
}
|
|
290
291
|
// Register Yup partials if validationLibrary is YUP
|
|
291
292
|
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.YUP) {
|
|
292
|
-
|
|
293
|
-
Handlebars.registerPartial('yupSchema', Handlebars.template(yupSchema_1.default));
|
|
294
|
-
Handlebars.registerPartial('yupSchemaInterface', Handlebars.template(yupSchemaInterface_1.default));
|
|
295
|
-
Handlebars.registerPartial('yupSchemaEnum', Handlebars.template(yupSchemaEnum_1.default));
|
|
296
|
-
Handlebars.registerPartial('yupSchemaArray', Handlebars.template(yupSchemaArray_1.default));
|
|
297
|
-
Handlebars.registerPartial('yupSchemaDictionary', Handlebars.template(yupSchemaDictionary_1.default));
|
|
298
|
-
Handlebars.registerPartial('yupSchemaGeneric', Handlebars.template(yupSchemaGeneric_1.default));
|
|
299
|
-
Handlebars.registerPartial('yupSchemaReference', Handlebars.template(yupSchemaReference_1.default));
|
|
300
|
-
Handlebars.registerPartial('yupSchemaComposition', Handlebars.template(yupSchemaComposition_1.default));
|
|
293
|
+
Handlebars.registerPartial('yup/exportSchema', Handlebars.template(exportSchema_3.default));
|
|
294
|
+
Handlebars.registerPartial('yup/yupSchema', Handlebars.template(yupSchema_1.default));
|
|
295
|
+
Handlebars.registerPartial('yup/yupSchemaInterface', Handlebars.template(yupSchemaInterface_1.default));
|
|
296
|
+
Handlebars.registerPartial('yup/yupSchemaEnum', Handlebars.template(yupSchemaEnum_1.default));
|
|
297
|
+
Handlebars.registerPartial('yup/yupSchemaArray', Handlebars.template(yupSchemaArray_1.default));
|
|
298
|
+
Handlebars.registerPartial('yup/yupSchemaDictionary', Handlebars.template(yupSchemaDictionary_1.default));
|
|
299
|
+
Handlebars.registerPartial('yup/yupSchemaGeneric', Handlebars.template(yupSchemaGeneric_1.default));
|
|
300
|
+
Handlebars.registerPartial('yup/yupSchemaReference', Handlebars.template(yupSchemaReference_1.default));
|
|
301
|
+
Handlebars.registerPartial('yup/yupSchemaComposition', Handlebars.template(yupSchemaComposition_1.default));
|
|
301
302
|
}
|
|
302
303
|
// Register Joi partials if validationLibrary is JOI
|
|
303
304
|
if (root?.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JOI) {
|
|
304
|
-
|
|
305
|
-
Handlebars.registerPartial('joiSchema', Handlebars.template(joiSchema_1.default));
|
|
306
|
-
Handlebars.registerPartial('joiSchemaInterface', Handlebars.template(joiSchemaInterface_1.default));
|
|
307
|
-
Handlebars.registerPartial('joiSchemaEnum', Handlebars.template(joiSchemaEnum_1.default));
|
|
308
|
-
Handlebars.registerPartial('joiSchemaArray', Handlebars.template(joiSchemaArray_1.default));
|
|
309
|
-
Handlebars.registerPartial('joiSchemaDictionary', Handlebars.template(joiSchemaDictionary_1.default));
|
|
310
|
-
Handlebars.registerPartial('joiSchemaGeneric', Handlebars.template(joiSchemaGeneric_1.default));
|
|
311
|
-
Handlebars.registerPartial('joiSchemaReference', Handlebars.template(joiSchemaReference_1.default));
|
|
312
|
-
Handlebars.registerPartial('joiSchemaComposition', Handlebars.template(joiSchemaComposition_1.default));
|
|
305
|
+
Handlebars.registerPartial('joi/exportSchema', Handlebars.template(exportSchema_4.default));
|
|
306
|
+
Handlebars.registerPartial('joi/joiSchema', Handlebars.template(joiSchema_1.default));
|
|
307
|
+
Handlebars.registerPartial('joi/joiSchemaInterface', Handlebars.template(joiSchemaInterface_1.default));
|
|
308
|
+
Handlebars.registerPartial('joi/joiSchemaEnum', Handlebars.template(joiSchemaEnum_1.default));
|
|
309
|
+
Handlebars.registerPartial('joi/joiSchemaArray', Handlebars.template(joiSchemaArray_1.default));
|
|
310
|
+
Handlebars.registerPartial('joi/joiSchemaDictionary', Handlebars.template(joiSchemaDictionary_1.default));
|
|
311
|
+
Handlebars.registerPartial('joi/joiSchemaGeneric', Handlebars.template(joiSchemaGeneric_1.default));
|
|
312
|
+
Handlebars.registerPartial('joi/joiSchemaReference', Handlebars.template(joiSchemaReference_1.default));
|
|
313
|
+
Handlebars.registerPartial('joi/joiSchemaComposition', Handlebars.template(joiSchemaComposition_1.default));
|
|
313
314
|
}
|
|
314
315
|
if (root.validationLibrary === ValidationLibrary_enum_1.ValidationLibrary.JSONSCHEMA) {
|
|
315
|
-
|
|
316
|
-
Handlebars.registerPartial('jsonschemaSchema', Handlebars.template(jsonschemaSchema_1.default));
|
|
317
|
-
Handlebars.registerPartial('jsonschemaSchemaInterface', Handlebars.template(jsonschemaSchemaInterface_1.default));
|
|
318
|
-
Handlebars.registerPartial('jsonschemaSchemaEnum', Handlebars.template(jsonschemaSchemaEnum_1.default));
|
|
319
|
-
Handlebars.registerPartial('jsonschemaSchemaArray', Handlebars.template(jsonschemaSchemaArray_1.default));
|
|
320
|
-
Handlebars.registerPartial('jsonschemaSchemaDictionary', Handlebars.template(jsonschemaSchemaDictionary_1.default));
|
|
321
|
-
Handlebars.registerPartial('jsonschemaSchemaGeneric', Handlebars.template(jsonschemaSchemaGeneric_1.default));
|
|
322
|
-
Handlebars.registerPartial('jsonschemaSchemaReference', Handlebars.template(jsonschemaSchemaReference_1.default));
|
|
323
|
-
Handlebars.registerPartial('jsonschemaSchemaComposition', Handlebars.template(jsonschemaSchemaComposition_1.default));
|
|
316
|
+
Handlebars.registerPartial('jsonschema/exportSchema', Handlebars.template(exportSchema_5.default));
|
|
317
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchema', Handlebars.template(jsonschemaSchema_1.default));
|
|
318
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaInterface', Handlebars.template(jsonschemaSchemaInterface_1.default));
|
|
319
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaEnum', Handlebars.template(jsonschemaSchemaEnum_1.default));
|
|
320
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaArray', Handlebars.template(jsonschemaSchemaArray_1.default));
|
|
321
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaDictionary', Handlebars.template(jsonschemaSchemaDictionary_1.default));
|
|
322
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaGeneric', Handlebars.template(jsonschemaSchemaGeneric_1.default));
|
|
323
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaReference', Handlebars.template(jsonschemaSchemaReference_1.default));
|
|
324
|
+
Handlebars.registerPartial('jsonschema/jsonschemaSchemaComposition', Handlebars.template(jsonschemaSchemaComposition_1.default));
|
|
324
325
|
}
|
|
325
326
|
return templates;
|
|
326
327
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRefPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveRefPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CA0BnF"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveRefPath = resolveRefPath;
|
|
4
4
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
5
|
-
const advancedDeduplicatePath_1 = require("./advancedDeduplicatePath");
|
|
6
5
|
const parseRef_1 = require("./parseRef");
|
|
7
6
|
/**
|
|
8
7
|
* Resolve a parsed reference to an absolute path (when applicable).
|
|
@@ -19,9 +18,7 @@ function resolveRefPath(parsedRef, parentFilePath) {
|
|
|
19
18
|
case parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT:
|
|
20
19
|
// Resolve relative to parent file directory
|
|
21
20
|
if (parsedRef.filePath) {
|
|
22
|
-
|
|
23
|
-
// Clean any duplicate path segments
|
|
24
|
-
return (0, advancedDeduplicatePath_1.advancedDeduplicatePath)(resolvedPath);
|
|
21
|
+
return (0, pathHelpers_1.resolveHelper)(parentDir, parsedRef.filePath);
|
|
25
22
|
}
|
|
26
23
|
return parentFilePath;
|
|
27
24
|
case parseRef_1.RefType.ABSOLUTE_PATH:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;
|
|
1
|
+
{"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;AA+CD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiChE"}
|
|
@@ -63,13 +63,39 @@ function mergeOperationImportsIntoService(service, operation) {
|
|
|
63
63
|
/**
|
|
64
64
|
* Internal helper: apply alias value to models that reference the import.
|
|
65
65
|
*/
|
|
66
|
+
function normalizeImportPath(path) {
|
|
67
|
+
return path.startsWith('./') ? path.slice(2) : path;
|
|
68
|
+
}
|
|
69
|
+
function applyAliasToModel(model, value) {
|
|
70
|
+
const modelPath = normalizeImportPath(model.path);
|
|
71
|
+
const importPath = normalizeImportPath(value.path);
|
|
72
|
+
if (modelPath === importPath && model.type === value.name && value.alias) {
|
|
73
|
+
model.alias = value.alias;
|
|
74
|
+
model.base = value.alias;
|
|
75
|
+
}
|
|
76
|
+
if (value.alias && model.imports?.some(imprt => normalizeImportPath(imprt.path) === importPath && imprt.name === value.name)) {
|
|
77
|
+
if (model.base === value.name) {
|
|
78
|
+
model.base = value.alias;
|
|
79
|
+
}
|
|
80
|
+
if (model.type === value.name) {
|
|
81
|
+
model.type = value.alias;
|
|
82
|
+
}
|
|
83
|
+
if (!model.alias) {
|
|
84
|
+
model.alias = value.alias;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (model.link) {
|
|
88
|
+
applyAliasToModel(model.link, value);
|
|
89
|
+
}
|
|
90
|
+
if (model.properties?.length) {
|
|
91
|
+
model.properties.forEach(child => applyAliasToModel(child, value));
|
|
92
|
+
}
|
|
93
|
+
if (model.enums?.length) {
|
|
94
|
+
model.enums.forEach(child => applyAliasToModel(child, value));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
66
97
|
function fillModelsByAlias(items = [], value) {
|
|
67
|
-
items
|
|
68
|
-
.filter(result => result.path === value.path && result.type === value.name && value.alias)
|
|
69
|
-
.forEach(result => {
|
|
70
|
-
result.alias = value.alias;
|
|
71
|
-
result.base = value.alias;
|
|
72
|
-
});
|
|
98
|
+
items.forEach(item => applyAliasToModel(item, value));
|
|
73
99
|
}
|
|
74
100
|
/**
|
|
75
101
|
* Finalize imports for a service:
|