ts-openapi-codegen 1.0.0-beta.5 → 1.0.0-beta.7
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 +43 -58
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts +5 -0
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts.map +1 -0
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.js +40 -0
- package/dist/cli/generate/runGenerateOpenApi.js +4 -4
- package/dist/cli/index.js +57 -18
- package/dist/cli/utils.d.ts +4 -16
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +22 -20
- package/dist/common/Options.d.ts +4 -6
- package/dist/common/Options.d.ts.map +1 -1
- package/dist/common/UpdateNotifier.d.ts +24 -0
- package/dist/common/UpdateNotifier.d.ts.map +1 -0
- package/dist/common/UpdateNotifier.js +120 -0
- package/dist/common/Utils.d.ts.map +1 -1
- package/dist/common/Utils.js +8 -9
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +12 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +27 -1
- package/dist/common/VersionedSchema/{MultiOptionsMigrationPlan.d.ts → MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts} +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsMigrationPlan.js → MultiOptionsVersioned/MultiOptionsMigrationPlan.js} +18 -7
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV1.js → MultiOptionsVersioned/MultiOptionsSchemaV1.js} +4 -4
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV2.js → MultiOptionsVersioned/MultiOptionsSchemaV2.js} +4 -4
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +5 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV3.js → MultiOptionsVersioned/MultiOptionsSchemaV3.js} +3 -3
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV4.js → MultiOptionsVersioned/MultiOptionsSchemaV4.js} +4 -4
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +22 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsVersionedSchemas.js → MultiOptionsVersioned/MultiOptionsVersionedSchemas.js} +10 -5
- package/dist/common/VersionedSchema/{OptionsMigrationPlans.d.ts → OptionsVersioned/OptionsMigrationPlans.d.ts} +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +23 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +6 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsSchemaV1.js → OptionsVersioned/OptionsSchemaV1.js} +4 -4
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +6 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsSchemaV2.js → OptionsVersioned/OptionsSchemaV2.js} +4 -4
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +5 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsSchemaV3.js → OptionsVersioned/OptionsSchemaV3.js} +3 -3
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +6 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +17 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsVersionedSchemas.js → OptionsVersioned/OptionsVersionedSchemas.js} +9 -4
- package/dist/common/VersionedSchema/Types.d.ts +0 -4
- package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
- package/dist/common/__tests__/convertArrayToObject.test.js +62 -59
- package/dist/common/__tests__/mergeObjectSchemas.test.js +1 -1
- package/dist/common/__tests__/migrationForMultiOptions.test.js +9 -5
- package/dist/common/__tests__/migrationForOptions.test.js +17 -8
- package/dist/common/defaultOptions.d.ts.map +1 -1
- package/dist/common/defaultOptions.js +5 -7
- package/dist/core/Context.d.ts +15 -7
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +3 -0
- package/dist/core/WriteClient.d.ts +94 -0
- package/dist/core/WriteClient.d.ts.map +1 -0
- package/dist/core/WriteClient.js +293 -0
- package/dist/core/__tests__/WriteClient.test.d.ts +2 -0
- package/dist/core/__tests__/WriteClient.test.d.ts.map +1 -0
- package/dist/core/{utils/__tests__/writeClient.test.js → __tests__/WriteClient.test.js} +16 -12
- package/dist/core/api/v2/parser/__tests__/getType.test.js +7 -25
- package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModel.js +5 -2
- package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModelProperties.js +3 -1
- package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModels.js +3 -29
- package/dist/core/api/v2/parser/getOperation.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperation.js +3 -3
- package/dist/core/api/v2/parser/getOperationParameter.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationParameter.js +4 -2
- package/dist/core/api/v2/parser/getOperationParameters.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperationParameters.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationParameters.js +2 -2
- package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponse.js +3 -1
- package/dist/core/api/v2/parser/getOperationResponses.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.js +2 -2
- package/dist/core/api/v2/parser/getServiceName.d.ts +3 -0
- package/dist/core/api/v2/parser/getServiceName.d.ts.map +1 -0
- package/dist/core/api/v2/parser/getServiceName.js +8 -0
- package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getServices.js +21 -32
- package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getType.js +13 -9
- package/dist/core/api/v3/parser/__tests__/getType.test.js +6 -24
- package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModel.js +5 -2
- package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModelProperties.js +3 -1
- package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModels.js +3 -29
- package/dist/core/api/v3/parser/getOperation.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperation.js +4 -4
- package/dist/core/api/v3/parser/getOperationParameter.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationParameter.js +6 -3
- package/dist/core/api/v3/parser/getOperationParameters.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperationParameters.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationParameters.js +2 -2
- package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationRequestBody.js +3 -1
- package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponse.js +3 -1
- package/dist/core/api/v3/parser/getOperationResponses.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.js +2 -2
- package/dist/core/api/v3/parser/getServiceName.d.ts +3 -0
- package/dist/core/api/v3/parser/getServiceName.d.ts.map +1 -0
- package/dist/core/api/v3/parser/getServiceName.js +8 -0
- package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getServices.js +18 -84
- package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getType.js +22 -10
- package/dist/core/api/v3/types/OpenApiPath.model.d.ts +2 -1
- package/dist/core/api/v3/types/OpenApiPath.model.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +21 -22
- package/dist/core/types/base/ClientArtifacts.model.d.ts +12 -0
- package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -0
- package/dist/core/types/base/ExportedModel.model.d.ts +17 -0
- package/dist/core/types/base/ExportedModel.model.d.ts.map +1 -0
- package/dist/core/types/base/ExportedService.model.d.ts +9 -0
- package/dist/core/types/base/ExportedService.model.d.ts.map +1 -0
- package/dist/core/types/base/ExportedService.model.js +2 -0
- package/dist/core/types/base/OutputPaths.model.d.ts +15 -0
- package/dist/core/types/base/OutputPaths.model.d.ts.map +1 -0
- package/dist/core/types/base/OutputPaths.model.js +2 -0
- package/dist/core/types/base/PrefixArtifacts.model.d.ts +6 -0
- package/dist/core/types/base/PrefixArtifacts.model.d.ts.map +1 -0
- package/dist/core/types/base/PrefixArtifacts.model.js +2 -0
- package/dist/core/types/base/PropertyGroup.model.d.ts +4 -0
- package/dist/core/types/base/PropertyGroup.model.d.ts.map +1 -0
- package/dist/core/types/base/PropertyGroup.model.js +2 -0
- package/dist/core/types/base/RefWithtype.model.d.ts +11 -0
- package/dist/core/types/base/RefWithtype.model.d.ts.map +1 -0
- package/dist/core/types/base/RefWithtype.model.js +2 -0
- package/dist/core/types/base/Root.model.d.ts +5 -0
- package/dist/core/types/base/Root.model.d.ts.map +1 -0
- package/dist/core/types/base/Root.model.js +2 -0
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +10 -0
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -0
- package/dist/core/types/base/SimpleClientArtifacts.model.js +2 -0
- package/dist/core/types/enums/HttpClient.enum.d.ts +7 -0
- package/dist/core/types/enums/HttpClient.enum.d.ts.map +1 -0
- package/dist/core/types/{Enums.js → enums/HttpClient.enum.js} +1 -9
- package/dist/core/types/enums/TypeRef.enum.d.ts +8 -0
- package/dist/core/types/enums/TypeRef.enum.d.ts.map +1 -0
- package/dist/core/types/enums/TypeRef.enum.js +11 -0
- package/dist/core/utils/__tests__/getAbsolutePath.test.js +1 -1
- package/dist/core/utils/__tests__/getGatheringRefs.test.js +3 -6
- package/dist/core/utils/__tests__/getRefFromSchema.test.js +1 -1
- package/dist/core/utils/__tests__/pathHelpers.test.js +4 -4
- package/dist/core/utils/__tests__/refResolver.test.d.ts +2 -0
- package/dist/core/utils/__tests__/refResolver.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/refResolver.test.js +55 -0
- package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +2 -2
- package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +7 -3
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts +2 -0
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +67 -0
- package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +24 -24
- package/dist/core/utils/__tests__/sortByRequiredSimple.test.js +13 -13
- package/dist/core/utils/__tests__/writeClientCore.test.js +14 -6
- package/dist/core/utils/__tests__/writeClientFullIndex.test.d.ts +2 -0
- package/dist/core/utils/__tests__/writeClientFullIndex.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/{writeClientIndex.test.js → writeClientFullIndex.test.js} +15 -7
- package/dist/core/utils/__tests__/writeClientModels.test.js +15 -7
- package/dist/core/utils/__tests__/writeClientSchemas.test.js +15 -7
- package/dist/core/utils/__tests__/writeClientServices.test.js +15 -7
- package/dist/core/utils/advancedDeduplicatePath.d.ts +5 -0
- package/dist/core/utils/advancedDeduplicatePath.d.ts.map +1 -0
- package/dist/core/utils/advancedDeduplicatePath.js +29 -0
- package/dist/core/utils/appendUniqueLinesToFile.d.ts +2 -0
- package/dist/core/utils/appendUniqueLinesToFile.d.ts.map +1 -0
- package/dist/core/utils/appendUniqueLinesToFile.js +24 -0
- package/dist/core/utils/createNormalizedRef.d.ts +7 -0
- package/dist/core/utils/createNormalizedRef.d.ts.map +1 -0
- package/dist/core/utils/createNormalizedRef.js +24 -0
- package/dist/core/utils/findCommonParent.d.ts +7 -0
- package/dist/core/utils/findCommonParent.d.ts.map +1 -0
- package/dist/core/utils/findCommonParent.js +20 -0
- package/dist/core/utils/getAbsolutePath.d.ts.map +1 -1
- package/dist/core/utils/getAbsolutePath.js +16 -5
- package/dist/core/utils/getGatheringRefs.d.ts +2 -2
- package/dist/core/utils/getGatheringRefs.d.ts.map +1 -1
- package/dist/core/utils/getGatheringRefs.js +26 -17
- package/dist/core/utils/getMappedType.d.ts +0 -1
- package/dist/core/utils/getMappedType.d.ts.map +1 -1
- package/dist/core/utils/getMappedType.js +3 -4
- package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +9 -32
- package/dist/core/utils/getOutputPaths.d.ts +2 -2
- package/dist/core/utils/getOutputPaths.d.ts.map +1 -1
- package/dist/core/utils/getPropertyGroupExtended.d.ts +2 -2
- package/dist/core/utils/getPropertyGroupExtended.d.ts.map +1 -1
- package/dist/core/utils/getPropertyGroupSimple.d.ts +2 -2
- package/dist/core/utils/getPropertyGroupSimple.d.ts.map +1 -1
- package/dist/core/utils/getRefFromSchema.js +2 -2
- package/dist/core/utils/getRelativeModelImportPath.js +1 -1
- package/dist/core/utils/getRelativeModelPath.d.ts.map +1 -1
- package/dist/core/utils/getRelativeModelPath.js +5 -0
- package/dist/core/utils/isDirectory.d.ts +2 -0
- package/dist/core/utils/isDirectory.d.ts.map +1 -0
- package/dist/core/utils/isDirectory.js +13 -0
- package/dist/core/utils/isFileName.d.ts +7 -0
- package/dist/core/utils/isFileName.d.ts.map +1 -0
- package/dist/core/utils/isFileName.js +30 -0
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts +10 -0
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +1 -0
- package/dist/core/utils/mapPathToTargetDirSafe.js +49 -0
- package/dist/core/utils/modelHelpers.d.ts +28 -0
- package/dist/core/utils/modelHelpers.d.ts.map +1 -0
- package/dist/core/utils/modelHelpers.js +73 -0
- package/dist/core/utils/normalizeAllRefs.d.ts +6 -0
- package/dist/core/utils/normalizeAllRefs.d.ts.map +1 -0
- package/dist/core/utils/normalizeAllRefs.js +35 -0
- package/dist/core/utils/normalizePath.d.ts +5 -0
- package/dist/core/utils/normalizePath.d.ts.map +1 -0
- package/dist/core/utils/normalizePath.js +19 -0
- package/dist/core/utils/normalizeRef.d.ts +5 -0
- package/dist/core/utils/normalizeRef.d.ts.map +1 -0
- package/dist/core/utils/normalizeRef.js +17 -0
- package/dist/core/utils/parseRef.d.ts +18 -0
- package/dist/core/utils/parseRef.d.ts.map +1 -0
- package/dist/core/utils/parseRef.js +64 -0
- package/dist/core/utils/pathHelpers.d.ts +1 -0
- package/dist/core/utils/pathHelpers.d.ts.map +1 -1
- package/dist/core/utils/pathHelpers.js +23 -3
- package/dist/core/utils/prepareAlias.d.ts +3 -0
- package/dist/core/utils/prepareAlias.d.ts.map +1 -0
- package/dist/core/utils/prepareAlias.js +20 -0
- package/dist/core/utils/prepareOptions.d.ts.map +1 -1
- package/dist/core/utils/prepareOptions.js +5 -7
- package/dist/core/utils/registerHandlebarHelpers.d.ts +1 -1
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.d.ts +9 -2
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +16 -2
- package/dist/core/utils/resolveRefPath.d.ts +7 -0
- package/dist/core/utils/resolveRefPath.d.ts.map +1 -0
- package/dist/core/utils/resolveRefPath.js +34 -0
- package/dist/core/utils/resolveRefToImportPath.d.ts +7 -0
- package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -0
- package/dist/core/utils/resolveRefToImportPath.js +45 -0
- package/dist/core/utils/serviceHelpers.d.ts +41 -0
- package/dist/core/utils/serviceHelpers.d.ts.map +1 -0
- package/dist/core/utils/serviceHelpers.js +115 -0
- package/dist/core/utils/sortModelByName.d.ts +3 -0
- package/dist/core/utils/sortModelByName.d.ts.map +1 -0
- package/dist/core/utils/sortModelByName.js +12 -0
- package/dist/core/utils/writeClientCore.d.ts +4 -2
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +4 -1
- package/dist/core/utils/writeClientCoreIndex.d.ts +11 -0
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientCoreIndex.js +16 -0
- package/dist/core/utils/writeClientFullIndex.d.ts +9 -0
- package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientFullIndex.js +22 -0
- package/dist/core/utils/writeClientModels.d.ts +3 -2
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModels.js +5 -0
- package/dist/core/utils/writeClientModelsIndex.d.ts +12 -0
- package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientModelsIndex.js +16 -0
- package/dist/core/utils/writeClientSchemas.d.ts +3 -2
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +5 -0
- package/dist/core/utils/writeClientSchemasIndex.d.ts +12 -0
- package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientSchemasIndex.js +16 -0
- package/dist/core/utils/writeClientServices.d.ts +5 -4
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.js +4 -0
- package/dist/core/utils/writeClientServicesIndex.d.ts +12 -0
- package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientServicesIndex.js +16 -0
- package/dist/core/utils/writeClientSimpleIndex.d.ts +9 -0
- package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientSimpleIndex.js +22 -0
- package/dist/templatesCompiled/exportModel.js +2 -2
- package/dist/templatesCompiled/indexCore.d.ts +9 -0
- package/dist/templatesCompiled/indexCore.d.ts.map +1 -0
- package/dist/templatesCompiled/indexCore.js +22 -0
- package/dist/templatesCompiled/{index.d.ts → indexFull.d.ts} +1 -1
- package/dist/templatesCompiled/indexFull.d.ts.map +1 -0
- package/dist/templatesCompiled/indexModels.d.ts +15 -0
- package/dist/templatesCompiled/indexModels.d.ts.map +1 -0
- package/dist/templatesCompiled/indexModels.js +82 -0
- package/dist/templatesCompiled/indexServices.d.ts +10 -0
- package/dist/templatesCompiled/indexServices.d.ts.map +1 -0
- package/dist/templatesCompiled/indexServices.js +35 -0
- package/dist/templatesCompiled/indexShemas.d.ts +11 -0
- package/dist/templatesCompiled/indexShemas.d.ts.map +1 -0
- package/dist/templatesCompiled/indexShemas.js +47 -0
- package/dist/templatesCompiled/indexSimple.d.ts +21 -0
- package/dist/templatesCompiled/indexSimple.d.ts.map +1 -0
- package/dist/templatesCompiled/indexSimple.js +121 -0
- package/dist/templatesCompiled/partials/isReadOnly.d.ts +1 -1
- package/dist/templatesCompiled/partials/isReadOnly.d.ts.map +1 -1
- package/dist/templatesCompiled/partials/isReadOnly.js +1 -2
- package/dist/templatesCompiled/partials/isRequiredDefinition.d.ts +9 -0
- package/dist/templatesCompiled/partials/isRequiredDefinition.d.ts.map +1 -0
- package/dist/templatesCompiled/partials/isRequiredDefinition.js +27 -0
- package/dist/templatesCompiled/partials/parametersDefinition.js +1 -1
- package/package.json +15 -4
- package/dist/common/VersionedSchema/MultiOptionsMigrationPlan.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV1.d.ts +0 -6
- package/dist/common/VersionedSchema/MultiOptionsSchemaV1.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV2.d.ts +0 -6
- package/dist/common/VersionedSchema/MultiOptionsSchemaV2.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV3.d.ts +0 -5
- package/dist/common/VersionedSchema/MultiOptionsSchemaV3.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV4.d.ts +0 -6
- package/dist/common/VersionedSchema/MultiOptionsSchemaV4.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersionedSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/MultiOptionsVersionedSchemas.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsMigrationPlans.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsMigrationPlans.js +0 -15
- package/dist/common/VersionedSchema/OptionsSchemaV1.d.ts +0 -6
- package/dist/common/VersionedSchema/OptionsSchemaV1.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsSchemaV2.d.ts +0 -6
- package/dist/common/VersionedSchema/OptionsSchemaV2.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsSchemaV3.d.ts +0 -5
- package/dist/common/VersionedSchema/OptionsSchemaV3.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsVersionedSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/OptionsVersionedSchemas.d.ts.map +0 -1
- package/dist/core/types/Enums.d.ts +0 -14
- package/dist/core/types/Enums.d.ts.map +0 -1
- package/dist/core/types/Models.d.ts +0 -37
- package/dist/core/types/Models.d.ts.map +0 -1
- package/dist/core/types/shared/ConverterData.model.d.ts +0 -7
- package/dist/core/types/shared/ConverterData.model.d.ts.map +0 -1
- package/dist/core/utils/__tests__/writeClient.test.d.ts +0 -2
- package/dist/core/utils/__tests__/writeClient.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/writeClientIndex.test.d.ts +0 -2
- package/dist/core/utils/__tests__/writeClientIndex.test.d.ts.map +0 -1
- package/dist/core/utils/writeClient.d.ts +0 -89
- package/dist/core/utils/writeClient.d.ts.map +0 -1
- package/dist/core/utils/writeClient.js +0 -227
- package/dist/core/utils/writeClientIndex.d.ts +0 -59
- package/dist/core/utils/writeClientIndex.d.ts.map +0 -1
- package/dist/core/utils/writeClientIndex.js +0 -27
- package/dist/templatesCompiled/index.d.ts.map +0 -1
- /package/dist/core/types/{Models.js → base/ClientArtifacts.model.js} +0 -0
- /package/dist/core/types/{shared/ConverterData.model.js → base/ExportedModel.model.js} +0 -0
- /package/dist/templatesCompiled/{index.js → indexFull.js} +0 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WriteClient = void 0;
|
|
4
|
+
const Enums_1 = require("../common/Enums");
|
|
5
|
+
const Logger_1 = require("../common/Logger");
|
|
6
|
+
const fileSystem_1 = require("./utils/fileSystem");
|
|
7
|
+
const pathHelpers_1 = require("./utils/pathHelpers");
|
|
8
|
+
const prepareAlias_1 = require("./utils/prepareAlias");
|
|
9
|
+
const sortModelByName_1 = require("./utils/sortModelByName");
|
|
10
|
+
const unique_1 = require("./utils/unique");
|
|
11
|
+
const writeClientCore_1 = require("./utils/writeClientCore");
|
|
12
|
+
const writeClientCoreIndex_1 = require("./utils/writeClientCoreIndex");
|
|
13
|
+
const writeClientFullIndex_1 = require("./utils/writeClientFullIndex");
|
|
14
|
+
const writeClientModels_1 = require("./utils/writeClientModels");
|
|
15
|
+
const writeClientModelsIndex_1 = require("./utils/writeClientModelsIndex");
|
|
16
|
+
const writeClientSchemas_1 = require("./utils/writeClientSchemas");
|
|
17
|
+
const writeClientSchemasIndex_1 = require("./utils/writeClientSchemasIndex");
|
|
18
|
+
const writeClientServices_1 = require("./utils/writeClientServices");
|
|
19
|
+
const writeClientServicesIndex_1 = require("./utils/writeClientServicesIndex");
|
|
20
|
+
const writeClientSimpleIndex_1 = require("./utils/writeClientSimpleIndex");
|
|
21
|
+
/**
|
|
22
|
+
* The client which is writing all items and keep the parameters to write index file
|
|
23
|
+
*/
|
|
24
|
+
class WriteClient {
|
|
25
|
+
config = new Map();
|
|
26
|
+
_logger;
|
|
27
|
+
constructor() {
|
|
28
|
+
this._logger = new Logger_1.Logger({
|
|
29
|
+
level: Enums_1.ELogLevel.ERROR,
|
|
30
|
+
instanceId: 'client',
|
|
31
|
+
logOutput: Enums_1.ELogOutput.CONSOLE,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Write our OpenAPI client, using the given templates at the given output
|
|
36
|
+
* @param client Client object with all the models, services, etc.
|
|
37
|
+
* @param templates Templates wrapper with all loaded Handlebars templates
|
|
38
|
+
* @param outputPaths A set of parameters with paths for generating main sections (folders)
|
|
39
|
+
* @param httpClient The selected httpClient (fetch, xhr or node)
|
|
40
|
+
* @param useOptions Use options or arguments functions
|
|
41
|
+
* @param useUnionTypes Use union types instead of enums
|
|
42
|
+
* @param excludeCoreServiceFiles:
|
|
43
|
+
* @param includeSchemasFiles:
|
|
44
|
+
* @param request: Path to custom request file
|
|
45
|
+
* @param useCancelableRequest Use cancelable request type.
|
|
46
|
+
*/
|
|
47
|
+
async writeClient(options) {
|
|
48
|
+
const { client, templates, outputPaths, httpClient, useOptions, useUnionTypes, excludeCoreServiceFiles = false, includeSchemasFiles = false, request, useCancelableRequest = false, useSeparatedIndexes = false, } = options;
|
|
49
|
+
if (!excludeCoreServiceFiles) {
|
|
50
|
+
await fileSystem_1.fileSystem.mkdir(outputPaths.outputCore);
|
|
51
|
+
await this.writeClientCore({ client, templates, outputCorePath: outputPaths.outputCore, httpClient, request, useCancelableRequest });
|
|
52
|
+
await this.writeClientCoreIndex({
|
|
53
|
+
templates,
|
|
54
|
+
outputCorePath: outputPaths.outputCore,
|
|
55
|
+
useCancelableRequest,
|
|
56
|
+
useSeparatedIndexes,
|
|
57
|
+
});
|
|
58
|
+
const { outputCore, outputServices, outputModels } = outputPaths;
|
|
59
|
+
await fileSystem_1.fileSystem.mkdir(outputPaths.outputServices);
|
|
60
|
+
await this.writeClientServices({
|
|
61
|
+
services: client.services,
|
|
62
|
+
templates,
|
|
63
|
+
outputPaths: {
|
|
64
|
+
outputServices,
|
|
65
|
+
outputCore: `${(0, pathHelpers_1.relative)(outputServices, outputCore)}`,
|
|
66
|
+
outputModels: `${(0, pathHelpers_1.relative)(outputServices, outputModels)}`,
|
|
67
|
+
},
|
|
68
|
+
httpClient,
|
|
69
|
+
useUnionTypes,
|
|
70
|
+
useOptions,
|
|
71
|
+
useCancelableRequest,
|
|
72
|
+
});
|
|
73
|
+
await this.writeClientServicesIndex({
|
|
74
|
+
services: client.services,
|
|
75
|
+
templates,
|
|
76
|
+
outputServices,
|
|
77
|
+
useSeparatedIndexes,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (includeSchemasFiles) {
|
|
81
|
+
await fileSystem_1.fileSystem.mkdir(outputPaths.outputSchemas);
|
|
82
|
+
await this.writeClientSchemas({
|
|
83
|
+
models: client.models,
|
|
84
|
+
templates,
|
|
85
|
+
outputSchemasPath: outputPaths.outputSchemas,
|
|
86
|
+
httpClient,
|
|
87
|
+
useUnionTypes,
|
|
88
|
+
});
|
|
89
|
+
await this.writeClientSchemasIndex({
|
|
90
|
+
models: client.models,
|
|
91
|
+
templates,
|
|
92
|
+
outputSchemasPath: outputPaths.outputSchemas,
|
|
93
|
+
useSeparatedIndexes,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
await fileSystem_1.fileSystem.mkdir(outputPaths.outputModels);
|
|
97
|
+
await this.writeClientModels({
|
|
98
|
+
models: client.models,
|
|
99
|
+
templates,
|
|
100
|
+
outputModelsPath: outputPaths.outputModels,
|
|
101
|
+
httpClient,
|
|
102
|
+
useUnionTypes,
|
|
103
|
+
});
|
|
104
|
+
await this.writeClientModelsIndex({
|
|
105
|
+
models: client.models,
|
|
106
|
+
templates,
|
|
107
|
+
outputModelsPath: outputPaths.outputModels,
|
|
108
|
+
useSeparatedIndexes,
|
|
109
|
+
});
|
|
110
|
+
await fileSystem_1.fileSystem.mkdir(outputPaths.output);
|
|
111
|
+
this.buildClientGeneratorConfigMap({
|
|
112
|
+
client,
|
|
113
|
+
templates,
|
|
114
|
+
outputPaths,
|
|
115
|
+
useUnionTypes,
|
|
116
|
+
excludeCoreServiceFiles,
|
|
117
|
+
includeSchemasFiles,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Method keeps all options that is need to create index file
|
|
122
|
+
* @param config
|
|
123
|
+
*/
|
|
124
|
+
buildClientGeneratorConfigMap(config) {
|
|
125
|
+
const { outputPaths } = config;
|
|
126
|
+
const values = this.config.get(outputPaths.output);
|
|
127
|
+
if (values) {
|
|
128
|
+
values.push(config);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.config.set(outputPaths.output, Array.of(config));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async combineAndWrite() {
|
|
135
|
+
const result = this.buildClientIndexMap();
|
|
136
|
+
await this.finalizeAndWrite(result);
|
|
137
|
+
}
|
|
138
|
+
async combineAndWrightSimple() {
|
|
139
|
+
const result = this.buildSimpleClientIndexMap();
|
|
140
|
+
await this.simpledFinalizeAndWrite(result);
|
|
141
|
+
}
|
|
142
|
+
get logger() {
|
|
143
|
+
return this._logger;
|
|
144
|
+
}
|
|
145
|
+
buildSimpleClientIndexMap() {
|
|
146
|
+
const result = new Map();
|
|
147
|
+
for (const [key, value] of this.config.entries()) {
|
|
148
|
+
for (const item of value) {
|
|
149
|
+
const { outputPaths, templates, excludeCoreServiceFiles, includeSchemasFiles } = item;
|
|
150
|
+
const outputCore = this.getOutputPath(outputPaths?.outputCore, key, 'core');
|
|
151
|
+
const outputModels = this.getOutputPath(outputPaths?.outputModels, key, 'models');
|
|
152
|
+
const outputSchemas = this.getOutputPath(outputPaths?.outputSchemas, key, 'schemas');
|
|
153
|
+
const outputServices = this.getOutputPath(outputPaths?.outputServices, key, 'services');
|
|
154
|
+
const clientIndex = this.ensureSimpleClientIndex(result, key, templates);
|
|
155
|
+
if (!excludeCoreServiceFiles) {
|
|
156
|
+
const relativePathCore = (0, pathHelpers_1.relative)(key, outputCore);
|
|
157
|
+
if (!clientIndex.core.includes(relativePathCore)) {
|
|
158
|
+
clientIndex.core.push(relativePathCore);
|
|
159
|
+
}
|
|
160
|
+
const relativeService = (0, pathHelpers_1.relative)(key, outputServices);
|
|
161
|
+
if (!clientIndex.services.includes(relativeService)) {
|
|
162
|
+
clientIndex.services.push(relativeService);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const relativePathModel = (0, pathHelpers_1.relative)(key, outputModels);
|
|
166
|
+
if (!clientIndex.models.includes(relativePathModel)) {
|
|
167
|
+
clientIndex.models.push(relativePathModel);
|
|
168
|
+
}
|
|
169
|
+
if (includeSchemasFiles) {
|
|
170
|
+
const relativePathSchema = (0, pathHelpers_1.relative)(key, outputSchemas);
|
|
171
|
+
if (!clientIndex.schemas.includes(relativePathSchema)) {
|
|
172
|
+
clientIndex.schemas.push(relativePathSchema);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}
|
|
179
|
+
buildClientIndexMap() {
|
|
180
|
+
const result = new Map();
|
|
181
|
+
for (const [key, value] of this.config.entries()) {
|
|
182
|
+
for (const item of value) {
|
|
183
|
+
const { outputPaths, client, templates, useUnionTypes, excludeCoreServiceFiles, includeSchemasFiles } = item;
|
|
184
|
+
const outputCore = this.getOutputPath(outputPaths?.outputCore, key, 'core');
|
|
185
|
+
const outputModels = this.getOutputPath(outputPaths?.outputModels, key, 'models');
|
|
186
|
+
const outputSchemas = this.getOutputPath(outputPaths?.outputSchemas, key, 'schemas');
|
|
187
|
+
const outputServices = this.getOutputPath(outputPaths?.outputServices, key, 'services');
|
|
188
|
+
const clientIndex = this.ensureClientIndex(result, key, templates);
|
|
189
|
+
if (!excludeCoreServiceFiles) {
|
|
190
|
+
const rel = (0, pathHelpers_1.relative)(key, outputCore);
|
|
191
|
+
if (!clientIndex.core.includes(rel)) {
|
|
192
|
+
clientIndex.core.push(rel);
|
|
193
|
+
}
|
|
194
|
+
const relativeService = `${(0, pathHelpers_1.relative)(key, outputServices)}`;
|
|
195
|
+
for (const service of client.services) {
|
|
196
|
+
if (!clientIndex.services.some(s => this.isSomeService(s, service.name, relativeService))) {
|
|
197
|
+
clientIndex.services.push({
|
|
198
|
+
name: service.name,
|
|
199
|
+
package: relativeService,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const relativePathModel = `${(0, pathHelpers_1.relative)(key, outputModels)}`;
|
|
205
|
+
const relativePathSchema = `${(0, pathHelpers_1.relative)(key, outputSchemas)}`;
|
|
206
|
+
for (const model of client.models) {
|
|
207
|
+
const modelFinal = {
|
|
208
|
+
name: model.name,
|
|
209
|
+
alias: '',
|
|
210
|
+
path: model.path,
|
|
211
|
+
package: relativePathModel,
|
|
212
|
+
enum: model.enum && model.enum.length > 0,
|
|
213
|
+
useUnionTypes,
|
|
214
|
+
enums: model.enums && model.enums.length > 0,
|
|
215
|
+
};
|
|
216
|
+
if (!clientIndex.models.some(m => this.isSameModel(m, modelFinal))) {
|
|
217
|
+
clientIndex.models.push(modelFinal);
|
|
218
|
+
}
|
|
219
|
+
if (includeSchemasFiles) {
|
|
220
|
+
const schema = { ...modelFinal, package: relativePathSchema };
|
|
221
|
+
if (!clientIndex.schemas.some(s => this.isSameShema(s, schema))) {
|
|
222
|
+
clientIndex.schemas.push(schema);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
async finalizeAndWrite(result) {
|
|
231
|
+
for (const value of result.values()) {
|
|
232
|
+
value.models = value.models.filter(unique_1.unique).sort(sortModelByName_1.sortModelByName);
|
|
233
|
+
(0, prepareAlias_1.prepareAlias)(value.models);
|
|
234
|
+
value.schemas = value.schemas.filter(unique_1.unique).sort(sortModelByName_1.sortModelByName);
|
|
235
|
+
(0, prepareAlias_1.prepareAlias)(value.schemas);
|
|
236
|
+
await this.writeClientFullIndex(value);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async simpledFinalizeAndWrite(result) {
|
|
240
|
+
for (const value of result.values()) {
|
|
241
|
+
await this.writeClientSimpleIndex(value);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
getOutputPath(output, key, fallback) {
|
|
245
|
+
return output ? output : (0, pathHelpers_1.resolve)(key, fallback);
|
|
246
|
+
}
|
|
247
|
+
ensureClientIndex(map, key, templates) {
|
|
248
|
+
if (!map.has(key)) {
|
|
249
|
+
map.set(key, {
|
|
250
|
+
templates,
|
|
251
|
+
outputPath: key,
|
|
252
|
+
core: [],
|
|
253
|
+
models: [],
|
|
254
|
+
schemas: [],
|
|
255
|
+
services: [],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
return map.get(key);
|
|
259
|
+
}
|
|
260
|
+
ensureSimpleClientIndex(map, key, templates) {
|
|
261
|
+
if (!map.has(key)) {
|
|
262
|
+
map.set(key, {
|
|
263
|
+
templates,
|
|
264
|
+
outputPath: key,
|
|
265
|
+
core: [],
|
|
266
|
+
models: [],
|
|
267
|
+
schemas: [],
|
|
268
|
+
services: [],
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return map.get(key);
|
|
272
|
+
}
|
|
273
|
+
isSameModel(a, b) {
|
|
274
|
+
return a.name === b.name && a.path === b.path && a.package === b.package && a.enum === b.enum && a.enums === b.enums && a.useUnionTypes === b.useUnionTypes;
|
|
275
|
+
}
|
|
276
|
+
isSameShema(a, b) {
|
|
277
|
+
return a.name === b.name && a.path === b.path && a.package === b.package;
|
|
278
|
+
}
|
|
279
|
+
isSomeService(a, name, pkg) {
|
|
280
|
+
return a.name === name && a.package === pkg;
|
|
281
|
+
}
|
|
282
|
+
writeClientCore = writeClientCore_1.writeClientCore;
|
|
283
|
+
writeClientCoreIndex = writeClientCoreIndex_1.writeClientCoreIndex;
|
|
284
|
+
writeClientFullIndex = writeClientFullIndex_1.writeClientFullIndex;
|
|
285
|
+
writeClientModels = writeClientModels_1.writeClientModels;
|
|
286
|
+
writeClientModelsIndex = writeClientModelsIndex_1.writeClientModelsIndex;
|
|
287
|
+
writeClientSchemas = writeClientSchemas_1.writeClientSchemas;
|
|
288
|
+
writeClientSchemasIndex = writeClientSchemasIndex_1.writeClientSchemasIndex;
|
|
289
|
+
writeClientServices = writeClientServices_1.writeClientServices;
|
|
290
|
+
writeClientServicesIndex = writeClientServicesIndex_1.writeClientServicesIndex;
|
|
291
|
+
writeClientSimpleIndex = writeClientSimpleIndex_1.writeClientSimpleIndex;
|
|
292
|
+
}
|
|
293
|
+
exports.WriteClient = WriteClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteClient.test.d.ts","sourceRoot":"","sources":["../../../src/core/__tests__/WriteClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
7
|
const node_test_1 = require("node:test");
|
|
8
|
-
const
|
|
9
|
-
const fileSystem_1 = require("../fileSystem");
|
|
10
|
-
const getOutputPaths_1 = require("../getOutputPaths");
|
|
11
|
-
const
|
|
8
|
+
const HttpClient_enum_1 = require("../types/enums/HttpClient.enum");
|
|
9
|
+
const fileSystem_1 = require("../utils/fileSystem");
|
|
10
|
+
const getOutputPaths_1 = require("../utils/getOutputPaths");
|
|
11
|
+
const WriteClient_1 = require("../WriteClient");
|
|
12
12
|
(0, node_test_1.test)('@unit: writeClient should write to filesystem', async () => {
|
|
13
13
|
const mkdirCalls = [];
|
|
14
14
|
const writeFileCalls = [];
|
|
@@ -30,7 +30,14 @@ const writeClient_1 = require("../writeClient");
|
|
|
30
30
|
services: [],
|
|
31
31
|
};
|
|
32
32
|
const templates = {
|
|
33
|
-
|
|
33
|
+
indexes: {
|
|
34
|
+
full: () => 'fullIndex',
|
|
35
|
+
simple: () => 'simpleIndex',
|
|
36
|
+
core: () => 'coreIndex',
|
|
37
|
+
models: () => 'modelsIndex',
|
|
38
|
+
schemas: () => 'schemasIndex',
|
|
39
|
+
services: () => 'servicesIndex',
|
|
40
|
+
},
|
|
34
41
|
exports: {
|
|
35
42
|
model: () => 'model',
|
|
36
43
|
schema: () => 'schema',
|
|
@@ -47,18 +54,15 @@ const writeClient_1 = require("../writeClient");
|
|
|
47
54
|
},
|
|
48
55
|
};
|
|
49
56
|
const outputPaths = (0, getOutputPaths_1.getOutputPaths)({ output: './dist' });
|
|
50
|
-
await new
|
|
57
|
+
await new WriteClient_1.WriteClient().writeClient({
|
|
51
58
|
client,
|
|
52
59
|
templates,
|
|
53
60
|
outputPaths,
|
|
54
|
-
httpClient:
|
|
61
|
+
httpClient: HttpClient_enum_1.HttpClient.FETCH,
|
|
55
62
|
useOptions: false,
|
|
56
63
|
useUnionTypes: false,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
exportModels: true,
|
|
60
|
-
exportSchemas: true,
|
|
61
|
-
clean: true,
|
|
64
|
+
excludeCoreServiceFiles: false,
|
|
65
|
+
includeSchemasFiles: false,
|
|
62
66
|
});
|
|
63
67
|
strict_1.default.ok(mkdirCalls.length > 0, 'mkdir should be called at least once');
|
|
64
68
|
strict_1.default.ok(writeFileCalls.length > 0, 'writeFile should be called at least once');
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
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
|
-
const
|
|
8
|
+
const swagger_parser_1 = __importDefault(require("@apidevtools/swagger-parser"));
|
|
9
9
|
const Context_1 = require("../../../../Context");
|
|
10
10
|
const getOutputPaths_1 = require("../../../../utils/getOutputPaths");
|
|
11
11
|
const Parser_1 = require("../../Parser");
|
|
@@ -13,7 +13,7 @@ const Parser_1 = require("../../Parser");
|
|
|
13
13
|
(0, node_test_1.test)('@unit: should convert int', async () => {
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
15
|
// @ts-ignore
|
|
16
|
-
const parser = new
|
|
16
|
+
const parser = new swagger_parser_1.default();
|
|
17
17
|
const context = new Context_1.Context({ input: 'test/spec/v3.yml', output: (0, getOutputPaths_1.getOutputPaths)({ output: './generated' }) });
|
|
18
18
|
context.addRefs(await parser.resolve('test/spec/v3.yml'));
|
|
19
19
|
const type = new Parser_1.Parser(context).getType('int', '');
|
|
@@ -25,37 +25,19 @@ const Parser_1 = require("../../Parser");
|
|
|
25
25
|
(0, node_test_1.test)('@unit: should support file with ext', async () => {
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
const parser = new
|
|
28
|
+
const parser = new swagger_parser_1.default();
|
|
29
29
|
const context = new Context_1.Context({ input: 'test/spec/v3.yml', output: (0, getOutputPaths_1.getOutputPaths)({ output: './generated' }) });
|
|
30
30
|
context.addRefs(await parser.resolve('test/spec/v3.yml'));
|
|
31
31
|
const type = new Parser_1.Parser(context).getType('schemas/ModelWithString.yml', '');
|
|
32
|
-
node_assert_1.default.strictEqual(type.type, '
|
|
33
|
-
node_assert_1.default.strictEqual(type.base, '
|
|
32
|
+
node_assert_1.default.strictEqual(type.type, 'ModelWithString');
|
|
33
|
+
node_assert_1.default.strictEqual(type.base, 'ModelWithString');
|
|
34
34
|
node_assert_1.default.strictEqual(type.template, null);
|
|
35
35
|
node_assert_1.default.deepStrictEqual(type.imports, [
|
|
36
36
|
{
|
|
37
|
-
name: '
|
|
37
|
+
name: 'ModelWithString',
|
|
38
38
|
alias: '',
|
|
39
|
-
path: '
|
|
39
|
+
path: '././schemas/ModelWithString',
|
|
40
40
|
},
|
|
41
41
|
]);
|
|
42
42
|
});
|
|
43
|
-
const object = {
|
|
44
|
-
components: {
|
|
45
|
-
schemas: {
|
|
46
|
-
someSpecialSchema: {
|
|
47
|
-
type: 'object',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
(0, node_test_1.test)('@unit: should support external generation type', async () => {
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
const parser = new json_schema_ref_parser_1.default();
|
|
56
|
-
const context = new Context_1.Context({ input: object, output: (0, getOutputPaths_1.getOutputPaths)({ output: './generated' }) });
|
|
57
|
-
context.addRefs(await parser.resolve(object));
|
|
58
|
-
const type = new Parser_1.Parser(context).getType('#/components/schemas/someSpecialSchema', '');
|
|
59
|
-
node_assert_1.default.strictEqual(type.type, 'ISomeSpecialSchema');
|
|
60
|
-
});
|
|
61
43
|
});
|
|
@@ -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;AAO/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,CA2JjE"}
|
|
@@ -6,6 +6,7 @@ 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");
|
|
9
10
|
function getModel(config) {
|
|
10
11
|
const { openApi, definition, isDefinition = false, name = '', path = '', parentRef } = config;
|
|
11
12
|
const model = {
|
|
@@ -44,7 +45,8 @@ function getModel(config) {
|
|
|
44
45
|
properties: [],
|
|
45
46
|
};
|
|
46
47
|
if (definition.$ref) {
|
|
47
|
-
const
|
|
48
|
+
const normalizedRef = (0, normalizeRef_1.normalizeRef)(definition.$ref, parentRef);
|
|
49
|
+
const definitionRef = this.getType(definition.$ref, normalizedRef);
|
|
48
50
|
model.export = 'reference';
|
|
49
51
|
model.type = definitionRef.type;
|
|
50
52
|
model.base = definitionRef.base;
|
|
@@ -75,7 +77,8 @@ function getModel(config) {
|
|
|
75
77
|
}
|
|
76
78
|
if (definition.type === 'array' && definition.items) {
|
|
77
79
|
if (definition.items.$ref) {
|
|
78
|
-
const
|
|
80
|
+
const normalizedRef = (0, normalizeRef_1.normalizeRef)(definition.items.$ref, parentRef);
|
|
81
|
+
const arrayItems = this.getType(definition.items.$ref, normalizedRef);
|
|
79
82
|
model.export = 'array';
|
|
80
83
|
model.type = arrayItems.type;
|
|
81
84
|
model.base = arrayItems.base;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getModelProperties.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getModelProperties.ts"],"names":[],"mappings":"AAEA,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":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAK/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,CAiFxH"}
|
|
@@ -8,6 +8,7 @@ const get_1 = __importDefault(require("lodash-es/get"));
|
|
|
8
8
|
const escapeName_1 = require("../../../utils/escapeName");
|
|
9
9
|
const getComment_1 = require("../../../utils/getComment");
|
|
10
10
|
const getPattern_1 = require("../../../utils/getPattern");
|
|
11
|
+
const normalizeRef_1 = require("../../../utils/normalizeRef");
|
|
11
12
|
function getModelProperties(openApi, definition, parentRef) {
|
|
12
13
|
const models = [];
|
|
13
14
|
for (const propertyName in definition.properties) {
|
|
@@ -15,7 +16,8 @@ function getModelProperties(openApi, definition, parentRef) {
|
|
|
15
16
|
const property = definition.properties[propertyName];
|
|
16
17
|
const propertyRequired = definition.required?.includes(propertyName) || property.default !== undefined;
|
|
17
18
|
if (property.$ref) {
|
|
18
|
-
const
|
|
19
|
+
const normalizedRef = (0, normalizeRef_1.normalizeRef)(property.$ref, parentRef);
|
|
20
|
+
const model = this.getType(property.$ref, normalizedRef);
|
|
19
21
|
models.push({
|
|
20
22
|
name: (0, escapeName_1.escapeName)(propertyName),
|
|
21
23
|
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;AAK/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,
|
|
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;AAK/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"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getModels = getModels;
|
|
4
4
|
const getRefFromSchema_1 = require("../../../utils/getRefFromSchema");
|
|
5
|
-
const
|
|
5
|
+
const modelHelpers_1 = require("../../../utils/modelHelpers");
|
|
6
6
|
const sortModelsByName_1 = require("../../../utils/sortModelsByName");
|
|
7
7
|
const unique_1 = require("../../../utils/unique");
|
|
8
8
|
function getModels(openApi) {
|
|
@@ -23,34 +23,8 @@ function getModels(openApi) {
|
|
|
23
23
|
models.push(model);
|
|
24
24
|
}
|
|
25
25
|
models = (0, sortModelsByName_1.sortModelsByName)(models.filter(unique_1.unique));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
models.forEach(model => {
|
|
29
|
-
if (previous && previous.name === model.name) {
|
|
30
|
-
if (index === 1) {
|
|
31
|
-
previous.alias = `${model.name}$${index}`;
|
|
32
|
-
index++;
|
|
33
|
-
}
|
|
34
|
-
model.alias = `${model.name}$${index}`;
|
|
35
|
-
index++;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
model.alias = '';
|
|
39
|
-
index = 1;
|
|
40
|
-
}
|
|
41
|
-
previous = model;
|
|
42
|
-
});
|
|
43
|
-
models.forEach(model => {
|
|
44
|
-
model.imports = model.imports.map(imprt => {
|
|
45
|
-
const importModel = models.filter(value => `${value.path}${value.name}` === imprt.path && value.name === imprt.name);
|
|
46
|
-
const importAlias = importModel.length > 0 ? importModel[0].alias : imprt?.alias;
|
|
47
|
-
const importPath = importModel.length > 0 ? (0, pathHelpers_1.join)((0, pathHelpers_1.relative)(model.path, importModel[0].path), imprt.name) : imprt.path;
|
|
48
|
-
return Object.assign(imprt, {
|
|
49
|
-
alias: importAlias,
|
|
50
|
-
path: importPath,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
26
|
+
(0, modelHelpers_1.setDuplicateModelAliases)(models);
|
|
27
|
+
(0, modelHelpers_1.resolveModelImports)(models, this.context.output.outputModels);
|
|
54
28
|
}
|
|
55
29
|
return models.filter(unique_1.unique);
|
|
56
30
|
}
|
|
@@ -3,5 +3,5 @@ import type { OperationParameters } from '../../../types/shared/OperationParamet
|
|
|
3
3
|
import { Parser } from '../Parser';
|
|
4
4
|
import type { OpenApi } from '../types/OpenApi.model';
|
|
5
5
|
import type { OpenApiOperation } from '../types/OpenApiOperation.model';
|
|
6
|
-
export declare function getOperation(this: Parser, openApi: OpenApi, url: string, method: string, op: OpenApiOperation, pathParams: OperationParameters): Operation;
|
|
6
|
+
export declare function getOperation(this: Parser, openApi: OpenApi, url: string, method: string, op: OpenApiOperation, pathParams: OperationParameters, parentRef: string): Operation;
|
|
7
7
|
//# sourceMappingURL=getOperation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperation.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAQ3F,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;AAExE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,mBAAmB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"getOperation.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAQ3F,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;AAExE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,CAwD7K"}
|
|
@@ -8,7 +8,7 @@ const getOperationPath_1 = require("../../../utils/getOperationPath");
|
|
|
8
8
|
const getOperationResponseHeader_1 = require("../../../utils/getOperationResponseHeader");
|
|
9
9
|
const getOperationResults_1 = require("../../../utils/getOperationResults");
|
|
10
10
|
const getServiceClassName_1 = require("../../../utils/getServiceClassName");
|
|
11
|
-
function getOperation(openApi, url, method, op, pathParams) {
|
|
11
|
+
function getOperation(openApi, url, method, op, pathParams, parentRef) {
|
|
12
12
|
const serviceName = op.tags?.[0] || 'Service';
|
|
13
13
|
const serviceClassName = (0, getServiceClassName_1.getServiceClassName)(serviceName);
|
|
14
14
|
const operationNameFallback = `${method}${serviceClassName}`;
|
|
@@ -37,7 +37,7 @@ function getOperation(openApi, url, method, op, pathParams) {
|
|
|
37
37
|
};
|
|
38
38
|
// Parse the operation parameters (path, query, body, etc).
|
|
39
39
|
if (op.parameters) {
|
|
40
|
-
const parameters = this.getOperationParameters(openApi, op.parameters);
|
|
40
|
+
const parameters = this.getOperationParameters(openApi, op.parameters, parentRef);
|
|
41
41
|
operation.imports.push(...parameters.imports);
|
|
42
42
|
operation.parameters.push(...parameters.parameters);
|
|
43
43
|
operation.parametersPath.push(...parameters.parametersPath);
|
|
@@ -49,7 +49,7 @@ function getOperation(openApi, url, method, op, pathParams) {
|
|
|
49
49
|
}
|
|
50
50
|
// Parse the operation responses.
|
|
51
51
|
if (op.responses) {
|
|
52
|
-
const operationResponses = this.getOperationResponses(openApi, op.responses);
|
|
52
|
+
const operationResponses = this.getOperationResponses(openApi, op.responses, parentRef);
|
|
53
53
|
const operationResults = (0, getOperationResults_1.getOperationResults)(operationResponses);
|
|
54
54
|
operation.errors = (0, getOperationErrors_1.getOperationErrors)(operationResponses);
|
|
55
55
|
operation.responseHeader = (0, getOperationResponseHeader_1.getOperationResponseHeader)(operationResults);
|
|
@@ -2,5 +2,5 @@ import type { OperationParameter } from '../../../types/shared/OperationParamete
|
|
|
2
2
|
import { Parser } from '../Parser';
|
|
3
3
|
import type { OpenApi } from '../types/OpenApi.model';
|
|
4
4
|
import type { OpenApiParameter } from '../types/OpenApiParameter.model';
|
|
5
|
-
export declare function getOperationParameter(this: Parser, openApi: OpenApi, parameter: OpenApiParameter): OperationParameter;
|
|
5
|
+
export declare function getOperationParameter(this: Parser, openApi: OpenApi, parameter: OpenApiParameter, parentRef: string): OperationParameter;
|
|
6
6
|
//# sourceMappingURL=getOperationParameter.d.ts.map
|
|
@@ -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;AAQzF,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,CAuIxI"}
|
|
@@ -7,8 +7,9 @@ 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");
|
|
10
11
|
const getOperationParameterDefault_1 = require("./getOperationParameterDefault");
|
|
11
|
-
function getOperationParameter(openApi, parameter) {
|
|
12
|
+
function getOperationParameter(openApi, parameter, parentRef) {
|
|
12
13
|
const operationParameter = {
|
|
13
14
|
path: '',
|
|
14
15
|
in: parameter.in,
|
|
@@ -44,7 +45,8 @@ function getOperationParameter(openApi, parameter) {
|
|
|
44
45
|
mediaType: null,
|
|
45
46
|
};
|
|
46
47
|
if (parameter.$ref) {
|
|
47
|
-
const
|
|
48
|
+
const normalizedRef = (0, normalizeRef_1.normalizeRef)(parameter.$ref, parentRef);
|
|
49
|
+
const definitionRef = this.getType(parameter.$ref, normalizedRef);
|
|
48
50
|
operationParameter.export = 'reference';
|
|
49
51
|
operationParameter.type = definitionRef.type;
|
|
50
52
|
operationParameter.base = definitionRef.base;
|
|
@@ -2,5 +2,5 @@ import type { OperationParameters } from '../../../types/shared/OperationParamet
|
|
|
2
2
|
import { Parser } from '../Parser';
|
|
3
3
|
import type { OpenApi } from '../types/OpenApi.model';
|
|
4
4
|
import type { OpenApiParameter } from '../types/OpenApiParameter.model';
|
|
5
|
-
export declare function getOperationParameters(this: Parser, openApi: OpenApi, parameters: OpenApiParameter[]): OperationParameters;
|
|
5
|
+
export declare function getOperationParameters(this: Parser, openApi: OpenApi, parameters: OpenApiParameter[], parentRef: string): OperationParameters;
|
|
6
6
|
//# sourceMappingURL=getOperationParameters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationParameters.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAG3F,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;AAExE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,CA+
|
|
1
|
+
{"version":3,"file":"getOperationParameters.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAG3F,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;AAExE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB,CA+D7I"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getOperationParameters = getOperationParameters;
|
|
4
4
|
const sortByRequiredExtended_1 = require("../../../utils/sortByRequiredExtended");
|
|
5
5
|
const sortByRequiredSimple_1 = require("../../../utils/sortByRequiredSimple");
|
|
6
|
-
function getOperationParameters(openApi, parameters) {
|
|
6
|
+
function getOperationParameters(openApi, parameters, parentRef) {
|
|
7
7
|
const operationParameters = {
|
|
8
8
|
imports: [],
|
|
9
9
|
parameters: [],
|
|
@@ -17,7 +17,7 @@ function getOperationParameters(openApi, parameters) {
|
|
|
17
17
|
// Iterate over the parameters
|
|
18
18
|
parameters.forEach(parameterOrReference => {
|
|
19
19
|
const parameterDef = (parameterOrReference.$ref ? this.context.get(parameterOrReference.$ref) : parameterOrReference);
|
|
20
|
-
const parameter = this.getOperationParameter(openApi, parameterDef);
|
|
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.
|
|
23
23
|
if (parameter.prop !== 'api-version') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/core/api/v2/parser/getOperationResponse.ts"],"names":[],"mappings":"AAEA,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":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIvF,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,CAoF1J"}
|