ts-openapi-codegen 2.0.0-beta.8 → 2.0.0-beta.9
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/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/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +4 -5
- package/dist/cli/index.js +5 -5
- 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 +12 -5
- 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 +4 -1
- package/dist/common/LoggerMessages.js +1 -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/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/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 -30
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +47 -72
- 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 +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/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/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/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 +12 -8
- 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 +2 -2
- 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.js +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/utils/__tests__/isSubdirectory.test.js +2 -2
- 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/templatesCompiled/client/exportService.js +1 -1
- 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/package.json +1 -1
- 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/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/__tests__/getRelativeModelPath.test.d.ts +0 -2
- package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/getRelativeModelPath.test.js +0 -21
- package/dist/core/utils/getRelativeModelPath.d.ts +0 -9
- package/dist/core/utils/getRelativeModelPath.d.ts.map +0 -1
- package/dist/core/utils/getRelativeModelPath.js +0 -37
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateDataToLatestSchemaVersion = migrateDataToLatestSchemaVersion;
|
|
4
4
|
const Enums_1 = require("../../Enums");
|
|
5
|
+
const validateZodOptions_1 = require("../../Validation/validateZodOptions");
|
|
5
6
|
const determineBestMatchingSchemaVersion_1 = require("./determineBestMatchingSchemaVersion");
|
|
6
7
|
const generateKeyMappingForInvalidKeys_1 = require("./generateKeyMappingForInvalidKeys");
|
|
7
8
|
const getCurrentErrorMessage_1 = require("./getCurrentErrorMessage");
|
|
@@ -23,9 +24,9 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
|
|
|
23
24
|
const actualSchema = versionedSchemas[actualVersionIndex];
|
|
24
25
|
for (let idx = guessedVersion.lastVersionIndex; idx < versionedSchemas.length - 1; idx++) {
|
|
25
26
|
const currentVersionSchema = versionedSchemas[idx];
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
(0, getCurrentErrorMessage_1.getCurrentErrorMessage)(
|
|
27
|
+
const firstValidationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(currentVersionSchema.schema, currentData);
|
|
28
|
+
if (!firstValidationResult.success) {
|
|
29
|
+
(0, getCurrentErrorMessage_1.getCurrentErrorMessage)(firstValidationResult.error, replacingKeysMap);
|
|
29
30
|
}
|
|
30
31
|
const fromVersion = currentVersionSchema.version;
|
|
31
32
|
const migrationPlan = migrationPlans.find(p => p.fromVersion === fromVersion);
|
|
@@ -37,10 +38,10 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
|
|
|
37
38
|
}
|
|
38
39
|
const toVersion = versionedSchemas[idx + 1].version;
|
|
39
40
|
const migratedRaw = migrationPlan.migrate(currentData);
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
41
|
+
const validationResult = (0, validateZodOptions_1.validateZodOptions)(versionedSchemas[idx + 1].schema, migratedRaw);
|
|
42
|
+
if (!validationResult.success) {
|
|
42
43
|
throw new Error(`Migration from ${fromVersion} to ${toVersion} failed validation. ` +
|
|
43
|
-
`Error: ${
|
|
44
|
+
`Error: ${validationResult.errors.join('\n')}. ` +
|
|
44
45
|
`Migration description: ${migrationPlan.description || 'No description provided'}.`);
|
|
45
46
|
}
|
|
46
47
|
currentData = { ...migratedRaw };
|
|
@@ -49,9 +50,9 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
|
|
|
49
50
|
console.warn('Для выполнения генерации OpenApi потребовалось мигрировать схему Ваших данных на актуальную. Для обновленмя конфигурации в файле используйте команду `npm name_cli_tool update-config`');
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
(0, getCurrentErrorMessage_1.getCurrentErrorMessage)(error, replacingKeysMap);
|
|
53
|
+
const validationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(actualSchema.schema, currentData);
|
|
54
|
+
if (!validationResult.success) {
|
|
55
|
+
(0, getCurrentErrorMessage_1.getCurrentErrorMessage)(validationResult.error, replacingKeysMap);
|
|
55
56
|
}
|
|
56
57
|
return { value: currentData, guessedVersion, schemaVersion: actualSchema.version, schemaType: actualSchema.type };
|
|
57
58
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependentOptionsRefinement.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/refinements/dependentOptionsRefinement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,QA2C7E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dependentOptionsRefinement = dependentOptionsRefinement;
|
|
4
|
+
function dependentOptionsRefinement(data, ctx) {
|
|
5
|
+
// Проверка: либо items, либо input+output должны быть указаны
|
|
6
|
+
const hasItems = data.items && data.items.length > 0;
|
|
7
|
+
const hasInputOutput = !!(data.input && data.output);
|
|
8
|
+
if (!hasItems && !hasInputOutput) {
|
|
9
|
+
ctx.addIssue({
|
|
10
|
+
code: 'custom',
|
|
11
|
+
message: 'Either "items" array or "input" + "output" must be provided',
|
|
12
|
+
path: [],
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
// Если есть items, то input и output в корне не должны быть указаны
|
|
16
|
+
if (hasItems && hasInputOutput) {
|
|
17
|
+
ctx.addIssue({
|
|
18
|
+
code: 'custom',
|
|
19
|
+
message: 'Cannot use both "items" array and "input"/"output" at the root level',
|
|
20
|
+
path: ['items'],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
// Валидация: если excludeCoreServiceFiles === true, request не должен быть указан
|
|
24
|
+
if (data.excludeCoreServiceFiles === true && data.request) {
|
|
25
|
+
ctx.addIssue({
|
|
26
|
+
code: 'custom',
|
|
27
|
+
message: '"request" can only be used when "excludeCoreServiceFiles" is false',
|
|
28
|
+
path: ['request'],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Валидация для каждого элемента в items
|
|
32
|
+
if (hasItems && data.items) {
|
|
33
|
+
data.items.forEach((item, index) => {
|
|
34
|
+
if (item.request && data.excludeCoreServiceFiles === true) {
|
|
35
|
+
ctx.addIssue({
|
|
36
|
+
code: 'custom',
|
|
37
|
+
message: '"request" in items can only be used when "excludeCoreServiceFiles" is false',
|
|
38
|
+
path: ['items', index, 'request'],
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { unifiedOptionsShape } from '../AllVersionedSchemas/UnifiedBase';
|
|
3
|
+
export declare function singleOrMultiRefinement(data: z.infer<typeof unifiedOptionsShape>, ctx: z.RefinementCtx): void;
|
|
4
|
+
//# sourceMappingURL=singleOrMultiRefinement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleOrMultiRefinement.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/refinements/singleOrMultiRefinement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,QAmBtG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.singleOrMultiRefinement = singleOrMultiRefinement;
|
|
4
|
+
function singleOrMultiRefinement(data, ctx) {
|
|
5
|
+
const hasItems = !!data.items?.length;
|
|
6
|
+
const hasSingle = !!data.input;
|
|
7
|
+
if (hasItems && hasSingle) {
|
|
8
|
+
ctx.addIssue({
|
|
9
|
+
code: 'custom',
|
|
10
|
+
message: 'Use either items or input/output, but not both options.',
|
|
11
|
+
path: ['items'],
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (!hasItems && !hasSingle) {
|
|
15
|
+
ctx.addIssue({
|
|
16
|
+
code: 'custom',
|
|
17
|
+
message: 'You must specify either items or input/output',
|
|
18
|
+
path: ['input'],
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/core/Context.d.ts
CHANGED
|
@@ -33,28 +33,29 @@ export declare class Context {
|
|
|
33
33
|
prefix: PrefixArtifacts;
|
|
34
34
|
private _sortByRequired;
|
|
35
35
|
private specRoot;
|
|
36
|
+
private entryFile?;
|
|
36
37
|
private virtualFiles;
|
|
37
38
|
constructor({ input, output, prefix, sortByRequired }: TContextProps);
|
|
38
39
|
addRefs(refs: RefsLike): Context;
|
|
39
40
|
values(...types: string[]): Record<string, any>;
|
|
40
|
-
get($ref: string): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type;
|
|
41
|
+
get($ref: string, parentSourceFile?: string): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type;
|
|
41
42
|
paths(...types: string[]): string[];
|
|
42
|
-
exists($ref: string): boolean;
|
|
43
|
+
exists($ref: string, parentSourceFile?: string): boolean;
|
|
43
44
|
fileName(): string;
|
|
44
45
|
get output(): OutputPaths;
|
|
45
46
|
get sortByRequired(): boolean;
|
|
46
47
|
get root(): $Root | undefined;
|
|
47
48
|
private canonicalizeRef;
|
|
48
49
|
private mapSourceToOutput;
|
|
49
|
-
private
|
|
50
|
-
private walkSchema;
|
|
50
|
+
private walkSchemaForFragments;
|
|
51
51
|
initializeVirtualFileMap(rootSchema: unknown, entryFile: string): void;
|
|
52
52
|
getVirtualFiles(): VirtualFileMap;
|
|
53
53
|
getAllCanonicalRefs(): string[];
|
|
54
|
-
resolveCanonicalRef(canonicalRef: string): {
|
|
54
|
+
resolveCanonicalRef(canonicalRef: string, parentSourceFile?: string): {
|
|
55
55
|
outputFile: string;
|
|
56
56
|
fragment?: string;
|
|
57
57
|
} | undefined;
|
|
58
|
+
private normalizeRefForLookup;
|
|
58
59
|
}
|
|
59
60
|
export {};
|
|
60
61
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/core/Context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIhF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/core/Context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIhF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAMhD,KAAK,aAAa,GAAG;IACjB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,QAAQ,GAAG;IACZ,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,eAAe,GAAG,eAAe,GAAG,eAAe,CAAC;IAC7E,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;CACvC,CAAC;AAEF,UAAU,WAAW;IACjB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IAEnB,wDAAwD;IACxD,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,KAAK,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE/C;;GAEG;AACH,qBAAa,OAAO;IAChB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,OAAO,CAAc;IACtB,MAAM,EAAE,eAAe,CAI5B;IAEF,OAAO,CAAC,eAAe,CAAkB;IAEzC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,YAAY,CAA6B;gBAErC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,aAAa;IAmB7D,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAKhC,MAAM,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAO/C,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe;IAQjG,KAAK,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAOnC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO;IAQxD,QAAQ,IAAI,MAAM;IAOzB,IAAW,MAAM,gBAKhB;IAED,IAAW,cAAc,YAExB;IAED,IAAW,IAAI,IAAI,KAAK,GAAG,SAAS,CAEnC;IAED,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,sBAAsB;IA+BvB,wBAAwB,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAuC/D,eAAe,IAAI,cAAc;IAIjC,mBAAmB,IAAI,MAAM,EAAE;IAgB/B,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GACpE;QACI,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB,GACD,SAAS;IAef,OAAO,CAAC,qBAAqB;CAyBhC"}
|
package/dist/core/Context.js
CHANGED
|
@@ -5,6 +5,7 @@ const path_1 = require("path");
|
|
|
5
5
|
const pathHelpers_1 = require("../common/utils/pathHelpers");
|
|
6
6
|
const getFileName_1 = require("./utils/getFileName");
|
|
7
7
|
const isString_1 = require("./utils/isString");
|
|
8
|
+
const normalizeRef_1 = require("./utils/normalizeRef");
|
|
8
9
|
const parseRef_1 = require("./utils/parseRef");
|
|
9
10
|
/**
|
|
10
11
|
* A Context wich can share a data between methods
|
|
@@ -20,6 +21,7 @@ class Context {
|
|
|
20
21
|
};
|
|
21
22
|
_sortByRequired = false;
|
|
22
23
|
specRoot;
|
|
24
|
+
entryFile;
|
|
23
25
|
virtualFiles = new Map();
|
|
24
26
|
constructor({ input, output, prefix, sortByRequired }) {
|
|
25
27
|
this._output = output;
|
|
@@ -48,11 +50,12 @@ class Context {
|
|
|
48
50
|
}
|
|
49
51
|
return this._refs.values(...types);
|
|
50
52
|
}
|
|
51
|
-
get($ref) {
|
|
53
|
+
get($ref, parentSourceFile) {
|
|
52
54
|
if (!this._refs) {
|
|
53
55
|
throw new Error('Context must be initialized');
|
|
54
56
|
}
|
|
55
|
-
|
|
57
|
+
const normalizedRef = this.normalizeRefForLookup($ref, parentSourceFile);
|
|
58
|
+
return this._refs.get(normalizedRef);
|
|
56
59
|
}
|
|
57
60
|
paths(...types) {
|
|
58
61
|
if (!this._refs) {
|
|
@@ -60,11 +63,12 @@ class Context {
|
|
|
60
63
|
}
|
|
61
64
|
return this._refs.paths(...types);
|
|
62
65
|
}
|
|
63
|
-
exists($ref) {
|
|
66
|
+
exists($ref, parentSourceFile) {
|
|
64
67
|
if (!this._refs) {
|
|
65
68
|
throw new Error('Context must be initialized');
|
|
66
69
|
}
|
|
67
|
-
|
|
70
|
+
const normalizedRef = this.normalizeRefForLookup($ref, parentSourceFile);
|
|
71
|
+
return this._refs.exists(normalizedRef);
|
|
68
72
|
}
|
|
69
73
|
fileName() {
|
|
70
74
|
if (!this._root) {
|
|
@@ -107,38 +111,36 @@ class Context {
|
|
|
107
111
|
const baseName = (0, path_1.basename)(relative).replace(/\.(yaml|yml|json)$/i, '.ts');
|
|
108
112
|
return (0, pathHelpers_1.resolveHelper)(this.output.outputModels, dir, baseName);
|
|
109
113
|
}
|
|
110
|
-
|
|
111
|
-
const { sourceFile, fragment } = this.canonicalizeRef(ref, parentSourceFile);
|
|
112
|
-
let entry = this.virtualFiles.get(sourceFile);
|
|
113
|
-
if (!entry) {
|
|
114
|
-
entry = {
|
|
115
|
-
sourceFile,
|
|
116
|
-
outputFile: this.mapSourceToOutput(sourceFile),
|
|
117
|
-
fragments: new Set(),
|
|
118
|
-
};
|
|
119
|
-
this.virtualFiles.set(sourceFile, entry);
|
|
120
|
-
}
|
|
121
|
-
if (fragment) {
|
|
122
|
-
entry.fragments.add(fragment);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
walkSchema(obj, parentSourceFile) {
|
|
114
|
+
walkSchemaForFragments(obj, parentSourceFile) {
|
|
126
115
|
if (!obj || typeof obj !== 'object')
|
|
127
116
|
return;
|
|
128
117
|
if (typeof obj.$ref === 'string') {
|
|
129
|
-
this.
|
|
118
|
+
const { sourceFile, fragment } = this.canonicalizeRef(obj.$ref, parentSourceFile);
|
|
119
|
+
let entry = this.virtualFiles.get(sourceFile);
|
|
120
|
+
if (!entry) {
|
|
121
|
+
entry = {
|
|
122
|
+
sourceFile,
|
|
123
|
+
outputFile: this.mapSourceToOutput(sourceFile),
|
|
124
|
+
fragments: new Set(),
|
|
125
|
+
};
|
|
126
|
+
this.virtualFiles.set(sourceFile, entry);
|
|
127
|
+
}
|
|
128
|
+
if (fragment) {
|
|
129
|
+
entry.fragments.add(fragment);
|
|
130
|
+
}
|
|
130
131
|
}
|
|
131
132
|
if (Array.isArray(obj)) {
|
|
132
|
-
obj.forEach(item => this.
|
|
133
|
+
obj.forEach(item => this.walkSchemaForFragments(item, parentSourceFile));
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
for (const value of Object.values(obj)) {
|
|
136
|
-
this.
|
|
137
|
+
this.walkSchemaForFragments(value, parentSourceFile);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
initializeVirtualFileMap(rootSchema, entryFile) {
|
|
140
141
|
this.specRoot = (0, pathHelpers_1.normalizeHelper)((0, pathHelpers_1.dirNameHelper)(entryFile));
|
|
141
142
|
const normalizedEntry = (0, pathHelpers_1.normalizeHelper)(entryFile);
|
|
143
|
+
this.entryFile = normalizedEntry;
|
|
142
144
|
// Гарантируем, что entry файл тоже есть в карте
|
|
143
145
|
if (!this.virtualFiles.has(normalizedEntry)) {
|
|
144
146
|
this.virtualFiles.set(normalizedEntry, {
|
|
@@ -147,7 +149,26 @@ class Context {
|
|
|
147
149
|
fragments: new Set(),
|
|
148
150
|
});
|
|
149
151
|
}
|
|
150
|
-
|
|
152
|
+
// 🔴 Вместо ручного обхода, использовать resolved.paths() от SwaggerParser
|
|
153
|
+
// это даст нам все файлы, которые парсер разрешил
|
|
154
|
+
const allPaths = this._refs?.paths() || [];
|
|
155
|
+
for (const refPath of allPaths) {
|
|
156
|
+
const normalizedPath = (0, pathHelpers_1.normalizeHelper)(refPath);
|
|
157
|
+
if (!this.virtualFiles.has(normalizedPath)) {
|
|
158
|
+
this.virtualFiles.set(normalizedPath, {
|
|
159
|
+
sourceFile: normalizedPath,
|
|
160
|
+
outputFile: this.mapSourceToOutput(normalizedPath),
|
|
161
|
+
fragments: new Set(),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Обходим каждый файл чтобы найти $ref с фрагментами (#)
|
|
166
|
+
for (const [sourceFile] of this.virtualFiles) {
|
|
167
|
+
const schema = this._refs?.get(sourceFile);
|
|
168
|
+
if (schema && typeof schema === 'object') {
|
|
169
|
+
this.walkSchemaForFragments(schema, sourceFile);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
151
172
|
}
|
|
152
173
|
getVirtualFiles() {
|
|
153
174
|
return this.virtualFiles;
|
|
@@ -166,8 +187,9 @@ class Context {
|
|
|
166
187
|
}
|
|
167
188
|
return result;
|
|
168
189
|
}
|
|
169
|
-
resolveCanonicalRef(canonicalRef) {
|
|
170
|
-
const
|
|
190
|
+
resolveCanonicalRef(canonicalRef, parentSourceFile) {
|
|
191
|
+
const normalizedRef = this.normalizeRefForLookup(canonicalRef, parentSourceFile);
|
|
192
|
+
const parsed = (0, parseRef_1.parseRef)(normalizedRef);
|
|
171
193
|
const sourceFile = (0, pathHelpers_1.normalizeHelper)(parsed.filePath ?? '');
|
|
172
194
|
const file = this.virtualFiles.get(sourceFile);
|
|
173
195
|
if (!file)
|
|
@@ -177,5 +199,26 @@ class Context {
|
|
|
177
199
|
fragment: parsed.fragment,
|
|
178
200
|
};
|
|
179
201
|
}
|
|
202
|
+
normalizeRefForLookup(ref, parentSourceFile) {
|
|
203
|
+
if (!ref)
|
|
204
|
+
return ref;
|
|
205
|
+
// Prefer explicit parent if provided
|
|
206
|
+
if (parentSourceFile) {
|
|
207
|
+
const normalizedParent = (0, path_1.isAbsolute)(parentSourceFile)
|
|
208
|
+
? parentSourceFile
|
|
209
|
+
: (0, pathHelpers_1.resolveHelper)(this.specRoot, parentSourceFile);
|
|
210
|
+
return (0, normalizeRef_1.normalizeRef)(ref, normalizedParent);
|
|
211
|
+
}
|
|
212
|
+
// If we can fall back to entry file, normalize relative refs against it
|
|
213
|
+
if (this.entryFile) {
|
|
214
|
+
const parsed = (0, parseRef_1.parseRef)(ref);
|
|
215
|
+
if (parsed.type === parseRef_1.RefType.LOCAL_FRAGMENT ||
|
|
216
|
+
parsed.type === parseRef_1.RefType.EXTERNAL_FILE ||
|
|
217
|
+
parsed.type === parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT) {
|
|
218
|
+
return (0, normalizeRef_1.normalizeRef)(ref, this.entryFile);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return ref;
|
|
222
|
+
}
|
|
180
223
|
}
|
|
181
224
|
exports.Context = Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenApiClient.d.ts","sourceRoot":"","sources":["../../src/core/OpenApiClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,WAAW,EAAsB,MAAM,uBAAuB,CAAC;AAetF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,aAAa;IACtB,OAAO,CAAC,YAAY,CAA4B;IAEhD,IAAW,WAAW,gBAKrB;IAED,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"OpenApiClient.d.ts","sourceRoot":"","sources":["../../src/core/OpenApiClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,WAAW,EAAsB,MAAM,uBAAuB,CAAC;AAetF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,aAAa;IACtB,OAAO,CAAC,YAAY,CAA4B;IAEhD,IAAW,WAAW,gBAKrB;IAED,OAAO,CAAC,gBAAgB;IAmDxB,OAAO,CAAC,gBAAgB;YA0BV,sBAAsB;YAUtB,oBAAoB;YAmCpB,cAAc;IAkFtB,QAAQ,CAAC,UAAU,EAAE,WAAW;CAWzC"}
|
|
@@ -29,9 +29,11 @@ class OpenApiClient {
|
|
|
29
29
|
// Для items: Наследуем глобальный request, если не переопределён
|
|
30
30
|
return rawOptions.items.map(item => ({
|
|
31
31
|
...item,
|
|
32
|
+
httpClient: rawOptions.httpClient,
|
|
32
33
|
request: item.request ?? rawOptions.request, // ?? для fallback на глобальный
|
|
33
34
|
useOptions: rawOptions.useOptions,
|
|
34
35
|
useUnionTypes: rawOptions.useUnionTypes,
|
|
36
|
+
includeSchemasFiles: rawOptions.includeSchemasFiles,
|
|
35
37
|
excludeCoreServiceFiles: rawOptions.excludeCoreServiceFiles,
|
|
36
38
|
interfacePrefix: rawOptions.interfacePrefix,
|
|
37
39
|
enumPrefix: rawOptions.enumPrefix,
|
|
@@ -57,6 +59,7 @@ class OpenApiClient {
|
|
|
57
59
|
httpClient: rawOptions.httpClient,
|
|
58
60
|
useOptions: rawOptions.useOptions,
|
|
59
61
|
useUnionTypes: rawOptions.useUnionTypes,
|
|
62
|
+
includeSchemasFiles: rawOptions.includeSchemasFiles,
|
|
60
63
|
excludeCoreServiceFiles: rawOptions.excludeCoreServiceFiles,
|
|
61
64
|
request: rawOptions.request,
|
|
62
65
|
interfacePrefix: rawOptions.interfacePrefix,
|
|
@@ -83,6 +86,7 @@ class OpenApiClient {
|
|
|
83
86
|
httpClient: item.httpClient || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.httpClient,
|
|
84
87
|
useOptions: item.useOptions ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useOptions,
|
|
85
88
|
useUnionTypes: item.useUnionTypes ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useUnionTypes,
|
|
89
|
+
includeSchemasFiles: item.includeSchemasFiles ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.includeSchemasFiles,
|
|
86
90
|
excludeCoreServiceFiles: item.excludeCoreServiceFiles ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.excludeCoreServiceFiles,
|
|
87
91
|
request: item.request || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.request,
|
|
88
92
|
interfacePrefix: item.interfacePrefix || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.interfacePrefix,
|
|
@@ -110,16 +114,16 @@ class OpenApiClient {
|
|
|
110
114
|
}
|
|
111
115
|
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.STARTED(items.length));
|
|
112
116
|
try {
|
|
113
|
-
const start = process.hrtime();
|
|
117
|
+
const start = process.hrtime.bigint();
|
|
114
118
|
for (const option of items) {
|
|
115
119
|
await this.cleanOutputDirectories(option);
|
|
116
120
|
}
|
|
117
121
|
for (const option of items) {
|
|
118
|
-
const fileStart = process.hrtime();
|
|
122
|
+
const fileStart = process.hrtime.bigint();
|
|
119
123
|
await this.generateSingle(option);
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
this.writeClient.logger.
|
|
124
|
+
const fileEnd = process.hrtime.bigint();
|
|
125
|
+
const fileDurationInSeconds = Number(fileEnd - fileStart) / 1e9;
|
|
126
|
+
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.DURATION_FOR_FILE(option.input, fileDurationInSeconds.toFixed(3)));
|
|
123
127
|
}
|
|
124
128
|
if (items[0]?.useSeparatedIndexes) {
|
|
125
129
|
await this.writeClient.combineAndWrightSimple();
|
|
@@ -128,9 +132,9 @@ class OpenApiClient {
|
|
|
128
132
|
await this.writeClient.combineAndWrite();
|
|
129
133
|
}
|
|
130
134
|
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED);
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED_WITH_DURATION(
|
|
135
|
+
const end = process.hrtime.bigint();
|
|
136
|
+
const durationInSeconds = Number(end - start) / 1e9;
|
|
137
|
+
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED_WITH_DURATION(durationInSeconds.toFixed(3)));
|
|
134
138
|
}
|
|
135
139
|
catch (error) {
|
|
136
140
|
this.writeClient.logger.error(LoggerMessages_1.LOGGER_MESSAGES.ERROR.GENERIC(error.message));
|
|
@@ -15,7 +15,7 @@ export declare class Parser {
|
|
|
15
15
|
_context: Context;
|
|
16
16
|
constructor(context: Context);
|
|
17
17
|
get context(): Context;
|
|
18
|
-
getTypeNameByRef(value: string, ref?: string): string;
|
|
18
|
+
getTypeNameByRef(value: string, ref: string, parentSourceFile?: string): string;
|
|
19
19
|
parse: typeof parse;
|
|
20
20
|
getModels: typeof getModels;
|
|
21
21
|
getType: typeof getType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../../../src/core/api/v2/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,MAAM;IACR,QAAQ,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,OAAO;IAI5B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"Parser.d.ts","sourceRoot":"","sources":["../../../../src/core/api/v2/Parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,MAAM;IACR,QAAQ,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,OAAO;IAI5B,IAAI,OAAO,IAAI,OAAO,CAErB;IAEM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAS/E,KAAK,eAAS;IACd,SAAS,mBAAa;IACtB,OAAO,iBAAW;IAClB,QAAQ,kBAAY;IACpB,mBAAmB,6BAAuB;IAC1C,kBAAkB,4BAAsB;IACxC,WAAW,qBAAe;IAC1B,sBAAsB,gCAA0B;IAChD,qBAAqB,+BAAyB;IAC9C,YAAY,sBAAgB;IAC5B,qBAAqB,+BAAyB;IAC9C,oBAAoB,8BAAwB;CACtD"}
|
|
@@ -22,9 +22,9 @@ class Parser {
|
|
|
22
22
|
get context() {
|
|
23
23
|
return this._context;
|
|
24
24
|
}
|
|
25
|
-
getTypeNameByRef(value, ref) {
|
|
25
|
+
getTypeNameByRef(value, ref, parentSourceFile) {
|
|
26
26
|
if (ref) {
|
|
27
|
-
const definition = this.context.get(ref);
|
|
27
|
+
const definition = this.context.get(ref, parentSourceFile);
|
|
28
28
|
return (0, getModelNameWithPrefix_1.getModelNameWithPrefix)(value, definition, this._context.prefix);
|
|
29
29
|
}
|
|
30
30
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getModel.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"getModel.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAM/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,KAAK,CAyJjE"}
|
|
@@ -6,7 +6,6 @@ const getComment_1 = require("../../../utils/getComment");
|
|
|
6
6
|
const getEnum_1 = require("../../../utils/getEnum");
|
|
7
7
|
const getEnumFromDescription_1 = require("../../../utils/getEnumFromDescription");
|
|
8
8
|
const getPattern_1 = require("../../../utils/getPattern");
|
|
9
|
-
const normalizeRef_1 = require("../../../utils/normalizeRef");
|
|
10
9
|
function getModel(config) {
|
|
11
10
|
const { openApi, definition, isDefinition = false, name = '', path = '', parentRef } = config;
|
|
12
11
|
const model = {
|
|
@@ -45,8 +44,7 @@ function getModel(config) {
|
|
|
45
44
|
properties: [],
|
|
46
45
|
};
|
|
47
46
|
if (definition.$ref) {
|
|
48
|
-
const
|
|
49
|
-
const definitionRef = this.getType(definition.$ref, normalizedRef);
|
|
47
|
+
const definitionRef = this.getType(definition.$ref, parentRef);
|
|
50
48
|
model.export = 'reference';
|
|
51
49
|
model.type = definitionRef.type;
|
|
52
50
|
model.base = definitionRef.base;
|
|
@@ -77,8 +75,7 @@ function getModel(config) {
|
|
|
77
75
|
}
|
|
78
76
|
if (definition.type === 'array' && definition.items) {
|
|
79
77
|
if (definition.items.$ref) {
|
|
80
|
-
const
|
|
81
|
-
const arrayItems = this.getType(definition.items.$ref, normalizedRef);
|
|
78
|
+
const arrayItems = this.getType(definition.items.$ref, parentRef);
|
|
82
79
|
model.export = 'array';
|
|
83
80
|
model.type = arrayItems.type;
|
|
84
81
|
model.base = arrayItems.base;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModelProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModelProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE,CAgFxH"}
|
|
@@ -5,7 +5,6 @@ const safeHasOwn_1 = require("../../../../common/utils/safeHasOwn");
|
|
|
5
5
|
const escapeName_1 = require("../../../utils/escapeName");
|
|
6
6
|
const getComment_1 = require("../../../utils/getComment");
|
|
7
7
|
const getPattern_1 = require("../../../utils/getPattern");
|
|
8
|
-
const normalizeRef_1 = require("../../../utils/normalizeRef");
|
|
9
8
|
function getModelProperties(openApi, definition, parentRef) {
|
|
10
9
|
const models = [];
|
|
11
10
|
for (const propertyName in definition.properties) {
|
|
@@ -13,8 +12,7 @@ function getModelProperties(openApi, definition, parentRef) {
|
|
|
13
12
|
const property = definition.properties[propertyName];
|
|
14
13
|
const propertyRequired = definition.required?.includes(propertyName) || property.default !== undefined;
|
|
15
14
|
if (property.$ref) {
|
|
16
|
-
const
|
|
17
|
-
const model = this.getType(property.$ref, normalizedRef);
|
|
15
|
+
const model = this.getType(property.$ref, parentRef);
|
|
18
16
|
models.push({
|
|
19
17
|
name: (0, escapeName_1.escapeName)(propertyName),
|
|
20
18
|
alias: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAI/D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,CAsBjE"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getModels = getModels;
|
|
4
|
-
const getModelNameWithPrefix_1 = require("../../../utils/getModelNameWithPrefix");
|
|
5
4
|
const modelHelpers_1 = require("../../../utils/modelHelpers");
|
|
6
5
|
const sortModelsByName_1 = require("../../../utils/sortModelsByName");
|
|
7
6
|
const unique_1 = require("../../../utils/unique");
|
|
@@ -16,7 +15,7 @@ function getModels(openApi) {
|
|
|
16
15
|
openApi: openApi,
|
|
17
16
|
definition: definition,
|
|
18
17
|
isDefinition: true,
|
|
19
|
-
name:
|
|
18
|
+
name: definitionType.base,
|
|
20
19
|
path: definitionType.path,
|
|
21
20
|
parentRef: modelRef,
|
|
22
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationParameter.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationParameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"getOperationParameter.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationParameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAOzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAsIxI"}
|
|
@@ -7,7 +7,6 @@ const getEnum_1 = require("../../../utils/getEnum");
|
|
|
7
7
|
const getEnumFromDescription_1 = require("../../../utils/getEnumFromDescription");
|
|
8
8
|
const getOperationParameterName_1 = require("../../../utils/getOperationParameterName");
|
|
9
9
|
const getPattern_1 = require("../../../utils/getPattern");
|
|
10
|
-
const normalizeRef_1 = require("../../../utils/normalizeRef");
|
|
11
10
|
const getOperationParameterDefault_1 = require("./getOperationParameterDefault");
|
|
12
11
|
function getOperationParameter(openApi, parameter, parentRef) {
|
|
13
12
|
const operationParameter = {
|
|
@@ -45,8 +44,7 @@ function getOperationParameter(openApi, parameter, parentRef) {
|
|
|
45
44
|
mediaType: null,
|
|
46
45
|
};
|
|
47
46
|
if (parameter.$ref) {
|
|
48
|
-
const
|
|
49
|
-
const definitionRef = this.getType(parameter.$ref, normalizedRef);
|
|
47
|
+
const definitionRef = this.getType(parameter.$ref, parentRef);
|
|
50
48
|
operationParameter.export = 'reference';
|
|
51
49
|
operationParameter.type = definitionRef.type;
|
|
52
50
|
operationParameter.base = definitionRef.base;
|
|
@@ -101,8 +99,7 @@ function getOperationParameter(openApi, parameter, parentRef) {
|
|
|
101
99
|
}
|
|
102
100
|
if (parameter.schema) {
|
|
103
101
|
if (parameter.schema.$ref) {
|
|
104
|
-
const
|
|
105
|
-
const model = this.getType(parameter.schema.$ref, normalizedRef);
|
|
102
|
+
const model = this.getType(parameter.schema.$ref, parentRef);
|
|
106
103
|
operationParameter.export = 'reference';
|
|
107
104
|
operationParameter.type = model.type;
|
|
108
105
|
operationParameter.base = model.base;
|
|
@@ -16,7 +16,7 @@ function getOperationParameters(openApi, parameters, parentRef) {
|
|
|
16
16
|
};
|
|
17
17
|
// Iterate over the parameters
|
|
18
18
|
parameters.forEach(parameterOrReference => {
|
|
19
|
-
const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref) : parameterOrReference);
|
|
19
|
+
const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref, parentRef) : parameterOrReference);
|
|
20
20
|
const parameter = this.getOperationParameter(openApi, parameterDef, parentRef);
|
|
21
21
|
// We ignore the "api-version" param, since we do not want to add this
|
|
22
22
|
// as the first / default parameter for each of the service calls.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAGvF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,CAmF1J"}
|
|
@@ -4,7 +4,6 @@ exports.getOperationResponse = getOperationResponse;
|
|
|
4
4
|
const safeHasOwn_1 = require("../../../../common/utils/safeHasOwn");
|
|
5
5
|
const getComment_1 = require("../../../utils/getComment");
|
|
6
6
|
const getPattern_1 = require("../../../utils/getPattern");
|
|
7
|
-
const normalizeRef_1 = require("../../../utils/normalizeRef");
|
|
8
7
|
function getOperationResponse(openApi, response, responseCode, parentRef) {
|
|
9
8
|
const operationResponse = {
|
|
10
9
|
in: 'response',
|
|
@@ -33,8 +32,7 @@ function getOperationResponse(openApi, response, responseCode, parentRef) {
|
|
|
33
32
|
// then we need to parse the schema!
|
|
34
33
|
if (response.schema) {
|
|
35
34
|
if (response.schema.$ref) {
|
|
36
|
-
const
|
|
37
|
-
const model = this.getType(response.schema.$ref, normalizedRef);
|
|
35
|
+
const model = this.getType(response.schema.$ref, parentRef);
|
|
38
36
|
operationResponse.export = 'reference';
|
|
39
37
|
operationResponse.type = model.type;
|
|
40
38
|
operationResponse.base = model.base;
|
|
@@ -10,7 +10,7 @@ function getOperationResponses(openApi, responses, parentRef) {
|
|
|
10
10
|
for (const code in responses) {
|
|
11
11
|
if ((0, safeHasOwn_1.safeHasOwn)(responses, code)) {
|
|
12
12
|
const responseOrReference = responses[code];
|
|
13
|
-
const response = (responseOrReference.$ref ? this.context.get(responseOrReference.$ref) : responseOrReference);
|
|
13
|
+
const response = (responseOrReference.$ref ? this.context.get(responseOrReference.$ref, parentRef) : responseOrReference);
|
|
14
14
|
const responseCode = (0, getOperationResponseCode_1.getOperationResponseCode)(code);
|
|
15
15
|
if (responseCode) {
|
|
16
16
|
const operationResponse = this.getOperationResponse(openApi, response, responseCode, parentRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getServices.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getServices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAiCrE"}
|