@azure-tools/typespec-ts 0.54.0-dev.6 → 0.54.0-dev.8
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/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +2 -4
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +12 -20
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +8 -11
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
- package/dist/src/framework/hooks/useDependencies.js +1 -1
- package/dist/src/framework/hooks/useDependencies.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +1 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +12 -25
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.d.ts.map +1 -1
- package/dist/src/framework/reference.js +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/sample.js +8 -8
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +70 -48
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +140 -140
- package/dist/src/lib.js.map +1 -1
- package/dist/src/metaTree.d.ts +1 -1
- package/dist/src/metaTree.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +49 -62
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +4 -7
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts +2 -2
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +30 -36
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildModularOptions.d.ts +1 -1
- package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
- package/dist/src/modular/buildModularOptions.js +2 -2
- package/dist/src/modular/buildModularOptions.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +3 -3
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +22 -23
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +7 -9
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +11 -11
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts +2 -2
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +30 -39
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +9 -17
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
- package/dist/src/modular/emitLoggerFile.js +2 -2
- package/dist/src/modular/emitLoggerFile.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +54 -72
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +6 -7
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.d.ts.map +1 -1
- package/dist/src/modular/emitSamples.js +40 -52
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.d.ts.map +1 -1
- package/dist/src/modular/emitTests.js +9 -12
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/external-dependencies.js +54 -54
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +27 -36
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +20 -38
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +39 -58
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +4 -5
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +136 -196
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +1 -1
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +50 -56
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +52 -59
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +43 -51
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.js +4 -11
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +60 -60
- package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +7 -9
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +4 -8
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
- package/dist/src/rlc-common/buildClient.d.ts +1 -1
- package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClient.js +48 -66
- package/dist/src/rlc-common/buildClient.js.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +24 -42
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.js +57 -57
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +32 -35
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
- package/dist/src/rlc-common/buildLogger.js +3 -3
- package/dist/src/rlc-common/buildLogger.js.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +3 -3
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.js +31 -48
- package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPaginateHelper.js +2 -2
- package/dist/src/rlc-common/buildPaginateHelper.js.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.js +63 -50
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.js +5 -5
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.js +19 -22
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSamples.js +2 -2
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSchemaType.js +31 -13
- package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
- package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +2 -3
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +23 -25
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +8 -13
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +8 -12
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
- package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +1 -2
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +3 -4
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +28 -28
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +28 -28
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +13 -13
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -5
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +16 -16
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +10 -18
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +8 -8
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +23 -21
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -2
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +13 -13
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +22 -26
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +26 -29
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +3 -3
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +2 -2
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.js +4 -6
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.js +19 -23
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/transform/transform.d.ts +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +10 -11
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +8 -10
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +9 -11
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +22 -28
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +11 -12
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +1 -1
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +12 -12
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +9 -15
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.js +3 -3
- package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +14 -26
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.d.ts +1 -1
- package/dist/src/utils/clientUtils.d.ts.map +1 -1
- package/dist/src/utils/clientUtils.js +11 -14
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.d.ts +1 -1
- package/dist/src/utils/credentialUtils.d.ts.map +1 -1
- package/dist/src/utils/credentialUtils.js +3 -3
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +8 -12
- package/dist/src/utils/crossLanguageDef.js.map +1 -1
- package/dist/src/utils/emitUtil.d.ts +1 -1
- package/dist/src/utils/emitUtil.d.ts.map +1 -1
- package/dist/src/utils/emitUtil.js +4 -6
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +2 -2
- package/dist/src/utils/fileSystemUtils.js.map +1 -1
- package/dist/src/utils/importHelper.d.ts.map +1 -1
- package/dist/src/utils/importHelper.js +2 -4
- package/dist/src/utils/importHelper.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +1 -1
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.js +7 -19
- package/dist/src/utils/mediaTypes.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts +5 -5
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +108 -171
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
- package/dist/src/utils/namespaceUtils.js +2 -2
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +29 -42
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/src/utils/parameterUtils.d.ts +1 -1
- package/dist/src/utils/parameterUtils.d.ts.map +1 -1
- package/dist/src/utils/parameterUtils.js +19 -22
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.js +2 -2
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
- package/src/contextManager.ts +6 -9
- package/src/framework/declaration.ts +18 -28
- package/src/framework/dependency.ts +1 -2
- package/src/framework/hooks/binder.ts +47 -120
- package/src/framework/hooks/sdkTypes.ts +27 -54
- package/src/framework/hooks/useDependencies.ts +2 -4
- package/src/framework/load-static-helpers.ts +28 -51
- package/src/framework/reference.ts +2 -5
- package/src/framework/sample.ts +9 -9
- package/src/index.ts +139 -180
- package/src/lib.ts +143 -158
- package/src/metaTree.ts +1 -1
- package/src/modular/buildClassicalClient.ts +83 -160
- package/src/modular/buildClassicalOperationGroups.ts +14 -39
- package/src/modular/buildClientContext.ts +54 -83
- package/src/modular/buildModularOptions.ts +4 -5
- package/src/modular/buildOperations.ts +46 -73
- package/src/modular/buildProjectFiles.ts +18 -47
- package/src/modular/buildRestorePoller.ts +27 -46
- package/src/modular/buildRootIndex.ts +86 -159
- package/src/modular/buildSubpathIndex.ts +35 -58
- package/src/modular/emitLoggerFile.ts +4 -9
- package/src/modular/emitModels.ts +136 -266
- package/src/modular/emitModelsOptions.ts +10 -16
- package/src/modular/emitSamples.ts +91 -177
- package/src/modular/emitTests.ts +28 -61
- package/src/modular/external-dependencies.ts +54 -54
- package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
- package/src/modular/helpers/clientHelpers.ts +41 -88
- package/src/modular/helpers/clientOptionHelpers.ts +4 -11
- package/src/modular/helpers/exampleValueHelpers.ts +97 -209
- package/src/modular/helpers/namingHelpers.ts +12 -28
- package/src/modular/helpers/operationHelpers.ts +430 -757
- package/src/modular/helpers/typeHelpers.ts +11 -22
- package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
- package/src/modular/serialization/buildSerializerFunction.ts +91 -129
- package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
- package/src/modular/serialization/serializeUtils.ts +12 -21
- package/src/modular/static/rollup.test.config.js +11 -14
- package/src/modular/static/scripts/renameOutput.mjs +2 -2
- package/src/modular/static-helpers-metadata.ts +60 -60
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +5 -10
- package/src/modular/type-expressions/get-model-expression.ts +13 -17
- package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
- package/src/modular/type-expressions/get-type-expression.ts +8 -12
- package/src/modular/type-expressions/get-union-expression.ts +4 -4
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/rlc-common/buildClient.ts +70 -141
- package/src/rlc-common/buildClientDefinitions.ts +43 -87
- package/src/rlc-common/buildIndexFile.ts +78 -78
- package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
- package/src/rlc-common/buildLogger.ts +7 -7
- package/src/rlc-common/buildMethodShortcuts.ts +9 -21
- package/src/rlc-common/buildObjectTypes.ts +79 -156
- package/src/rlc-common/buildPaginateHelper.ts +9 -12
- package/src/rlc-common/buildParameterTypes.ts +116 -137
- package/src/rlc-common/buildPollingHelper.ts +7 -7
- package/src/rlc-common/buildResponseTypes.ts +34 -57
- package/src/rlc-common/buildSamples.ts +3 -3
- package/src/rlc-common/buildSchemaType.ts +37 -29
- package/src/rlc-common/buildSerializeHelper.ts +5 -5
- package/src/rlc-common/buildTopLevelIndexFile.ts +12 -19
- package/src/rlc-common/helpers/apiVersionUtil.ts +5 -10
- package/src/rlc-common/helpers/importsUtil.ts +27 -30
- package/src/rlc-common/helpers/nameConstructors.ts +16 -50
- package/src/rlc-common/helpers/nameUtils.ts +19 -42
- package/src/rlc-common/helpers/operationHelpers.ts +14 -31
- package/src/rlc-common/helpers/pathUtils.ts +2 -7
- package/src/rlc-common/helpers/schemaHelpers.ts +4 -15
- package/src/rlc-common/helpers/shortcutMethods.ts +6 -15
- package/src/rlc-common/helpers/typeUtil.ts +4 -11
- package/src/rlc-common/helpers/valueGenerationUtil.ts +16 -39
- package/src/rlc-common/index.ts +28 -28
- package/src/rlc-common/interfaces.ts +3 -11
- package/src/rlc-common/metadata/buildApiExtractorConfig.ts +17 -24
- package/src/rlc-common/metadata/buildChangelogFile.ts +1 -1
- package/src/rlc-common/metadata/buildESLintConfig.ts +3 -5
- package/src/rlc-common/metadata/buildLicenseFile.ts +1 -1
- package/src/rlc-common/metadata/buildPackageFile.ts +27 -35
- package/src/rlc-common/metadata/buildReadmeFile.ts +16 -29
- package/src/rlc-common/metadata/buildRollupConfig.ts +5 -8
- package/src/rlc-common/metadata/buildSampleEnvFile.ts +2 -3
- package/src/rlc-common/metadata/buildTestConfig.ts +10 -10
- package/src/rlc-common/metadata/buildTsConfig.ts +32 -35
- package/src/rlc-common/metadata/buildVitestConfig.ts +4 -10
- package/src/rlc-common/metadata/buildWarpConfig.ts +3 -6
- package/src/rlc-common/metadata/packageJson/azurePackageCommon.ts +16 -25
- package/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts +29 -50
- package/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.ts +20 -31
- package/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.ts +11 -13
- package/src/rlc-common/metadata/packageJson/packageCommon.ts +32 -52
- package/src/rlc-common/test/buildKarmaConfig.ts +1 -1
- package/src/rlc-common/test/buildRecordedClient.ts +3 -3
- package/src/rlc-common/test/buildSampleTest.ts +3 -3
- package/src/rlc-common/test/buildSnippets.ts +6 -12
- package/src/rlc-common/transformSampleGroups.ts +54 -105
- package/src/testing/index.ts +2 -5
- package/src/transform/transform.ts +22 -34
- package/src/transform/transformApiVersionInfo.ts +17 -30
- package/src/transform/transformHelperFunctionDetails.ts +14 -26
- package/src/transform/transformParameters.ts +55 -105
- package/src/transform/transformPaths.ts +26 -43
- package/src/transform/transformResponses.ts +26 -33
- package/src/transform/transformSchemas.ts +15 -33
- package/src/transform/transformTelemetryInfo.ts +8 -14
- package/src/transform/transfromRLCOptions.ts +53 -115
- package/src/utils/clientUtils.ts +22 -41
- package/src/utils/credentialUtils.ts +8 -19
- package/src/utils/crossLanguageDef.ts +15 -34
- package/src/utils/emitUtil.ts +11 -17
- package/src/utils/fileSystemUtils.ts +4 -6
- package/src/utils/importHelper.ts +5 -10
- package/src/utils/interfaces.ts +1 -1
- package/src/utils/mediaTypes.ts +13 -34
- package/src/utils/modelUtils.ts +175 -384
- package/src/utils/namespaceUtils.ts +8 -24
- package/src/utils/operationUtil.ts +98 -190
- package/src/utils/parameterUtils.ts +31 -54
- package/src/utils/resolve-project-root.ts +3 -3
- package/static/static-helpers/cloudSettingHelpers.ts +4 -6
- package/static/static-helpers/multipartHelpers.ts +3 -3
- package/static/static-helpers/pagingHelpers.ts +28 -63
- package/static/static-helpers/pollingHelpers.ts +15 -28
- package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
- package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
- package/static/static-helpers/serialization/serialize-record.ts +1 -1
- package/static/static-helpers/serialization/serializers.ts +4 -7
- package/static/static-helpers/serialization/xml-helpers.ts +41 -89
- package/static/static-helpers/simplePollerHelpers.ts +9 -18
- package/static/static-helpers/storageCompatResponse.ts +10 -27
- package/static/static-helpers/urlTemplate.ts +4 -7
- package/static/test-helpers/recordedClient.ts +5 -10
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
SdkHttpParameterExampleValue,
|
|
4
|
-
SdkExampleValue,
|
|
2
|
+
isReadOnly,
|
|
5
3
|
SdkClientInitializationType,
|
|
6
4
|
SdkClientType,
|
|
7
|
-
|
|
5
|
+
SdkExampleValue,
|
|
6
|
+
SdkHttpOperationExample,
|
|
7
|
+
SdkHttpParameterExampleValue,
|
|
8
8
|
SdkModelPropertyType,
|
|
9
|
-
|
|
9
|
+
SdkServiceOperation,
|
|
10
10
|
} from "@azure-tools/typespec-client-generator-core";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
normalizeName
|
|
15
|
-
} from "../../rlc-common/index.js";
|
|
11
|
+
import { join } from "path";
|
|
12
|
+
import { SourceFile } from "ts-morph";
|
|
13
|
+
import { useContext } from "../../contextManager.js";
|
|
16
14
|
import { resolveReference } from "../../framework/reference.js";
|
|
15
|
+
import { isAzurePackage, NameType, normalizeName } from "../../rlc-common/index.js";
|
|
16
|
+
import { getSubscriptionId } from "../../transform/transfromRLCOptions.js";
|
|
17
|
+
import { hasKeyCredential, hasTokenCredential } from "../../utils/credentialUtils.js";
|
|
17
18
|
import { SdkContext } from "../../utils/interfaces.js";
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "../external-dependencies.js";
|
|
22
|
-
import {
|
|
23
|
-
hasKeyCredential,
|
|
24
|
-
hasTokenCredential
|
|
25
|
-
} from "../../utils/credentialUtils.js";
|
|
26
|
-
import { isSpreadBodyParameter } from "./typeHelpers.js";
|
|
19
|
+
import { getMethodHierarchiesMap, ServiceOperation } from "../../utils/operationUtil.js";
|
|
20
|
+
import { AzureIdentityDependencies, AzureTestDependencies } from "../external-dependencies.js";
|
|
21
|
+
import { getClientParametersDeclaration } from "./clientHelpers.js";
|
|
27
22
|
import { getClassicalClientName } from "./namingHelpers.js";
|
|
28
|
-
import {
|
|
29
|
-
getMethodHierarchiesMap,
|
|
30
|
-
ServiceOperation
|
|
31
|
-
} from "../../utils/operationUtil.js";
|
|
32
|
-
import { getSubscriptionId } from "../../transform/transfromRLCOptions.js";
|
|
33
|
-
import { SourceFile } from "ts-morph";
|
|
34
|
-
import { useContext } from "../../contextManager.js";
|
|
35
|
-
import { join } from "path";
|
|
36
23
|
import { getOperationFunction } from "./operationHelpers.js";
|
|
37
|
-
import {
|
|
24
|
+
import { isSpreadBodyParameter } from "./typeHelpers.js";
|
|
38
25
|
|
|
39
26
|
/**
|
|
40
27
|
* Common interfaces for both samples and tests
|
|
@@ -58,12 +45,10 @@ export interface ClientEmitOptions {
|
|
|
58
45
|
* Build parameter value map from example
|
|
59
46
|
*/
|
|
60
47
|
export function buildParameterValueMap(
|
|
61
|
-
example: SdkHttpOperationExample
|
|
48
|
+
example: SdkHttpOperationExample,
|
|
62
49
|
): Record<string, SdkHttpParameterExampleValue> {
|
|
63
50
|
const parameterMap: Record<string, SdkHttpParameterExampleValue> = {};
|
|
64
|
-
example.parameters.forEach(
|
|
65
|
-
(param) => (parameterMap[param.parameter.serializedName] = param)
|
|
66
|
-
);
|
|
51
|
+
example.parameters.forEach((param) => (parameterMap[param.parameter.serializedName] = param));
|
|
67
52
|
return parameterMap;
|
|
68
53
|
}
|
|
69
54
|
|
|
@@ -74,13 +59,13 @@ export function prepareCommonValue(
|
|
|
74
59
|
name: string,
|
|
75
60
|
value: SdkExampleValue | string,
|
|
76
61
|
isOptional?: boolean,
|
|
77
|
-
onClient?: boolean
|
|
62
|
+
onClient?: boolean,
|
|
78
63
|
): CommonValue {
|
|
79
64
|
return {
|
|
80
65
|
name: normalizeName(name, NameType.Parameter),
|
|
81
66
|
value: typeof value === "string" ? value : serializeExampleValue(value),
|
|
82
67
|
isOptional: Boolean(isOptional),
|
|
83
|
-
onClient: Boolean(onClient)
|
|
68
|
+
onClient: Boolean(onClient),
|
|
84
69
|
};
|
|
85
70
|
}
|
|
86
71
|
|
|
@@ -89,36 +74,34 @@ export function prepareCommonValue(
|
|
|
89
74
|
*/
|
|
90
75
|
export function getCredentialSampleValue(
|
|
91
76
|
dpgContext: SdkContext,
|
|
92
|
-
initialization: SdkClientInitializationType
|
|
77
|
+
initialization: SdkClientInitializationType,
|
|
93
78
|
): CommonValue | undefined {
|
|
94
79
|
const keyCredential = hasKeyCredential(initialization),
|
|
95
80
|
tokenCredential = hasTokenCredential(initialization);
|
|
96
81
|
const defaultSetting = {
|
|
97
82
|
isOptional: false,
|
|
98
83
|
onClient: true,
|
|
99
|
-
name: "credential"
|
|
84
|
+
name: "credential",
|
|
100
85
|
};
|
|
101
86
|
if (keyCredential || tokenCredential) {
|
|
102
87
|
if (isAzurePackage({ options: dpgContext.rlcOptions })) {
|
|
103
88
|
// Support DefaultAzureCredential for Azure packages
|
|
104
89
|
return {
|
|
105
90
|
...defaultSetting,
|
|
106
|
-
value: `new ${resolveReference(
|
|
107
|
-
AzureIdentityDependencies.DefaultAzureCredential
|
|
108
|
-
)}()`
|
|
91
|
+
value: `new ${resolveReference(AzureIdentityDependencies.DefaultAzureCredential)}()`,
|
|
109
92
|
};
|
|
110
93
|
} else if (keyCredential) {
|
|
111
94
|
// Support ApiKeyCredential for non-Azure packages
|
|
112
95
|
return {
|
|
113
96
|
...defaultSetting,
|
|
114
|
-
value: `{ key: "INPUT_YOUR_KEY_HERE" }
|
|
97
|
+
value: `{ key: "INPUT_YOUR_KEY_HERE" }`,
|
|
115
98
|
};
|
|
116
99
|
} else if (tokenCredential) {
|
|
117
100
|
// Support TokenCredential for non-Azure packages
|
|
118
101
|
return {
|
|
119
102
|
...defaultSetting,
|
|
120
103
|
value: `{ getToken: async () => {
|
|
121
|
-
return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: Date.now() }; } }
|
|
104
|
+
return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: Date.now() }; } }`,
|
|
122
105
|
};
|
|
123
106
|
}
|
|
124
107
|
}
|
|
@@ -130,17 +113,15 @@ export function getCredentialSampleValue(
|
|
|
130
113
|
*/
|
|
131
114
|
export function getCredentialTestValue(
|
|
132
115
|
dpgContext: SdkContext,
|
|
133
|
-
initialization: SdkClientInitializationType
|
|
116
|
+
initialization: SdkClientInitializationType,
|
|
134
117
|
): CommonValue | undefined {
|
|
135
|
-
const createTestCredentialType = resolveReference(
|
|
136
|
-
AzureTestDependencies.createTestCredential
|
|
137
|
-
);
|
|
118
|
+
const createTestCredentialType = resolveReference(AzureTestDependencies.createTestCredential);
|
|
138
119
|
const keyCredential = hasKeyCredential(initialization),
|
|
139
120
|
tokenCredential = hasTokenCredential(initialization);
|
|
140
121
|
const defaultSetting = {
|
|
141
122
|
isOptional: false,
|
|
142
123
|
onClient: true,
|
|
143
|
-
name: "credential"
|
|
124
|
+
name: "credential",
|
|
144
125
|
};
|
|
145
126
|
|
|
146
127
|
if (keyCredential || tokenCredential) {
|
|
@@ -148,13 +129,13 @@ export function getCredentialTestValue(
|
|
|
148
129
|
// Support createTestCredential for ARM/Azure packages
|
|
149
130
|
return {
|
|
150
131
|
...defaultSetting,
|
|
151
|
-
value: `${createTestCredentialType}()
|
|
132
|
+
value: `${createTestCredentialType}()`,
|
|
152
133
|
};
|
|
153
134
|
} else if (keyCredential) {
|
|
154
135
|
// Support ApiKeyCredential for non-Azure packages
|
|
155
136
|
return {
|
|
156
137
|
...defaultSetting,
|
|
157
|
-
value: `{ key: "INPUT_YOUR_KEY_HERE" }
|
|
138
|
+
value: `{ key: "INPUT_YOUR_KEY_HERE" } `,
|
|
158
139
|
};
|
|
159
140
|
} else if (tokenCredential) {
|
|
160
141
|
// Support TokenCredential for non-Azure packages
|
|
@@ -164,7 +145,7 @@ export function getCredentialTestValue(
|
|
|
164
145
|
getToken: async () => {
|
|
165
146
|
return { token: "INPUT_YOUR_TOKEN_HERE", expiresOnTimestamp: Date.now() };
|
|
166
147
|
}
|
|
167
|
-
}
|
|
148
|
+
} `,
|
|
168
149
|
};
|
|
169
150
|
}
|
|
170
151
|
}
|
|
@@ -217,7 +198,7 @@ export function serializeExampleValue(value: SdkExampleValue): string {
|
|
|
217
198
|
const additionalPropertiesValue =
|
|
218
199
|
value.kind === "model" ? (value.additionalPropertiesValue ?? {}) : {};
|
|
219
200
|
for (const propName in {
|
|
220
|
-
...value.value
|
|
201
|
+
...value.value,
|
|
221
202
|
}) {
|
|
222
203
|
let property;
|
|
223
204
|
if (value.type.kind === "model") {
|
|
@@ -232,49 +213,38 @@ export function serializeExampleValue(value: SdkExampleValue): string {
|
|
|
232
213
|
continue;
|
|
233
214
|
}
|
|
234
215
|
// Handle flattened properties: inline inner model properties at current level
|
|
235
|
-
if (
|
|
236
|
-
property?.flatten &&
|
|
237
|
-
property.type.kind === "model" &&
|
|
238
|
-
propValue.kind === "model"
|
|
239
|
-
) {
|
|
216
|
+
if (property?.flatten && property.type.kind === "model" && propValue.kind === "model") {
|
|
240
217
|
const innerMapper = buildTestPropertyNameMapper(property.type);
|
|
241
218
|
for (const innerPropName in propValue.value ?? {}) {
|
|
242
219
|
const innerPropValue = propValue.value[innerPropName];
|
|
243
220
|
if (innerPropValue === undefined || innerPropValue === null) {
|
|
244
221
|
continue;
|
|
245
222
|
}
|
|
246
|
-
const innerProperty = property.type.properties.find(
|
|
247
|
-
|
|
248
|
-
);
|
|
249
|
-
if (
|
|
250
|
-
innerProperty &&
|
|
251
|
-
isReadOnly(innerProperty as SdkModelPropertyType)
|
|
252
|
-
) {
|
|
223
|
+
const innerProperty = property.type.properties.find((p) => p.name === innerPropName);
|
|
224
|
+
if (innerProperty && isReadOnly(innerProperty as SdkModelPropertyType)) {
|
|
253
225
|
continue;
|
|
254
226
|
}
|
|
255
227
|
values.push(
|
|
256
228
|
`"${innerMapper.get(innerPropName) ?? innerPropName}": ` +
|
|
257
|
-
serializeExampleValue(innerPropValue)
|
|
229
|
+
serializeExampleValue(innerPropValue),
|
|
258
230
|
);
|
|
259
231
|
}
|
|
260
232
|
continue;
|
|
261
233
|
}
|
|
262
234
|
const propRetValue =
|
|
263
|
-
`"${mapper.get(propName) ?? propName}": ` +
|
|
264
|
-
serializeExampleValue(propValue);
|
|
235
|
+
`"${mapper.get(propName) ?? propName}": ` + serializeExampleValue(propValue);
|
|
265
236
|
values.push(propRetValue);
|
|
266
237
|
}
|
|
267
238
|
const additionalBags = [];
|
|
268
239
|
for (const propName in {
|
|
269
|
-
...additionalPropertiesValue
|
|
240
|
+
...additionalPropertiesValue,
|
|
270
241
|
}) {
|
|
271
242
|
const propValue = additionalPropertiesValue[propName];
|
|
272
243
|
if (propValue === undefined || propValue === null) {
|
|
273
244
|
continue;
|
|
274
245
|
}
|
|
275
246
|
const propRetValue =
|
|
276
|
-
`"${mapper.get(propName) ?? propName}": ` +
|
|
277
|
-
serializeExampleValue(propValue);
|
|
247
|
+
`"${mapper.get(propName) ?? propName}": ` + serializeExampleValue(propValue);
|
|
278
248
|
additionalBags.push(propRetValue);
|
|
279
249
|
}
|
|
280
250
|
if (additionalBags.length > 0) {
|
|
@@ -315,7 +285,7 @@ function buildTestPropertyNameMapper(type: SdkExampleValue["type"]) {
|
|
|
315
285
|
}
|
|
316
286
|
mapper.set(
|
|
317
287
|
prop.serializationOptions.json?.name || prop.name,
|
|
318
|
-
normalizeName(prop.name, NameType.Property)
|
|
288
|
+
normalizeName(prop.name, NameType.Property),
|
|
319
289
|
);
|
|
320
290
|
}
|
|
321
291
|
return mapper;
|
|
@@ -337,11 +307,10 @@ export function escapeSpecialCharToSpace(str: string): string {
|
|
|
337
307
|
export function getDescriptiveName(
|
|
338
308
|
method: { doc?: string; oriName?: string; name: string },
|
|
339
309
|
exampleName: string,
|
|
340
|
-
type: "sample" | "test"
|
|
310
|
+
type: "sample" | "test",
|
|
341
311
|
): string {
|
|
342
312
|
const description = method.doc ?? `execute ${method.oriName ?? method.name}`;
|
|
343
|
-
let descriptiveName =
|
|
344
|
-
description.charAt(0).toLowerCase() + description.slice(1);
|
|
313
|
+
let descriptiveName = description.charAt(0).toLowerCase() + description.slice(1);
|
|
345
314
|
|
|
346
315
|
// Only remove trailing dots for test names to avoid redundancy
|
|
347
316
|
if (type === "test") {
|
|
@@ -362,18 +331,14 @@ export function prepareCommonParameters(
|
|
|
362
331
|
dpgContext: SdkContext,
|
|
363
332
|
method: ServiceOperation,
|
|
364
333
|
parameterMap: Record<string, SdkHttpParameterExampleValue>,
|
|
365
|
-
topLevelClient: SdkClientType<SdkServiceOperation
|
|
334
|
+
topLevelClient: SdkClientType<SdkServiceOperation>,
|
|
366
335
|
): CommonValue[] {
|
|
367
336
|
const envType = resolveReference(AzureTestDependencies.env);
|
|
368
337
|
const result: CommonValue[] = [];
|
|
369
338
|
|
|
370
|
-
const clientParams = getClientParametersDeclaration(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
{
|
|
374
|
-
onClientOnly: true
|
|
375
|
-
}
|
|
376
|
-
);
|
|
339
|
+
const clientParams = getClientParametersDeclaration(topLevelClient, dpgContext, {
|
|
340
|
+
onClientOnly: true,
|
|
341
|
+
});
|
|
377
342
|
|
|
378
343
|
for (const param of clientParams) {
|
|
379
344
|
if (param.name === "options" || param.name === "credential") {
|
|
@@ -382,22 +347,16 @@ export function prepareCommonParameters(
|
|
|
382
347
|
|
|
383
348
|
const exampleValue: CommonValue = {
|
|
384
349
|
name: param.name === "endpointParam" ? "endpoint" : param.name,
|
|
385
|
-
value: getEnvironmentVariableName(
|
|
386
|
-
param.name,
|
|
387
|
-
getClassicalClientName(topLevelClient)
|
|
388
|
-
),
|
|
350
|
+
value: getEnvironmentVariableName(param.name, getClassicalClientName(topLevelClient)),
|
|
389
351
|
isOptional: Boolean(param.hasQuestionToken),
|
|
390
|
-
onClient: true
|
|
352
|
+
onClient: true,
|
|
391
353
|
};
|
|
392
354
|
|
|
393
355
|
result.push(exampleValue);
|
|
394
356
|
}
|
|
395
357
|
|
|
396
358
|
// Handle credentials for tests
|
|
397
|
-
const credentialValue = getCredentialTestValue(
|
|
398
|
-
dpgContext,
|
|
399
|
-
topLevelClient.clientInitialization
|
|
400
|
-
);
|
|
359
|
+
const credentialValue = getCredentialTestValue(dpgContext, topLevelClient.clientInitialization);
|
|
401
360
|
if (credentialValue) {
|
|
402
361
|
result.push(credentialValue);
|
|
403
362
|
}
|
|
@@ -407,11 +366,7 @@ export function prepareCommonParameters(
|
|
|
407
366
|
|
|
408
367
|
// Process required parameters
|
|
409
368
|
for (const param of method.operation.parameters) {
|
|
410
|
-
if (
|
|
411
|
-
param.optional === true ||
|
|
412
|
-
param.type.kind === "constant" ||
|
|
413
|
-
param.clientDefaultValue
|
|
414
|
-
) {
|
|
369
|
+
if (param.optional === true || param.type.kind === "constant" || param.clientDefaultValue) {
|
|
415
370
|
continue;
|
|
416
371
|
}
|
|
417
372
|
|
|
@@ -421,9 +376,7 @@ export function prepareCommonParameters(
|
|
|
421
376
|
if (param.name.toLowerCase() === "subscriptionid" && dpgContext.arm) {
|
|
422
377
|
isSubscriptionIdAdded = true;
|
|
423
378
|
// For tests, always use env variable
|
|
424
|
-
result.push(
|
|
425
|
-
prepareCommonValue("subscriptionId", subscriptionIdValue, false, true)
|
|
426
|
-
);
|
|
379
|
+
result.push(prepareCommonValue("subscriptionId", subscriptionIdValue, false, true));
|
|
427
380
|
continue;
|
|
428
381
|
}
|
|
429
382
|
|
|
@@ -431,12 +384,7 @@ export function prepareCommonParameters(
|
|
|
431
384
|
if (!param.optional) {
|
|
432
385
|
// Generate default values for required parameters without examples in tests
|
|
433
386
|
result.push(
|
|
434
|
-
prepareCommonValue(
|
|
435
|
-
param.name,
|
|
436
|
-
`"{Your ${param.name}}"`,
|
|
437
|
-
false,
|
|
438
|
-
param.onClient
|
|
439
|
-
)
|
|
387
|
+
prepareCommonValue(param.name, `"{Your ${param.name}}"`, false, param.onClient),
|
|
440
388
|
);
|
|
441
389
|
}
|
|
442
390
|
continue;
|
|
@@ -447,20 +395,14 @@ export function prepareCommonParameters(
|
|
|
447
395
|
exampleValue.parameter.name,
|
|
448
396
|
exampleValue.value,
|
|
449
397
|
param.optional,
|
|
450
|
-
param.onClient
|
|
451
|
-
)
|
|
398
|
+
param.onClient,
|
|
399
|
+
),
|
|
452
400
|
);
|
|
453
401
|
}
|
|
454
402
|
|
|
455
403
|
// Add subscriptionId for ARM clients if needed
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
getSubscriptionId(dpgContext) &&
|
|
459
|
-
!isSubscriptionIdAdded
|
|
460
|
-
) {
|
|
461
|
-
result.push(
|
|
462
|
-
prepareCommonValue("subscriptionId", subscriptionIdValue, false, true)
|
|
463
|
-
);
|
|
404
|
+
if (dpgContext.arm && getSubscriptionId(dpgContext) && !isSubscriptionIdAdded) {
|
|
405
|
+
result.push(prepareCommonValue("subscriptionId", subscriptionIdValue, false, true));
|
|
464
406
|
}
|
|
465
407
|
|
|
466
408
|
// Handle body parameters
|
|
@@ -482,22 +424,13 @@ export function prepareCommonParameters(
|
|
|
482
424
|
if (isReadOnly(prop as SdkModelPropertyType)) {
|
|
483
425
|
continue;
|
|
484
426
|
}
|
|
485
|
-
result.push(
|
|
486
|
-
prepareCommonValue(
|
|
487
|
-
prop.name,
|
|
488
|
-
propExample,
|
|
489
|
-
prop.optional,
|
|
490
|
-
prop.onClient
|
|
491
|
-
)
|
|
492
|
-
);
|
|
427
|
+
result.push(prepareCommonValue(prop.name, propExample, prop.optional, prop.onClient));
|
|
493
428
|
}
|
|
494
429
|
} else {
|
|
495
430
|
// Check if the body parameter is nested inside a wrapper (e.g., @bodyRoot)
|
|
496
431
|
const segments = bodyParam.methodParameterSegments;
|
|
497
432
|
const isNestedBody =
|
|
498
|
-
segments.length === 1 &&
|
|
499
|
-
segments[0] !== undefined &&
|
|
500
|
-
segments[0].length > 1;
|
|
433
|
+
segments.length === 1 && segments[0] !== undefined && segments[0].length > 1;
|
|
501
434
|
if (isNestedBody) {
|
|
502
435
|
const path = segments[0]!;
|
|
503
436
|
// The first segment is the method-level wrapper param (e.g., "body")
|
|
@@ -514,8 +447,8 @@ export function prepareCommonParameters(
|
|
|
514
447
|
methodParamName,
|
|
515
448
|
wrappedValue,
|
|
516
449
|
methodParamOptional,
|
|
517
|
-
bodyParam.onClient
|
|
518
|
-
)
|
|
450
|
+
bodyParam.onClient,
|
|
451
|
+
),
|
|
519
452
|
);
|
|
520
453
|
} else {
|
|
521
454
|
result.push(
|
|
@@ -523,8 +456,8 @@ export function prepareCommonParameters(
|
|
|
523
456
|
bodyParam.name,
|
|
524
457
|
bodyExample.value,
|
|
525
458
|
bodyParam.optional,
|
|
526
|
-
bodyParam.onClient
|
|
527
|
-
)
|
|
459
|
+
bodyParam.onClient,
|
|
460
|
+
),
|
|
528
461
|
);
|
|
529
462
|
}
|
|
530
463
|
}
|
|
@@ -534,21 +467,12 @@ export function prepareCommonParameters(
|
|
|
534
467
|
method.operation.parameters
|
|
535
468
|
.filter(
|
|
536
469
|
(param) =>
|
|
537
|
-
param.optional === true &&
|
|
538
|
-
parameterMap[param.serializedName] &&
|
|
539
|
-
!param.clientDefaultValue
|
|
470
|
+
param.optional === true && parameterMap[param.serializedName] && !param.clientDefaultValue,
|
|
540
471
|
)
|
|
541
472
|
.forEach((param) => {
|
|
542
473
|
const exampleValue = parameterMap[param.serializedName];
|
|
543
474
|
if (exampleValue && exampleValue.value) {
|
|
544
|
-
result.push(
|
|
545
|
-
prepareCommonValue(
|
|
546
|
-
param.name,
|
|
547
|
-
exampleValue.value,
|
|
548
|
-
true,
|
|
549
|
-
param.onClient
|
|
550
|
-
)
|
|
551
|
-
);
|
|
475
|
+
result.push(prepareCommonValue(param.name, exampleValue.value, true, param.onClient));
|
|
552
476
|
}
|
|
553
477
|
});
|
|
554
478
|
|
|
@@ -563,8 +487,8 @@ export function iterateClientsAndMethods(
|
|
|
563
487
|
callback: (
|
|
564
488
|
dpgContext: SdkContext,
|
|
565
489
|
method: ServiceOperation,
|
|
566
|
-
options: ClientEmitOptions
|
|
567
|
-
) => SourceFile | undefined
|
|
490
|
+
options: ClientEmitOptions,
|
|
491
|
+
) => SourceFile | undefined,
|
|
568
492
|
): SourceFile[] {
|
|
569
493
|
const generatedFiles: SourceFile[] = [];
|
|
570
494
|
const clients = dpgContext.sdkPackage.clients;
|
|
@@ -587,7 +511,7 @@ export function iterateClientsAndMethods(
|
|
|
587
511
|
clients.length > 1
|
|
588
512
|
? normalizeName(getClassicalClientName(client), NameType.File)
|
|
589
513
|
: undefined,
|
|
590
|
-
hierarchies: hierarchies
|
|
514
|
+
hierarchies: hierarchies,
|
|
591
515
|
});
|
|
592
516
|
}
|
|
593
517
|
}
|
|
@@ -602,7 +526,7 @@ export function generateMethodCall(
|
|
|
602
526
|
method: ServiceOperation,
|
|
603
527
|
parameters: CommonValue[],
|
|
604
528
|
options: ClientEmitOptions,
|
|
605
|
-
dpgContext?: SdkContext
|
|
529
|
+
dpgContext?: SdkContext,
|
|
606
530
|
): { methodCall: string; clientParams: string[]; clientParamDefs: string[] } {
|
|
607
531
|
// Prepare client-level parameters
|
|
608
532
|
const clientParamValues = parameters.filter((p) => p.onClient);
|
|
@@ -624,17 +548,13 @@ export function generateMethodCall(
|
|
|
624
548
|
const operationFunction = getOperationFunction(
|
|
625
549
|
dpgContext,
|
|
626
550
|
[options.hierarchies ?? [], method],
|
|
627
|
-
"Client"
|
|
551
|
+
"Client",
|
|
628
552
|
);
|
|
629
553
|
|
|
630
554
|
// Extract parameter names from the function signature (excluding context and options)
|
|
631
555
|
const signatureParamNames =
|
|
632
556
|
operationFunction.parameters
|
|
633
|
-
?.filter(
|
|
634
|
-
(p) =>
|
|
635
|
-
p.name !== "context" &&
|
|
636
|
-
!p.type?.toString().includes("OptionalParams")
|
|
637
|
-
)
|
|
557
|
+
?.filter((p) => p.name !== "context" && !p.type?.toString().includes("OptionalParams"))
|
|
638
558
|
.map((p) => p.name) ?? [];
|
|
639
559
|
|
|
640
560
|
// Create a map for quick lookup of parameter values by name
|
|
@@ -648,9 +568,7 @@ export function generateMethodCall(
|
|
|
648
568
|
methodParams = orderedRequiredParams.map((p) => `${p.value}`);
|
|
649
569
|
} else {
|
|
650
570
|
// Original logic when dpgContext is not provided
|
|
651
|
-
methodParams = methodParamValues
|
|
652
|
-
.filter((p) => !p.isOptional)
|
|
653
|
-
.map((p) => `${p.value}`);
|
|
571
|
+
methodParams = methodParamValues.filter((p) => !p.isOptional).map((p) => `${p.value}`);
|
|
654
572
|
}
|
|
655
573
|
|
|
656
574
|
const optionalParams = methodParamValues
|
|
@@ -660,9 +578,7 @@ export function generateMethodCall(
|
|
|
660
578
|
methodParams.push(`{${optionalParams.join(", ")}}`);
|
|
661
579
|
}
|
|
662
580
|
|
|
663
|
-
const prefix = options.classicalMethodPrefix
|
|
664
|
-
? `${options.classicalMethodPrefix}.`
|
|
665
|
-
: "";
|
|
581
|
+
const prefix = options.classicalMethodPrefix ? `${options.classicalMethodPrefix}.` : "";
|
|
666
582
|
const methodCall = `client.${prefix}${normalizeName(method.oriName ?? method.name, NameType.Property)}(${methodParams.join(", ")})`;
|
|
667
583
|
|
|
668
584
|
return { methodCall, clientParams, clientParamDefs };
|
|
@@ -676,30 +592,22 @@ export function createSourceFile(
|
|
|
676
592
|
method: ServiceOperation,
|
|
677
593
|
options: ClientEmitOptions,
|
|
678
594
|
type: "sample" | "test",
|
|
679
|
-
fileName: string
|
|
595
|
+
fileName: string,
|
|
680
596
|
): SourceFile {
|
|
681
597
|
const project = useContext("outputProject");
|
|
682
|
-
const operationPrefix = `${options.classicalMethodPrefix ?? ""} ${
|
|
683
|
-
|
|
684
|
-
}`;
|
|
685
|
-
const baseFolder =
|
|
686
|
-
type === "sample" ? "samples-dev" : join("test", "generated");
|
|
598
|
+
const operationPrefix = `${options.classicalMethodPrefix ?? ""} ${method.oriName ?? method.name}`;
|
|
599
|
+
const baseFolder = type === "sample" ? "samples-dev" : join("test", "generated");
|
|
687
600
|
const folder = join(
|
|
688
601
|
dpgContext.generationPathDetail?.rootDir ?? "",
|
|
689
602
|
baseFolder,
|
|
690
|
-
options.subFolder ?? ""
|
|
603
|
+
options.subFolder ?? "",
|
|
691
604
|
);
|
|
692
605
|
const fileExtension = type === "sample" ? ".ts" : ".spec.ts";
|
|
693
|
-
const normalizedFileName = normalizeName(
|
|
694
|
-
fileName || `${operationPrefix} ${type}`,
|
|
695
|
-
NameType.File
|
|
696
|
-
);
|
|
606
|
+
const normalizedFileName = normalizeName(fileName || `${operationPrefix} ${type}`, NameType.File);
|
|
697
607
|
|
|
698
|
-
return project.createSourceFile(
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
{ overwrite: true }
|
|
702
|
-
);
|
|
608
|
+
return project.createSourceFile(join(folder, `${normalizedFileName}${fileExtension}`), "", {
|
|
609
|
+
overwrite: true,
|
|
610
|
+
});
|
|
703
611
|
}
|
|
704
612
|
|
|
705
613
|
/**
|
|
@@ -709,7 +617,7 @@ export function generateAssertionsForValue(
|
|
|
709
617
|
value: SdkExampleValue,
|
|
710
618
|
path: string,
|
|
711
619
|
maxDepth: number = 3,
|
|
712
|
-
currentDepth: number = 0
|
|
620
|
+
currentDepth: number = 0,
|
|
713
621
|
): string[] {
|
|
714
622
|
const assertions: string[] = [];
|
|
715
623
|
|
|
@@ -723,13 +631,13 @@ export function generateAssertionsForValue(
|
|
|
723
631
|
switch (value.type.kind) {
|
|
724
632
|
case "utcDateTime":
|
|
725
633
|
assertions.push(
|
|
726
|
-
`assert.strictEqual(${path}.getTime(), new Date("${value.value}").getTime())
|
|
634
|
+
`assert.strictEqual(${path}.getTime(), new Date("${value.value}").getTime());`,
|
|
727
635
|
);
|
|
728
636
|
break;
|
|
729
637
|
case "bytes": {
|
|
730
638
|
const encode = value.type.encode ?? "base64";
|
|
731
639
|
assertions.push(
|
|
732
|
-
`assert.deepEqual(${path}, Buffer.from("${value.value}", "${encode}"))
|
|
640
|
+
`assert.deepEqual(${path}, Buffer.from("${value.value}", "${encode}"));`,
|
|
733
641
|
);
|
|
734
642
|
break;
|
|
735
643
|
}
|
|
@@ -750,9 +658,7 @@ export function generateAssertionsForValue(
|
|
|
750
658
|
}
|
|
751
659
|
case "boolean":
|
|
752
660
|
case "number":
|
|
753
|
-
assertions.push(
|
|
754
|
-
`assert.strictEqual(${path}, ${JSON.stringify(value.value)});`
|
|
755
|
-
);
|
|
661
|
+
assertions.push(`assert.strictEqual(${path}, ${JSON.stringify(value.value)});`);
|
|
756
662
|
break;
|
|
757
663
|
case "unknown":
|
|
758
664
|
// for unknown type we fall back to assert.isDefined to avoid false positives in tests, so we can't assert on the exact value. But we can still check that the payload is defined.
|
|
@@ -761,9 +667,7 @@ export function generateAssertionsForValue(
|
|
|
761
667
|
case "array":
|
|
762
668
|
if (value.value && value.value.length > 0) {
|
|
763
669
|
assertions.push(`assert.ok(Array.isArray(${path}));`);
|
|
764
|
-
assertions.push(
|
|
765
|
-
`assert.strictEqual(${path}.length, ${value.value.length});`
|
|
766
|
-
);
|
|
670
|
+
assertions.push(`assert.strictEqual(${path}.length, ${value.value.length});`);
|
|
767
671
|
|
|
768
672
|
// Assert on first few items to avoid overly verbose tests
|
|
769
673
|
const itemsToCheck = Math.min(value.value.length, 2);
|
|
@@ -774,7 +678,7 @@ export function generateAssertionsForValue(
|
|
|
774
678
|
item,
|
|
775
679
|
`${path}[${i}]`,
|
|
776
680
|
maxDepth,
|
|
777
|
-
currentDepth + 1
|
|
681
|
+
currentDepth + 1,
|
|
778
682
|
);
|
|
779
683
|
assertions.push(...itemAssertions);
|
|
780
684
|
}
|
|
@@ -792,21 +696,16 @@ export function generateAssertionsForValue(
|
|
|
792
696
|
// Check if this property is flattened in the model type
|
|
793
697
|
let property;
|
|
794
698
|
if (value.kind === "model" && value.type.kind === "model") {
|
|
795
|
-
property = value.type.properties.find(
|
|
796
|
-
(p) => p.kind === "property" && p.name === key
|
|
797
|
-
);
|
|
699
|
+
property = value.type.properties.find((p) => p.kind === "property" && p.name === key);
|
|
798
700
|
}
|
|
799
|
-
if (
|
|
800
|
-
property?.flatten &&
|
|
801
|
-
(val as SdkExampleValue).kind === "model"
|
|
802
|
-
) {
|
|
701
|
+
if (property?.flatten && (val as SdkExampleValue).kind === "model") {
|
|
803
702
|
// For flattened properties, recurse using the parent path so
|
|
804
703
|
// assertions reference result.xxx instead of result.properties.xxx
|
|
805
704
|
const innerAssertions = generateAssertionsForValue(
|
|
806
705
|
val as SdkExampleValue,
|
|
807
706
|
path,
|
|
808
707
|
maxDepth,
|
|
809
|
-
currentDepth + 1
|
|
708
|
+
currentDepth + 1,
|
|
810
709
|
);
|
|
811
710
|
assertions.push(...innerAssertions);
|
|
812
711
|
} else {
|
|
@@ -815,14 +714,12 @@ export function generateAssertionsForValue(
|
|
|
815
714
|
// For nested model/dict values, append "?" to the path so child
|
|
816
715
|
// property accesses use optional chaining (e.g. result.systemData?.createdBy)
|
|
817
716
|
const recursePath =
|
|
818
|
-
nestedVal.kind === "model" || nestedVal.kind === "dict"
|
|
819
|
-
? `${propPath}?`
|
|
820
|
-
: propPath;
|
|
717
|
+
nestedVal.kind === "model" || nestedVal.kind === "dict" ? `${propPath}?` : propPath;
|
|
821
718
|
const propAssertions = generateAssertionsForValue(
|
|
822
719
|
nestedVal,
|
|
823
720
|
recursePath,
|
|
824
721
|
maxDepth,
|
|
825
|
-
currentDepth + 1
|
|
722
|
+
currentDepth + 1,
|
|
826
723
|
);
|
|
827
724
|
assertions.push(...propAssertions);
|
|
828
725
|
}
|
|
@@ -842,7 +739,7 @@ export function generateAssertionsForValue(
|
|
|
842
739
|
value.value as SdkExampleValue,
|
|
843
740
|
path,
|
|
844
741
|
maxDepth,
|
|
845
|
-
currentDepth
|
|
742
|
+
currentDepth,
|
|
846
743
|
);
|
|
847
744
|
assertions.push(...unionAssertions);
|
|
848
745
|
}
|
|
@@ -858,7 +755,7 @@ export function generateAssertionsForValue(
|
|
|
858
755
|
export function generateResponseAssertions(
|
|
859
756
|
example: SdkHttpOperationExample,
|
|
860
757
|
resultVariableName: string,
|
|
861
|
-
isPaging: boolean = false
|
|
758
|
+
isPaging: boolean = false,
|
|
862
759
|
): string[] {
|
|
863
760
|
const assertions: string[] = [];
|
|
864
761
|
|
|
@@ -889,16 +786,13 @@ export function generateResponseAssertions(
|
|
|
889
786
|
if (isPaging) {
|
|
890
787
|
// For paging operations, the response body should have a 'value' array
|
|
891
788
|
if (responseBody.kind === "model" || responseBody.kind === "dict") {
|
|
892
|
-
const responseValue = responseBody.value as Record<
|
|
893
|
-
string,
|
|
894
|
-
SdkExampleValue
|
|
895
|
-
>;
|
|
789
|
+
const responseValue = responseBody.value as Record<string, SdkExampleValue>;
|
|
896
790
|
const valueArray = responseValue?.["value"];
|
|
897
791
|
|
|
898
792
|
if (valueArray && valueArray.kind === "array" && valueArray.value) {
|
|
899
793
|
// Assert on the length of the collected results
|
|
900
794
|
assertions.push(
|
|
901
|
-
`assert.strictEqual(${resultVariableName}.length, ${valueArray.value.length})
|
|
795
|
+
`assert.strictEqual(${resultVariableName}.length, ${valueArray.value.length});`,
|
|
902
796
|
);
|
|
903
797
|
|
|
904
798
|
// Assert on the first item if available
|
|
@@ -909,7 +803,7 @@ export function generateResponseAssertions(
|
|
|
909
803
|
firstItem,
|
|
910
804
|
`${resultVariableName}[0]`,
|
|
911
805
|
2, // Limit depth for paging items
|
|
912
|
-
0
|
|
806
|
+
0,
|
|
913
807
|
);
|
|
914
808
|
assertions.push(...itemAssertions);
|
|
915
809
|
}
|
|
@@ -918,10 +812,7 @@ export function generateResponseAssertions(
|
|
|
918
812
|
}
|
|
919
813
|
} else {
|
|
920
814
|
// Generate assertions based on response body structure
|
|
921
|
-
const responseAssertions = generateAssertionsForValue(
|
|
922
|
-
responseBody,
|
|
923
|
-
resultVariableName
|
|
924
|
-
);
|
|
815
|
+
const responseAssertions = generateAssertionsForValue(responseBody, resultVariableName);
|
|
925
816
|
assertions.push(...responseAssertions);
|
|
926
817
|
}
|
|
927
818
|
|
|
@@ -935,10 +826,7 @@ export function generateResponseAssertions(
|
|
|
935
826
|
* @param clientName - Optional client name to use as prefix
|
|
936
827
|
* @returns The environment variable expression string
|
|
937
828
|
*/
|
|
938
|
-
function getEnvironmentVariableName(
|
|
939
|
-
paramName: string,
|
|
940
|
-
clientName?: string
|
|
941
|
-
): string {
|
|
829
|
+
function getEnvironmentVariableName(paramName: string, clientName?: string): string {
|
|
942
830
|
// Remove "Param" suffix if present
|
|
943
831
|
const cleanName = paramName.replace(/Param$/, "");
|
|
944
832
|
|