@azure-tools/typespec-ts 0.54.0 → 0.55.0-dev.6
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 +0 -4
- package/dist/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.js +3 -3
- 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 +31 -40
- 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 -12
- 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 +17 -31
- 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 +2 -2
- 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 +103 -92
- 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 +60 -74
- 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 +8 -10
- 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 +31 -38
- 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 +5 -6
- 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 +23 -25
- 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 +8 -11
- 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 +12 -13
- 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 +36 -50
- 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 -18
- 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 +4 -4
- 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 +81 -113
- 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 +7 -8
- 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 +69 -77
- 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 +13 -18
- 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 +59 -68
- 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 +31 -54
- 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 +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 +72 -84
- 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 +7 -10
- 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 +204 -288
- 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 +4 -6
- 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 +58 -67
- 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 +65 -75
- 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 +73 -90
- 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 +25 -33
- 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 -2
- 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 +10 -13
- 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 +2 -3
- 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 +5 -11
- 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 +67 -89
- 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 +28 -45
- 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 +59 -60
- 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 +37 -38
- 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 +4 -5
- 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 +4 -4
- 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 +57 -96
- 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 +71 -61
- 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 +9 -10
- 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 +23 -27
- 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 +6 -8
- 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 +32 -37
- 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 +2 -4
- 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 +17 -23
- 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 +16 -31
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
- package/dist/src/rlc-common/helpers/packageUtil.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 +3 -7
- 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 +4 -9
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +7 -11
- 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 +14 -15
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +5 -8
- 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 +33 -37
- 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 +31 -39
- 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 +4 -6
- 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 +3 -5
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +11 -12
- package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +28 -28
- 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 -5
- 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 +4 -5
- 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 +14 -14
- 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 +24 -29
- 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 +28 -31
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/utils.js +1 -2
- package/dist/src/rlc-common/metadata/utils.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +4 -5
- package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +3 -4
- 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 +7 -10
- 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 +41 -45
- 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 +28 -27
- 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 +12 -14
- 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 +11 -14
- 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 +32 -45
- 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 +19 -23
- 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 +21 -25
- 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 +21 -32
- 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 +28 -39
- 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 +15 -23
- 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 +4 -5
- 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 +11 -15
- 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 +5 -7
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts +2 -0
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +26 -7
- 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 +3 -6
- 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 +168 -257
- 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 +6 -7
- 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 +60 -81
- 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 +26 -33
- 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 +38 -45
- 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 +145 -185
- 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 -160
- 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 +92 -180
- 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 +99 -215
- 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 -22
- 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 +44 -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 -116
- 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 +30 -8
- 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 +16 -29
- 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-browser.mts +3 -1
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
- 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 +42 -90
- package/static/static-helpers/simplePollerHelpers.ts +10 -19
- 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
|
}
|
|
@@ -198,9 +179,7 @@ export function serializeExampleValue(value: SdkExampleValue): string {
|
|
|
198
179
|
.replace(/\n/g, "\\n")
|
|
199
180
|
.replace(/\r/g, "\\r")
|
|
200
181
|
.replace(/\t/g, "\\t")
|
|
201
|
-
.replace(/\f/g, "\\f")
|
|
202
|
-
.replace(/>/g, ">")
|
|
203
|
-
.replace(/</g, "<")}"`;
|
|
182
|
+
.replace(/\f/g, "\\f")}"`;
|
|
204
183
|
break;
|
|
205
184
|
}
|
|
206
185
|
break;
|
|
@@ -219,7 +198,7 @@ export function serializeExampleValue(value: SdkExampleValue): string {
|
|
|
219
198
|
const additionalPropertiesValue =
|
|
220
199
|
value.kind === "model" ? (value.additionalPropertiesValue ?? {}) : {};
|
|
221
200
|
for (const propName in {
|
|
222
|
-
...value.value
|
|
201
|
+
...value.value,
|
|
223
202
|
}) {
|
|
224
203
|
let property;
|
|
225
204
|
if (value.type.kind === "model") {
|
|
@@ -234,49 +213,38 @@ export function serializeExampleValue(value: SdkExampleValue): string {
|
|
|
234
213
|
continue;
|
|
235
214
|
}
|
|
236
215
|
// Handle flattened properties: inline inner model properties at current level
|
|
237
|
-
if (
|
|
238
|
-
property?.flatten &&
|
|
239
|
-
property.type.kind === "model" &&
|
|
240
|
-
propValue.kind === "model"
|
|
241
|
-
) {
|
|
216
|
+
if (property?.flatten && property.type.kind === "model" && propValue.kind === "model") {
|
|
242
217
|
const innerMapper = buildTestPropertyNameMapper(property.type);
|
|
243
218
|
for (const innerPropName in propValue.value ?? {}) {
|
|
244
219
|
const innerPropValue = propValue.value[innerPropName];
|
|
245
220
|
if (innerPropValue === undefined || innerPropValue === null) {
|
|
246
221
|
continue;
|
|
247
222
|
}
|
|
248
|
-
const innerProperty = property.type.properties.find(
|
|
249
|
-
|
|
250
|
-
);
|
|
251
|
-
if (
|
|
252
|
-
innerProperty &&
|
|
253
|
-
isReadOnly(innerProperty as SdkModelPropertyType)
|
|
254
|
-
) {
|
|
223
|
+
const innerProperty = property.type.properties.find((p) => p.name === innerPropName);
|
|
224
|
+
if (innerProperty && isReadOnly(innerProperty as SdkModelPropertyType)) {
|
|
255
225
|
continue;
|
|
256
226
|
}
|
|
257
227
|
values.push(
|
|
258
228
|
`"${innerMapper.get(innerPropName) ?? innerPropName}": ` +
|
|
259
|
-
serializeExampleValue(innerPropValue)
|
|
229
|
+
serializeExampleValue(innerPropValue),
|
|
260
230
|
);
|
|
261
231
|
}
|
|
262
232
|
continue;
|
|
263
233
|
}
|
|
264
234
|
const propRetValue =
|
|
265
|
-
`"${mapper.get(propName) ?? propName}": ` +
|
|
266
|
-
serializeExampleValue(propValue);
|
|
235
|
+
`"${mapper.get(propName) ?? propName}": ` + serializeExampleValue(propValue);
|
|
267
236
|
values.push(propRetValue);
|
|
268
237
|
}
|
|
269
238
|
const additionalBags = [];
|
|
270
239
|
for (const propName in {
|
|
271
|
-
...additionalPropertiesValue
|
|
240
|
+
...additionalPropertiesValue,
|
|
272
241
|
}) {
|
|
273
242
|
const propValue = additionalPropertiesValue[propName];
|
|
274
243
|
if (propValue === undefined || propValue === null) {
|
|
275
244
|
continue;
|
|
276
245
|
}
|
|
277
246
|
const propRetValue =
|
|
278
|
-
`"${mapper.get(propName) ?? propName}": ` +
|
|
279
|
-
serializeExampleValue(propValue);
|
|
247
|
+
`"${mapper.get(propName) ?? propName}": ` + serializeExampleValue(propValue);
|
|
280
248
|
additionalBags.push(propRetValue);
|
|
281
249
|
}
|
|
282
250
|
if (additionalBags.length > 0) {
|
|
@@ -317,7 +285,7 @@ function buildTestPropertyNameMapper(type: SdkExampleValue["type"]) {
|
|
|
317
285
|
}
|
|
318
286
|
mapper.set(
|
|
319
287
|
prop.serializationOptions.json?.name || prop.name,
|
|
320
|
-
normalizeName(prop.name, NameType.Property)
|
|
288
|
+
normalizeName(prop.name, NameType.Property),
|
|
321
289
|
);
|
|
322
290
|
}
|
|
323
291
|
return mapper;
|
|
@@ -339,11 +307,10 @@ export function escapeSpecialCharToSpace(str: string): string {
|
|
|
339
307
|
export function getDescriptiveName(
|
|
340
308
|
method: { doc?: string; oriName?: string; name: string },
|
|
341
309
|
exampleName: string,
|
|
342
|
-
type: "sample" | "test"
|
|
310
|
+
type: "sample" | "test",
|
|
343
311
|
): string {
|
|
344
312
|
const description = method.doc ?? `execute ${method.oriName ?? method.name}`;
|
|
345
|
-
let descriptiveName =
|
|
346
|
-
description.charAt(0).toLowerCase() + description.slice(1);
|
|
313
|
+
let descriptiveName = description.charAt(0).toLowerCase() + description.slice(1);
|
|
347
314
|
|
|
348
315
|
// Only remove trailing dots for test names to avoid redundancy
|
|
349
316
|
if (type === "test") {
|
|
@@ -364,18 +331,14 @@ export function prepareCommonParameters(
|
|
|
364
331
|
dpgContext: SdkContext,
|
|
365
332
|
method: ServiceOperation,
|
|
366
333
|
parameterMap: Record<string, SdkHttpParameterExampleValue>,
|
|
367
|
-
topLevelClient: SdkClientType<SdkServiceOperation
|
|
334
|
+
topLevelClient: SdkClientType<SdkServiceOperation>,
|
|
368
335
|
): CommonValue[] {
|
|
369
336
|
const envType = resolveReference(AzureTestDependencies.env);
|
|
370
337
|
const result: CommonValue[] = [];
|
|
371
338
|
|
|
372
|
-
const clientParams = getClientParametersDeclaration(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
{
|
|
376
|
-
onClientOnly: true
|
|
377
|
-
}
|
|
378
|
-
);
|
|
339
|
+
const clientParams = getClientParametersDeclaration(topLevelClient, dpgContext, {
|
|
340
|
+
onClientOnly: true,
|
|
341
|
+
});
|
|
379
342
|
|
|
380
343
|
for (const param of clientParams) {
|
|
381
344
|
if (param.name === "options" || param.name === "credential") {
|
|
@@ -384,22 +347,16 @@ export function prepareCommonParameters(
|
|
|
384
347
|
|
|
385
348
|
const exampleValue: CommonValue = {
|
|
386
349
|
name: param.name === "endpointParam" ? "endpoint" : param.name,
|
|
387
|
-
value: getEnvironmentVariableName(
|
|
388
|
-
param.name,
|
|
389
|
-
getClassicalClientName(topLevelClient)
|
|
390
|
-
),
|
|
350
|
+
value: getEnvironmentVariableName(param.name, getClassicalClientName(topLevelClient)),
|
|
391
351
|
isOptional: Boolean(param.hasQuestionToken),
|
|
392
|
-
onClient: true
|
|
352
|
+
onClient: true,
|
|
393
353
|
};
|
|
394
354
|
|
|
395
355
|
result.push(exampleValue);
|
|
396
356
|
}
|
|
397
357
|
|
|
398
358
|
// Handle credentials for tests
|
|
399
|
-
const credentialValue = getCredentialTestValue(
|
|
400
|
-
dpgContext,
|
|
401
|
-
topLevelClient.clientInitialization
|
|
402
|
-
);
|
|
359
|
+
const credentialValue = getCredentialTestValue(dpgContext, topLevelClient.clientInitialization);
|
|
403
360
|
if (credentialValue) {
|
|
404
361
|
result.push(credentialValue);
|
|
405
362
|
}
|
|
@@ -409,11 +366,7 @@ export function prepareCommonParameters(
|
|
|
409
366
|
|
|
410
367
|
// Process required parameters
|
|
411
368
|
for (const param of method.operation.parameters) {
|
|
412
|
-
if (
|
|
413
|
-
param.optional === true ||
|
|
414
|
-
param.type.kind === "constant" ||
|
|
415
|
-
param.clientDefaultValue
|
|
416
|
-
) {
|
|
369
|
+
if (param.optional === true || param.type.kind === "constant" || param.clientDefaultValue) {
|
|
417
370
|
continue;
|
|
418
371
|
}
|
|
419
372
|
|
|
@@ -423,9 +376,7 @@ export function prepareCommonParameters(
|
|
|
423
376
|
if (param.name.toLowerCase() === "subscriptionid" && dpgContext.arm) {
|
|
424
377
|
isSubscriptionIdAdded = true;
|
|
425
378
|
// For tests, always use env variable
|
|
426
|
-
result.push(
|
|
427
|
-
prepareCommonValue("subscriptionId", subscriptionIdValue, false, true)
|
|
428
|
-
);
|
|
379
|
+
result.push(prepareCommonValue("subscriptionId", subscriptionIdValue, false, true));
|
|
429
380
|
continue;
|
|
430
381
|
}
|
|
431
382
|
|
|
@@ -433,12 +384,7 @@ export function prepareCommonParameters(
|
|
|
433
384
|
if (!param.optional) {
|
|
434
385
|
// Generate default values for required parameters without examples in tests
|
|
435
386
|
result.push(
|
|
436
|
-
prepareCommonValue(
|
|
437
|
-
param.name,
|
|
438
|
-
`"{Your ${param.name}}"`,
|
|
439
|
-
false,
|
|
440
|
-
param.onClient
|
|
441
|
-
)
|
|
387
|
+
prepareCommonValue(param.name, `"{Your ${param.name}}"`, false, param.onClient),
|
|
442
388
|
);
|
|
443
389
|
}
|
|
444
390
|
continue;
|
|
@@ -449,20 +395,14 @@ export function prepareCommonParameters(
|
|
|
449
395
|
exampleValue.parameter.name,
|
|
450
396
|
exampleValue.value,
|
|
451
397
|
param.optional,
|
|
452
|
-
param.onClient
|
|
453
|
-
)
|
|
398
|
+
param.onClient,
|
|
399
|
+
),
|
|
454
400
|
);
|
|
455
401
|
}
|
|
456
402
|
|
|
457
403
|
// Add subscriptionId for ARM clients if needed
|
|
458
|
-
if (
|
|
459
|
-
|
|
460
|
-
getSubscriptionId(dpgContext) &&
|
|
461
|
-
!isSubscriptionIdAdded
|
|
462
|
-
) {
|
|
463
|
-
result.push(
|
|
464
|
-
prepareCommonValue("subscriptionId", subscriptionIdValue, false, true)
|
|
465
|
-
);
|
|
404
|
+
if (dpgContext.arm && getSubscriptionId(dpgContext) && !isSubscriptionIdAdded) {
|
|
405
|
+
result.push(prepareCommonValue("subscriptionId", subscriptionIdValue, false, true));
|
|
466
406
|
}
|
|
467
407
|
|
|
468
408
|
// Handle body parameters
|
|
@@ -484,22 +424,13 @@ export function prepareCommonParameters(
|
|
|
484
424
|
if (isReadOnly(prop as SdkModelPropertyType)) {
|
|
485
425
|
continue;
|
|
486
426
|
}
|
|
487
|
-
result.push(
|
|
488
|
-
prepareCommonValue(
|
|
489
|
-
prop.name,
|
|
490
|
-
propExample,
|
|
491
|
-
prop.optional,
|
|
492
|
-
prop.onClient
|
|
493
|
-
)
|
|
494
|
-
);
|
|
427
|
+
result.push(prepareCommonValue(prop.name, propExample, prop.optional, prop.onClient));
|
|
495
428
|
}
|
|
496
429
|
} else {
|
|
497
430
|
// Check if the body parameter is nested inside a wrapper (e.g., @bodyRoot)
|
|
498
431
|
const segments = bodyParam.methodParameterSegments;
|
|
499
432
|
const isNestedBody =
|
|
500
|
-
segments.length === 1 &&
|
|
501
|
-
segments[0] !== undefined &&
|
|
502
|
-
segments[0].length > 1;
|
|
433
|
+
segments.length === 1 && segments[0] !== undefined && segments[0].length > 1;
|
|
503
434
|
if (isNestedBody) {
|
|
504
435
|
const path = segments[0]!;
|
|
505
436
|
// The first segment is the method-level wrapper param (e.g., "body")
|
|
@@ -516,8 +447,8 @@ export function prepareCommonParameters(
|
|
|
516
447
|
methodParamName,
|
|
517
448
|
wrappedValue,
|
|
518
449
|
methodParamOptional,
|
|
519
|
-
bodyParam.onClient
|
|
520
|
-
)
|
|
450
|
+
bodyParam.onClient,
|
|
451
|
+
),
|
|
521
452
|
);
|
|
522
453
|
} else {
|
|
523
454
|
result.push(
|
|
@@ -525,8 +456,8 @@ export function prepareCommonParameters(
|
|
|
525
456
|
bodyParam.name,
|
|
526
457
|
bodyExample.value,
|
|
527
458
|
bodyParam.optional,
|
|
528
|
-
bodyParam.onClient
|
|
529
|
-
)
|
|
459
|
+
bodyParam.onClient,
|
|
460
|
+
),
|
|
530
461
|
);
|
|
531
462
|
}
|
|
532
463
|
}
|
|
@@ -536,21 +467,12 @@ export function prepareCommonParameters(
|
|
|
536
467
|
method.operation.parameters
|
|
537
468
|
.filter(
|
|
538
469
|
(param) =>
|
|
539
|
-
param.optional === true &&
|
|
540
|
-
parameterMap[param.serializedName] &&
|
|
541
|
-
!param.clientDefaultValue
|
|
470
|
+
param.optional === true && parameterMap[param.serializedName] && !param.clientDefaultValue,
|
|
542
471
|
)
|
|
543
472
|
.forEach((param) => {
|
|
544
473
|
const exampleValue = parameterMap[param.serializedName];
|
|
545
474
|
if (exampleValue && exampleValue.value) {
|
|
546
|
-
result.push(
|
|
547
|
-
prepareCommonValue(
|
|
548
|
-
param.name,
|
|
549
|
-
exampleValue.value,
|
|
550
|
-
true,
|
|
551
|
-
param.onClient
|
|
552
|
-
)
|
|
553
|
-
);
|
|
475
|
+
result.push(prepareCommonValue(param.name, exampleValue.value, true, param.onClient));
|
|
554
476
|
}
|
|
555
477
|
});
|
|
556
478
|
|
|
@@ -565,8 +487,8 @@ export function iterateClientsAndMethods(
|
|
|
565
487
|
callback: (
|
|
566
488
|
dpgContext: SdkContext,
|
|
567
489
|
method: ServiceOperation,
|
|
568
|
-
options: ClientEmitOptions
|
|
569
|
-
) => SourceFile | undefined
|
|
490
|
+
options: ClientEmitOptions,
|
|
491
|
+
) => SourceFile | undefined,
|
|
570
492
|
): SourceFile[] {
|
|
571
493
|
const generatedFiles: SourceFile[] = [];
|
|
572
494
|
const clients = dpgContext.sdkPackage.clients;
|
|
@@ -589,7 +511,7 @@ export function iterateClientsAndMethods(
|
|
|
589
511
|
clients.length > 1
|
|
590
512
|
? normalizeName(getClassicalClientName(client), NameType.File)
|
|
591
513
|
: undefined,
|
|
592
|
-
hierarchies: hierarchies
|
|
514
|
+
hierarchies: hierarchies,
|
|
593
515
|
});
|
|
594
516
|
}
|
|
595
517
|
}
|
|
@@ -604,7 +526,7 @@ export function generateMethodCall(
|
|
|
604
526
|
method: ServiceOperation,
|
|
605
527
|
parameters: CommonValue[],
|
|
606
528
|
options: ClientEmitOptions,
|
|
607
|
-
dpgContext?: SdkContext
|
|
529
|
+
dpgContext?: SdkContext,
|
|
608
530
|
): { methodCall: string; clientParams: string[]; clientParamDefs: string[] } {
|
|
609
531
|
// Prepare client-level parameters
|
|
610
532
|
const clientParamValues = parameters.filter((p) => p.onClient);
|
|
@@ -626,17 +548,13 @@ export function generateMethodCall(
|
|
|
626
548
|
const operationFunction = getOperationFunction(
|
|
627
549
|
dpgContext,
|
|
628
550
|
[options.hierarchies ?? [], method],
|
|
629
|
-
"Client"
|
|
551
|
+
"Client",
|
|
630
552
|
);
|
|
631
553
|
|
|
632
554
|
// Extract parameter names from the function signature (excluding context and options)
|
|
633
555
|
const signatureParamNames =
|
|
634
556
|
operationFunction.parameters
|
|
635
|
-
?.filter(
|
|
636
|
-
(p) =>
|
|
637
|
-
p.name !== "context" &&
|
|
638
|
-
!p.type?.toString().includes("OptionalParams")
|
|
639
|
-
)
|
|
557
|
+
?.filter((p) => p.name !== "context" && !p.type?.toString().includes("OptionalParams"))
|
|
640
558
|
.map((p) => p.name) ?? [];
|
|
641
559
|
|
|
642
560
|
// Create a map for quick lookup of parameter values by name
|
|
@@ -650,9 +568,7 @@ export function generateMethodCall(
|
|
|
650
568
|
methodParams = orderedRequiredParams.map((p) => `${p.value}`);
|
|
651
569
|
} else {
|
|
652
570
|
// Original logic when dpgContext is not provided
|
|
653
|
-
methodParams = methodParamValues
|
|
654
|
-
.filter((p) => !p.isOptional)
|
|
655
|
-
.map((p) => `${p.value}`);
|
|
571
|
+
methodParams = methodParamValues.filter((p) => !p.isOptional).map((p) => `${p.value}`);
|
|
656
572
|
}
|
|
657
573
|
|
|
658
574
|
const optionalParams = methodParamValues
|
|
@@ -662,9 +578,7 @@ export function generateMethodCall(
|
|
|
662
578
|
methodParams.push(`{${optionalParams.join(", ")}}`);
|
|
663
579
|
}
|
|
664
580
|
|
|
665
|
-
const prefix = options.classicalMethodPrefix
|
|
666
|
-
? `${options.classicalMethodPrefix}.`
|
|
667
|
-
: "";
|
|
581
|
+
const prefix = options.classicalMethodPrefix ? `${options.classicalMethodPrefix}.` : "";
|
|
668
582
|
const methodCall = `client.${prefix}${normalizeName(method.oriName ?? method.name, NameType.Property)}(${methodParams.join(", ")})`;
|
|
669
583
|
|
|
670
584
|
return { methodCall, clientParams, clientParamDefs };
|
|
@@ -678,30 +592,22 @@ export function createSourceFile(
|
|
|
678
592
|
method: ServiceOperation,
|
|
679
593
|
options: ClientEmitOptions,
|
|
680
594
|
type: "sample" | "test",
|
|
681
|
-
fileName: string
|
|
595
|
+
fileName: string,
|
|
682
596
|
): SourceFile {
|
|
683
597
|
const project = useContext("outputProject");
|
|
684
|
-
const operationPrefix = `${options.classicalMethodPrefix ?? ""} ${
|
|
685
|
-
|
|
686
|
-
}`;
|
|
687
|
-
const baseFolder =
|
|
688
|
-
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");
|
|
689
600
|
const folder = join(
|
|
690
601
|
dpgContext.generationPathDetail?.rootDir ?? "",
|
|
691
602
|
baseFolder,
|
|
692
|
-
options.subFolder ?? ""
|
|
603
|
+
options.subFolder ?? "",
|
|
693
604
|
);
|
|
694
605
|
const fileExtension = type === "sample" ? ".ts" : ".spec.ts";
|
|
695
|
-
const normalizedFileName = normalizeName(
|
|
696
|
-
fileName || `${operationPrefix} ${type}`,
|
|
697
|
-
NameType.File
|
|
698
|
-
);
|
|
606
|
+
const normalizedFileName = normalizeName(fileName || `${operationPrefix} ${type}`, NameType.File);
|
|
699
607
|
|
|
700
|
-
return project.createSourceFile(
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
{ overwrite: true }
|
|
704
|
-
);
|
|
608
|
+
return project.createSourceFile(join(folder, `${normalizedFileName}${fileExtension}`), "", {
|
|
609
|
+
overwrite: true,
|
|
610
|
+
});
|
|
705
611
|
}
|
|
706
612
|
|
|
707
613
|
/**
|
|
@@ -711,7 +617,7 @@ export function generateAssertionsForValue(
|
|
|
711
617
|
value: SdkExampleValue,
|
|
712
618
|
path: string,
|
|
713
619
|
maxDepth: number = 3,
|
|
714
|
-
currentDepth: number = 0
|
|
620
|
+
currentDepth: number = 0,
|
|
715
621
|
): string[] {
|
|
716
622
|
const assertions: string[] = [];
|
|
717
623
|
|
|
@@ -725,13 +631,13 @@ export function generateAssertionsForValue(
|
|
|
725
631
|
switch (value.type.kind) {
|
|
726
632
|
case "utcDateTime":
|
|
727
633
|
assertions.push(
|
|
728
|
-
`assert.strictEqual(${path}.getTime(), new Date("${value.value}").getTime())
|
|
634
|
+
`assert.strictEqual(${path}.getTime(), new Date("${value.value}").getTime());`,
|
|
729
635
|
);
|
|
730
636
|
break;
|
|
731
637
|
case "bytes": {
|
|
732
638
|
const encode = value.type.encode ?? "base64";
|
|
733
639
|
assertions.push(
|
|
734
|
-
`assert.deepEqual(${path}, Buffer.from("${value.value}", "${encode}"))
|
|
640
|
+
`assert.deepEqual(${path}, Buffer.from("${value.value}", "${encode}"));`,
|
|
735
641
|
);
|
|
736
642
|
break;
|
|
737
643
|
}
|
|
@@ -743,9 +649,7 @@ export function generateAssertionsForValue(
|
|
|
743
649
|
.replace(/\n/g, "\\n")
|
|
744
650
|
.replace(/\r/g, "\\r")
|
|
745
651
|
.replace(/\t/g, "\\t")
|
|
746
|
-
.replace(/\f/g, "\\f")
|
|
747
|
-
.replace(/>/g, ">")
|
|
748
|
-
.replace(/</g, "<")}"`;
|
|
652
|
+
.replace(/\f/g, "\\f")}"`;
|
|
749
653
|
assertions.push(`assert.strictEqual(${path}, ${retValue});`);
|
|
750
654
|
break;
|
|
751
655
|
}
|
|
@@ -754,9 +658,7 @@ export function generateAssertionsForValue(
|
|
|
754
658
|
}
|
|
755
659
|
case "boolean":
|
|
756
660
|
case "number":
|
|
757
|
-
assertions.push(
|
|
758
|
-
`assert.strictEqual(${path}, ${JSON.stringify(value.value)});`
|
|
759
|
-
);
|
|
661
|
+
assertions.push(`assert.strictEqual(${path}, ${JSON.stringify(value.value)});`);
|
|
760
662
|
break;
|
|
761
663
|
case "unknown":
|
|
762
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.
|
|
@@ -765,9 +667,7 @@ export function generateAssertionsForValue(
|
|
|
765
667
|
case "array":
|
|
766
668
|
if (value.value && value.value.length > 0) {
|
|
767
669
|
assertions.push(`assert.ok(Array.isArray(${path}));`);
|
|
768
|
-
assertions.push(
|
|
769
|
-
`assert.strictEqual(${path}.length, ${value.value.length});`
|
|
770
|
-
);
|
|
670
|
+
assertions.push(`assert.strictEqual(${path}.length, ${value.value.length});`);
|
|
771
671
|
|
|
772
672
|
// Assert on first few items to avoid overly verbose tests
|
|
773
673
|
const itemsToCheck = Math.min(value.value.length, 2);
|
|
@@ -778,7 +678,7 @@ export function generateAssertionsForValue(
|
|
|
778
678
|
item,
|
|
779
679
|
`${path}[${i}]`,
|
|
780
680
|
maxDepth,
|
|
781
|
-
currentDepth + 1
|
|
681
|
+
currentDepth + 1,
|
|
782
682
|
);
|
|
783
683
|
assertions.push(...itemAssertions);
|
|
784
684
|
}
|
|
@@ -796,21 +696,16 @@ export function generateAssertionsForValue(
|
|
|
796
696
|
// Check if this property is flattened in the model type
|
|
797
697
|
let property;
|
|
798
698
|
if (value.kind === "model" && value.type.kind === "model") {
|
|
799
|
-
property = value.type.properties.find(
|
|
800
|
-
(p) => p.kind === "property" && p.name === key
|
|
801
|
-
);
|
|
699
|
+
property = value.type.properties.find((p) => p.kind === "property" && p.name === key);
|
|
802
700
|
}
|
|
803
|
-
if (
|
|
804
|
-
property?.flatten &&
|
|
805
|
-
(val as SdkExampleValue).kind === "model"
|
|
806
|
-
) {
|
|
701
|
+
if (property?.flatten && (val as SdkExampleValue).kind === "model") {
|
|
807
702
|
// For flattened properties, recurse using the parent path so
|
|
808
703
|
// assertions reference result.xxx instead of result.properties.xxx
|
|
809
704
|
const innerAssertions = generateAssertionsForValue(
|
|
810
705
|
val as SdkExampleValue,
|
|
811
706
|
path,
|
|
812
707
|
maxDepth,
|
|
813
|
-
currentDepth + 1
|
|
708
|
+
currentDepth + 1,
|
|
814
709
|
);
|
|
815
710
|
assertions.push(...innerAssertions);
|
|
816
711
|
} else {
|
|
@@ -819,14 +714,12 @@ export function generateAssertionsForValue(
|
|
|
819
714
|
// For nested model/dict values, append "?" to the path so child
|
|
820
715
|
// property accesses use optional chaining (e.g. result.systemData?.createdBy)
|
|
821
716
|
const recursePath =
|
|
822
|
-
nestedVal.kind === "model" || nestedVal.kind === "dict"
|
|
823
|
-
? `${propPath}?`
|
|
824
|
-
: propPath;
|
|
717
|
+
nestedVal.kind === "model" || nestedVal.kind === "dict" ? `${propPath}?` : propPath;
|
|
825
718
|
const propAssertions = generateAssertionsForValue(
|
|
826
719
|
nestedVal,
|
|
827
720
|
recursePath,
|
|
828
721
|
maxDepth,
|
|
829
|
-
currentDepth + 1
|
|
722
|
+
currentDepth + 1,
|
|
830
723
|
);
|
|
831
724
|
assertions.push(...propAssertions);
|
|
832
725
|
}
|
|
@@ -846,7 +739,7 @@ export function generateAssertionsForValue(
|
|
|
846
739
|
value.value as SdkExampleValue,
|
|
847
740
|
path,
|
|
848
741
|
maxDepth,
|
|
849
|
-
currentDepth
|
|
742
|
+
currentDepth,
|
|
850
743
|
);
|
|
851
744
|
assertions.push(...unionAssertions);
|
|
852
745
|
}
|
|
@@ -862,7 +755,7 @@ export function generateAssertionsForValue(
|
|
|
862
755
|
export function generateResponseAssertions(
|
|
863
756
|
example: SdkHttpOperationExample,
|
|
864
757
|
resultVariableName: string,
|
|
865
|
-
isPaging: boolean = false
|
|
758
|
+
isPaging: boolean = false,
|
|
866
759
|
): string[] {
|
|
867
760
|
const assertions: string[] = [];
|
|
868
761
|
|
|
@@ -893,16 +786,13 @@ export function generateResponseAssertions(
|
|
|
893
786
|
if (isPaging) {
|
|
894
787
|
// For paging operations, the response body should have a 'value' array
|
|
895
788
|
if (responseBody.kind === "model" || responseBody.kind === "dict") {
|
|
896
|
-
const responseValue = responseBody.value as Record<
|
|
897
|
-
string,
|
|
898
|
-
SdkExampleValue
|
|
899
|
-
>;
|
|
789
|
+
const responseValue = responseBody.value as Record<string, SdkExampleValue>;
|
|
900
790
|
const valueArray = responseValue?.["value"];
|
|
901
791
|
|
|
902
792
|
if (valueArray && valueArray.kind === "array" && valueArray.value) {
|
|
903
793
|
// Assert on the length of the collected results
|
|
904
794
|
assertions.push(
|
|
905
|
-
`assert.strictEqual(${resultVariableName}.length, ${valueArray.value.length})
|
|
795
|
+
`assert.strictEqual(${resultVariableName}.length, ${valueArray.value.length});`,
|
|
906
796
|
);
|
|
907
797
|
|
|
908
798
|
// Assert on the first item if available
|
|
@@ -913,7 +803,7 @@ export function generateResponseAssertions(
|
|
|
913
803
|
firstItem,
|
|
914
804
|
`${resultVariableName}[0]`,
|
|
915
805
|
2, // Limit depth for paging items
|
|
916
|
-
0
|
|
806
|
+
0,
|
|
917
807
|
);
|
|
918
808
|
assertions.push(...itemAssertions);
|
|
919
809
|
}
|
|
@@ -922,10 +812,7 @@ export function generateResponseAssertions(
|
|
|
922
812
|
}
|
|
923
813
|
} else {
|
|
924
814
|
// Generate assertions based on response body structure
|
|
925
|
-
const responseAssertions = generateAssertionsForValue(
|
|
926
|
-
responseBody,
|
|
927
|
-
resultVariableName
|
|
928
|
-
);
|
|
815
|
+
const responseAssertions = generateAssertionsForValue(responseBody, resultVariableName);
|
|
929
816
|
assertions.push(...responseAssertions);
|
|
930
817
|
}
|
|
931
818
|
|
|
@@ -939,10 +826,7 @@ export function generateResponseAssertions(
|
|
|
939
826
|
* @param clientName - Optional client name to use as prefix
|
|
940
827
|
* @returns The environment variable expression string
|
|
941
828
|
*/
|
|
942
|
-
function getEnvironmentVariableName(
|
|
943
|
-
paramName: string,
|
|
944
|
-
clientName?: string
|
|
945
|
-
): string {
|
|
829
|
+
function getEnvironmentVariableName(paramName: string, clientName?: string): string {
|
|
946
830
|
// Remove "Param" suffix if present
|
|
947
831
|
const cleanName = paramName.replace(/Param$/, "");
|
|
948
832
|
|