@azure-tools/typespec-ts 0.54.0 → 0.54.1
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/CHANGELOG.md +25 -10
- 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 +36 -43
- 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,39 +1,30 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import { FunctionDeclarationStructure, StructureKind } from "ts-morph";
|
|
5
4
|
import {
|
|
5
|
+
isReadOnly,
|
|
6
6
|
SdkModelPropertyType,
|
|
7
7
|
SdkModelType,
|
|
8
8
|
SdkPackage,
|
|
9
9
|
SdkType,
|
|
10
|
-
UsageFlags
|
|
10
|
+
UsageFlags,
|
|
11
11
|
} from "@azure-tools/typespec-client-generator-core";
|
|
12
|
-
import { SdkContext } from "../../utils/interfaces.js";
|
|
13
|
-
import {
|
|
14
|
-
getAllAncestors,
|
|
15
|
-
getAllProperties
|
|
16
|
-
} from "../helpers/operationHelpers.js";
|
|
17
|
-
import {
|
|
18
|
-
normalizeModelName,
|
|
19
|
-
getAdditionalPropertiesName
|
|
20
|
-
} from "../emitModels.js";
|
|
21
|
-
import { NameType } from "../../rlc-common/index.js";
|
|
22
|
-
import { isAzureCoreErrorType } from "../../utils/modelUtils.js";
|
|
23
|
-
import {
|
|
24
|
-
isSupportedSerializeType,
|
|
25
|
-
ModelSerializeOptions
|
|
26
|
-
} from "./serializeUtils.js";
|
|
27
|
-
import { XmlHelpers } from "../static-helpers-metadata.js";
|
|
28
|
-
import { resolveReference } from "../../framework/reference.js";
|
|
29
|
-
import { refkey } from "../../framework/refkey.js";
|
|
30
|
-
import { reportDiagnostic } from "../../lib.js";
|
|
31
12
|
import { NoTarget } from "@typespec/compiler";
|
|
32
13
|
import { isMetadata } from "@typespec/http";
|
|
33
|
-
import {
|
|
34
|
-
import { isReadOnly } from "@azure-tools/typespec-client-generator-core";
|
|
14
|
+
import { FunctionDeclarationStructure, StructureKind } from "ts-morph";
|
|
35
15
|
import { useDependencies } from "../../framework/hooks/useDependencies.js";
|
|
16
|
+
import { resolveReference } from "../../framework/reference.js";
|
|
17
|
+
import { refkey } from "../../framework/refkey.js";
|
|
18
|
+
import { reportDiagnostic } from "../../lib.js";
|
|
19
|
+
import { NameType } from "../../rlc-common/index.js";
|
|
20
|
+
import { SdkContext } from "../../utils/interfaces.js";
|
|
21
|
+
import { isAzureCoreErrorType } from "../../utils/modelUtils.js";
|
|
22
|
+
import { getAdditionalPropertiesName, normalizeModelName } from "../emitModels.js";
|
|
23
|
+
import { getAllAncestors, getAllProperties } from "../helpers/operationHelpers.js";
|
|
36
24
|
import { getAdditionalPropertiesType } from "../helpers/typeHelpers.js";
|
|
25
|
+
import { XmlHelpers } from "../static-helpers-metadata.js";
|
|
26
|
+
import { normalizeModelPropertyName } from "../type-expressions/get-type-expression.js";
|
|
27
|
+
import { isSupportedSerializeType, ModelSerializeOptions } from "./serializeUtils.js";
|
|
37
28
|
|
|
38
29
|
/**
|
|
39
30
|
* Checks if a model type has XML serialization options defined
|
|
@@ -53,9 +44,7 @@ export function hasXmlSerialization(type: SdkType): boolean {
|
|
|
53
44
|
/**
|
|
54
45
|
* Checks if any model in the SDK package uses XML serialization
|
|
55
46
|
*/
|
|
56
|
-
export function packageUsesXmlSerialization(
|
|
57
|
-
sdkPackage: SdkPackage<any>
|
|
58
|
-
): boolean {
|
|
47
|
+
export function packageUsesXmlSerialization(sdkPackage: SdkPackage<any>): boolean {
|
|
59
48
|
for (const model of sdkPackage.models) {
|
|
60
49
|
if (hasXmlSerialization(model)) {
|
|
61
50
|
return true;
|
|
@@ -75,7 +64,7 @@ export function getXmlRootName(type: SdkModelType): string {
|
|
|
75
64
|
* Gets the XML namespace for a model type
|
|
76
65
|
*/
|
|
77
66
|
export function getXmlRootNs(
|
|
78
|
-
type: SdkModelType
|
|
67
|
+
type: SdkModelType,
|
|
79
68
|
): { namespace: string; prefix: string } | undefined {
|
|
80
69
|
return type.serializationOptions?.xml?.ns;
|
|
81
70
|
}
|
|
@@ -88,8 +77,8 @@ export function buildXmlModelSerializer(
|
|
|
88
77
|
type: SdkModelType,
|
|
89
78
|
options: ModelSerializeOptions = {
|
|
90
79
|
nameOnly: false,
|
|
91
|
-
skipDiscriminatedUnionSuffix: false
|
|
92
|
-
}
|
|
80
|
+
skipDiscriminatedUnionSuffix: false,
|
|
81
|
+
},
|
|
93
82
|
): FunctionDeclarationStructure | string | undefined {
|
|
94
83
|
if (!isSupportedSerializeType(type)) {
|
|
95
84
|
return undefined;
|
|
@@ -98,15 +87,14 @@ export function buildXmlModelSerializer(
|
|
|
98
87
|
if (!type.name) {
|
|
99
88
|
reportDiagnostic(context.program, {
|
|
100
89
|
code: "anonymous-type-serialization",
|
|
101
|
-
target: type.__raw || NoTarget
|
|
90
|
+
target: type.__raw || NoTarget,
|
|
102
91
|
});
|
|
103
92
|
return undefined;
|
|
104
93
|
}
|
|
105
94
|
|
|
106
95
|
if (
|
|
107
96
|
!type.usage ||
|
|
108
|
-
(type.usage !== undefined &&
|
|
109
|
-
(type.usage & UsageFlags.Input) !== UsageFlags.Input)
|
|
97
|
+
(type.usage !== undefined && (type.usage & UsageFlags.Input) !== UsageFlags.Input)
|
|
110
98
|
) {
|
|
111
99
|
return undefined;
|
|
112
100
|
}
|
|
@@ -121,7 +109,7 @@ export function buildXmlModelSerializer(
|
|
|
121
109
|
context,
|
|
122
110
|
type,
|
|
123
111
|
NameType.Operation,
|
|
124
|
-
options.skipDiscriminatedUnionSuffix
|
|
112
|
+
options.skipDiscriminatedUnionSuffix,
|
|
125
113
|
)}XmlSerializer`;
|
|
126
114
|
|
|
127
115
|
if (options.nameOnly) {
|
|
@@ -129,9 +117,7 @@ export function buildXmlModelSerializer(
|
|
|
129
117
|
}
|
|
130
118
|
|
|
131
119
|
const serializeToXmlRef = resolveReference(XmlHelpers.serializeToXml);
|
|
132
|
-
const xmlPropertyMetadataRef = resolveReference(
|
|
133
|
-
XmlHelpers.XmlPropertyMetadata
|
|
134
|
-
);
|
|
120
|
+
const xmlPropertyMetadataRef = resolveReference(XmlHelpers.XmlPropertyMetadata);
|
|
135
121
|
|
|
136
122
|
const properties = getAllProperties(context, type, getAllAncestors(type));
|
|
137
123
|
const xmlRootName = getXmlRootName(type);
|
|
@@ -143,37 +129,29 @@ export function buildXmlModelSerializer(
|
|
|
143
129
|
const statements: string[] = [];
|
|
144
130
|
|
|
145
131
|
// Generate the properties metadata constant
|
|
146
|
-
statements.push(
|
|
147
|
-
`const properties: ${xmlPropertyMetadataRef}[] = [${propertyMetadata}];`
|
|
148
|
-
);
|
|
132
|
+
statements.push(`const properties: ${xmlPropertyMetadataRef}[] = [${propertyMetadata}];`);
|
|
149
133
|
|
|
150
134
|
// Generate additionalProperties config if applicable
|
|
151
|
-
const additionalPropsConfigExpr = buildAdditionalPropertiesConfigExpr(
|
|
152
|
-
context,
|
|
153
|
-
type,
|
|
154
|
-
properties
|
|
155
|
-
);
|
|
135
|
+
const additionalPropsConfigExpr = buildAdditionalPropertiesConfigExpr(context, type, properties);
|
|
156
136
|
|
|
157
137
|
// Generate the serialization call
|
|
158
138
|
if (xmlRootNs) {
|
|
159
139
|
if (additionalPropsConfigExpr) {
|
|
160
140
|
statements.push(
|
|
161
|
-
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" }, undefined, ${additionalPropsConfigExpr})
|
|
141
|
+
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" }, undefined, ${additionalPropsConfigExpr});`,
|
|
162
142
|
);
|
|
163
143
|
} else {
|
|
164
144
|
statements.push(
|
|
165
|
-
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" })
|
|
145
|
+
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" });`,
|
|
166
146
|
);
|
|
167
147
|
}
|
|
168
148
|
} else {
|
|
169
149
|
if (additionalPropsConfigExpr) {
|
|
170
150
|
statements.push(
|
|
171
|
-
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}", undefined, undefined, ${additionalPropsConfigExpr})
|
|
151
|
+
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}", undefined, undefined, ${additionalPropsConfigExpr});`,
|
|
172
152
|
);
|
|
173
153
|
} else {
|
|
174
|
-
statements.push(
|
|
175
|
-
`return ${serializeToXmlRef}(item, properties, "${xmlRootName}");`
|
|
176
|
-
);
|
|
154
|
+
statements.push(`return ${serializeToXmlRef}(item, properties, "${xmlRootName}");`);
|
|
177
155
|
}
|
|
178
156
|
}
|
|
179
157
|
|
|
@@ -184,11 +162,11 @@ export function buildXmlModelSerializer(
|
|
|
184
162
|
parameters: [
|
|
185
163
|
{
|
|
186
164
|
name: "item",
|
|
187
|
-
type: resolveReference(refkey(type))
|
|
188
|
-
}
|
|
165
|
+
type: resolveReference(refkey(type)),
|
|
166
|
+
},
|
|
189
167
|
],
|
|
190
168
|
returnType: "string",
|
|
191
|
-
statements
|
|
169
|
+
statements,
|
|
192
170
|
};
|
|
193
171
|
|
|
194
172
|
return serializerFunction;
|
|
@@ -204,8 +182,8 @@ export function buildXmlObjectModelSerializer(
|
|
|
204
182
|
type: SdkModelType,
|
|
205
183
|
options: ModelSerializeOptions = {
|
|
206
184
|
nameOnly: false,
|
|
207
|
-
skipDiscriminatedUnionSuffix: false
|
|
208
|
-
}
|
|
185
|
+
skipDiscriminatedUnionSuffix: false,
|
|
186
|
+
},
|
|
209
187
|
): FunctionDeclarationStructure | string | undefined {
|
|
210
188
|
if (!isSupportedSerializeType(type)) {
|
|
211
189
|
return undefined;
|
|
@@ -214,15 +192,14 @@ export function buildXmlObjectModelSerializer(
|
|
|
214
192
|
if (!type.name) {
|
|
215
193
|
reportDiagnostic(context.program, {
|
|
216
194
|
code: "anonymous-type-serialization",
|
|
217
|
-
target: type.__raw || NoTarget
|
|
195
|
+
target: type.__raw || NoTarget,
|
|
218
196
|
});
|
|
219
197
|
return undefined;
|
|
220
198
|
}
|
|
221
199
|
|
|
222
200
|
if (
|
|
223
201
|
!type.usage ||
|
|
224
|
-
(type.usage !== undefined &&
|
|
225
|
-
(type.usage & UsageFlags.Input) !== UsageFlags.Input)
|
|
202
|
+
(type.usage !== undefined && (type.usage & UsageFlags.Input) !== UsageFlags.Input)
|
|
226
203
|
) {
|
|
227
204
|
return undefined;
|
|
228
205
|
}
|
|
@@ -237,7 +214,7 @@ export function buildXmlObjectModelSerializer(
|
|
|
237
214
|
context,
|
|
238
215
|
type,
|
|
239
216
|
NameType.Operation,
|
|
240
|
-
options.skipDiscriminatedUnionSuffix
|
|
217
|
+
options.skipDiscriminatedUnionSuffix,
|
|
241
218
|
)}XmlObjectSerializer`;
|
|
242
219
|
|
|
243
220
|
if (options.nameOnly) {
|
|
@@ -247,10 +224,7 @@ export function buildXmlObjectModelSerializer(
|
|
|
247
224
|
const properties = getAllProperties(context, type, getAllAncestors(type));
|
|
248
225
|
|
|
249
226
|
// Build the object literal with XML property names
|
|
250
|
-
const propertyAssignments = buildXmlObjectPropertyAssignments(
|
|
251
|
-
context,
|
|
252
|
-
properties
|
|
253
|
-
);
|
|
227
|
+
const propertyAssignments = buildXmlObjectPropertyAssignments(context, properties);
|
|
254
228
|
|
|
255
229
|
const statements: string[] = [];
|
|
256
230
|
|
|
@@ -262,7 +236,7 @@ export function buildXmlObjectModelSerializer(
|
|
|
262
236
|
if (propertyAssignments.length === 0) {
|
|
263
237
|
// Pure dictionary type - spread additionalProperties entries as XML elements
|
|
264
238
|
statements.push(
|
|
265
|
-
`return { ...item["${apName}"] } as ${resolveReference(XmlHelpers.XmlSerializedObject)}
|
|
239
|
+
`return { ...item["${apName}"] } as ${resolveReference(XmlHelpers.XmlSerializedObject)};`,
|
|
266
240
|
);
|
|
267
241
|
} else {
|
|
268
242
|
// Model with both defined properties and additional properties
|
|
@@ -272,15 +246,10 @@ export function buildXmlObjectModelSerializer(
|
|
|
272
246
|
statements.push(`return {${propertyAssignments}};`);
|
|
273
247
|
}
|
|
274
248
|
|
|
275
|
-
const xmlSerializedObjectRef = resolveReference(
|
|
276
|
-
XmlHelpers.XmlSerializedObject
|
|
277
|
-
);
|
|
249
|
+
const xmlSerializedObjectRef = resolveReference(XmlHelpers.XmlSerializedObject);
|
|
278
250
|
|
|
279
251
|
// Use _item when there are no properties and not a dict type to avoid unused parameter lint error
|
|
280
|
-
const paramName =
|
|
281
|
-
propertyAssignments.length === 0 && !additionalPropertyType
|
|
282
|
-
? "_item"
|
|
283
|
-
: "item";
|
|
252
|
+
const paramName = propertyAssignments.length === 0 && !additionalPropertyType ? "_item" : "item";
|
|
284
253
|
|
|
285
254
|
const serializerFunction: FunctionDeclarationStructure = {
|
|
286
255
|
kind: StructureKind.Function,
|
|
@@ -289,11 +258,11 @@ export function buildXmlObjectModelSerializer(
|
|
|
289
258
|
parameters: [
|
|
290
259
|
{
|
|
291
260
|
name: paramName,
|
|
292
|
-
type: resolveReference(refkey(type))
|
|
293
|
-
}
|
|
261
|
+
type: resolveReference(refkey(type)),
|
|
262
|
+
},
|
|
294
263
|
],
|
|
295
264
|
returnType: xmlSerializedObjectRef,
|
|
296
|
-
statements
|
|
265
|
+
statements,
|
|
297
266
|
};
|
|
298
267
|
|
|
299
268
|
return serializerFunction;
|
|
@@ -305,7 +274,7 @@ export function buildXmlObjectModelSerializer(
|
|
|
305
274
|
*/
|
|
306
275
|
function buildXmlObjectPropertyAssignments(
|
|
307
276
|
context: SdkContext,
|
|
308
|
-
properties: SdkModelPropertyType[]
|
|
277
|
+
properties: SdkModelPropertyType[],
|
|
309
278
|
): string {
|
|
310
279
|
const assignments: string[] = [];
|
|
311
280
|
|
|
@@ -357,7 +326,7 @@ function buildXmlObjectPropertyAssignments(
|
|
|
357
326
|
const primitiveExpr = buildXmlValueSerializationExpr(
|
|
358
327
|
context,
|
|
359
328
|
property.type,
|
|
360
|
-
`item["${cleanPropertyName}"]
|
|
329
|
+
`item["${cleanPropertyName}"]`,
|
|
361
330
|
);
|
|
362
331
|
if (xmlOptions?.unwrapped) {
|
|
363
332
|
const itemKey = xmlOptions?.itemsName ?? xmlName;
|
|
@@ -373,7 +342,7 @@ function buildXmlObjectPropertyAssignments(
|
|
|
373
342
|
valueExpr = buildXmlValueSerializationExpr(
|
|
374
343
|
context,
|
|
375
344
|
property.type,
|
|
376
|
-
`item["${cleanPropertyName}"]
|
|
345
|
+
`item["${cleanPropertyName}"]`,
|
|
377
346
|
);
|
|
378
347
|
}
|
|
379
348
|
|
|
@@ -390,11 +359,9 @@ function buildXmlObjectPropertyAssignments(
|
|
|
390
359
|
function buildXmlValueSerializationExpr(
|
|
391
360
|
context: SdkContext,
|
|
392
361
|
type: SdkType,
|
|
393
|
-
valueExpr: string
|
|
362
|
+
valueExpr: string,
|
|
394
363
|
): string {
|
|
395
|
-
const uint8ArrayToStringRef = resolveReference(
|
|
396
|
-
useDependencies().uint8ArrayToString
|
|
397
|
-
);
|
|
364
|
+
const uint8ArrayToStringRef = resolveReference(useDependencies().uint8ArrayToString);
|
|
398
365
|
|
|
399
366
|
switch (type.kind) {
|
|
400
367
|
case "bytes":
|
|
@@ -415,11 +382,7 @@ function buildXmlValueSerializationExpr(
|
|
|
415
382
|
|
|
416
383
|
case "array": {
|
|
417
384
|
// Handle arrays - need to serialize each element
|
|
418
|
-
const itemExpr = buildXmlValueSerializationExpr(
|
|
419
|
-
context,
|
|
420
|
-
type.valueType,
|
|
421
|
-
"i"
|
|
422
|
-
);
|
|
385
|
+
const itemExpr = buildXmlValueSerializationExpr(context, type.valueType, "i");
|
|
423
386
|
if (itemExpr !== "i") {
|
|
424
387
|
// If items need transformation, map them
|
|
425
388
|
return `${valueExpr}?.map((i: any) => ${itemExpr})`;
|
|
@@ -439,7 +402,7 @@ function buildXmlValueSerializationExpr(
|
|
|
439
402
|
*/
|
|
440
403
|
function buildPropertyMetadataArray(
|
|
441
404
|
context: SdkContext,
|
|
442
|
-
properties: SdkModelPropertyType[]
|
|
405
|
+
properties: SdkModelPropertyType[],
|
|
443
406
|
): string {
|
|
444
407
|
const metadataEntries: string[] = [];
|
|
445
408
|
|
|
@@ -460,12 +423,11 @@ function buildPropertyMetadataArray(
|
|
|
460
423
|
const cleanPropertyName = propertyName.replace(/^"|"$/g, "");
|
|
461
424
|
|
|
462
425
|
// Use XML name if available, fall back to JSON name, then property name
|
|
463
|
-
const serializedName =
|
|
464
|
-
xmlOptions?.name ?? jsonOptions?.name ?? property.name;
|
|
426
|
+
const serializedName = xmlOptions?.name ?? jsonOptions?.name ?? property.name;
|
|
465
427
|
|
|
466
428
|
const metadataObj: string[] = [
|
|
467
429
|
`propertyName: "${cleanPropertyName}"`,
|
|
468
|
-
`xmlOptions: { name: "${serializedName}"${buildXmlOptionsString(xmlOptions)} }
|
|
430
|
+
`xmlOptions: { name: "${serializedName}"${buildXmlOptionsString(xmlOptions)} }`,
|
|
469
431
|
];
|
|
470
432
|
|
|
471
433
|
// Add type information for special handling
|
|
@@ -517,7 +479,7 @@ function buildXmlOptionsString(xmlOptions?: {
|
|
|
517
479
|
}
|
|
518
480
|
if (xmlOptions.ns) {
|
|
519
481
|
parts.push(
|
|
520
|
-
`ns: { namespace: "${xmlOptions.ns.namespace}", prefix: "${xmlOptions.ns.prefix}" }
|
|
482
|
+
`ns: { namespace: "${xmlOptions.ns.namespace}", prefix: "${xmlOptions.ns.prefix}" }`,
|
|
521
483
|
);
|
|
522
484
|
}
|
|
523
485
|
if (xmlOptions.unwrapped) {
|
|
@@ -528,7 +490,7 @@ function buildXmlOptionsString(xmlOptions?: {
|
|
|
528
490
|
}
|
|
529
491
|
if (xmlOptions.itemsNs) {
|
|
530
492
|
parts.push(
|
|
531
|
-
`itemsNs: { namespace: "${xmlOptions.itemsNs.namespace}", prefix: "${xmlOptions.itemsNs.prefix}" }
|
|
493
|
+
`itemsNs: { namespace: "${xmlOptions.itemsNs.namespace}", prefix: "${xmlOptions.itemsNs.prefix}" }`,
|
|
532
494
|
);
|
|
533
495
|
}
|
|
534
496
|
|
|
@@ -551,11 +513,7 @@ function getPropertyTypeInfo(type: SdkType): {
|
|
|
551
513
|
const itemInfo = getPropertyTypeInfo(type.valueType);
|
|
552
514
|
const result: ReturnType<typeof getPropertyTypeInfo> = { type: "array" };
|
|
553
515
|
// Only include item type info for types that need special serialization
|
|
554
|
-
if (
|
|
555
|
-
itemInfo.type === "bytes" ||
|
|
556
|
-
itemInfo.type === "date" ||
|
|
557
|
-
itemInfo.type === "primitive"
|
|
558
|
-
) {
|
|
516
|
+
if (itemInfo.type === "bytes" || itemInfo.type === "date" || itemInfo.type === "primitive") {
|
|
559
517
|
result.itemType = itemInfo.type as "primitive" | "date" | "bytes";
|
|
560
518
|
}
|
|
561
519
|
if (itemInfo.dateEncoding) {
|
|
@@ -576,14 +534,12 @@ function getPropertyTypeInfo(type: SdkType): {
|
|
|
576
534
|
case "utcDateTime":
|
|
577
535
|
return {
|
|
578
536
|
type: "date",
|
|
579
|
-
dateEncoding:
|
|
580
|
-
(type.encode as "rfc3339" | "rfc7231" | "unixTimestamp") ?? "rfc3339"
|
|
537
|
+
dateEncoding: (type.encode as "rfc3339" | "rfc7231" | "unixTimestamp") ?? "rfc3339",
|
|
581
538
|
};
|
|
582
539
|
case "bytes": {
|
|
583
540
|
const encode = (type as any).encode as string | undefined;
|
|
584
541
|
// Default to base64 if no encoding specified
|
|
585
|
-
const bytesEncoding =
|
|
586
|
-
encode === "base64url" ? "base64url" : ("base64" as const);
|
|
542
|
+
const bytesEncoding = encode === "base64url" ? "base64url" : ("base64" as const);
|
|
587
543
|
return { type: "bytes", bytesEncoding };
|
|
588
544
|
}
|
|
589
545
|
case "boolean":
|
|
@@ -602,8 +558,7 @@ function getPropertyTypeInfo(type: SdkType): {
|
|
|
602
558
|
if (type.variantTypes.length > 0) {
|
|
603
559
|
const first = getPropertyTypeInfo(type.variantTypes[0]!);
|
|
604
560
|
const allSame = type.variantTypes.every(
|
|
605
|
-
(v) =>
|
|
606
|
-
getPropertyTypeInfo(v).primitiveSubtype === first.primitiveSubtype
|
|
561
|
+
(v) => getPropertyTypeInfo(v).primitiveSubtype === first.primitiveSubtype,
|
|
607
562
|
);
|
|
608
563
|
if (allSame) {
|
|
609
564
|
return first;
|
|
@@ -625,16 +580,13 @@ function getPropertyTypeInfo(type: SdkType): {
|
|
|
625
580
|
* Gets the nested XML serializer function reference for complex types.
|
|
626
581
|
* Uses the XML object serializer to properly handle XML property names.
|
|
627
582
|
*/
|
|
628
|
-
function getNestedXmlSerializer(
|
|
629
|
-
context: SdkContext,
|
|
630
|
-
type: SdkType
|
|
631
|
-
): string | undefined {
|
|
583
|
+
function getNestedXmlSerializer(context: SdkContext, type: SdkType): string | undefined {
|
|
632
584
|
if (type.kind === "model") {
|
|
633
585
|
// For nested objects, use the XML object serializer which returns objects
|
|
634
586
|
// with XML property names for proper serialization
|
|
635
587
|
const serializerName = buildXmlObjectModelSerializer(context, type, {
|
|
636
588
|
nameOnly: true,
|
|
637
|
-
skipDiscriminatedUnionSuffix: false
|
|
589
|
+
skipDiscriminatedUnionSuffix: false,
|
|
638
590
|
});
|
|
639
591
|
if (typeof serializerName === "string") {
|
|
640
592
|
return serializerName;
|
|
@@ -643,14 +595,10 @@ function getNestedXmlSerializer(
|
|
|
643
595
|
if (type.kind === "array" && type.valueType.kind === "model") {
|
|
644
596
|
// For arrays, use the XML object serializer for items
|
|
645
597
|
// The XML helper calls this for each item and handles the array mapping
|
|
646
|
-
const itemSerializer = buildXmlObjectModelSerializer(
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
nameOnly: true,
|
|
651
|
-
skipDiscriminatedUnionSuffix: false
|
|
652
|
-
}
|
|
653
|
-
);
|
|
598
|
+
const itemSerializer = buildXmlObjectModelSerializer(context, type.valueType, {
|
|
599
|
+
nameOnly: true,
|
|
600
|
+
skipDiscriminatedUnionSuffix: false,
|
|
601
|
+
});
|
|
654
602
|
if (typeof itemSerializer === "string") {
|
|
655
603
|
return itemSerializer;
|
|
656
604
|
}
|
|
@@ -666,8 +614,8 @@ export function buildXmlModelDeserializer(
|
|
|
666
614
|
type: SdkModelType,
|
|
667
615
|
options: ModelSerializeOptions = {
|
|
668
616
|
nameOnly: false,
|
|
669
|
-
skipDiscriminatedUnionSuffix: false
|
|
670
|
-
}
|
|
617
|
+
skipDiscriminatedUnionSuffix: false,
|
|
618
|
+
},
|
|
671
619
|
): FunctionDeclarationStructure | string | undefined {
|
|
672
620
|
if (!isSupportedSerializeType(type)) {
|
|
673
621
|
return undefined;
|
|
@@ -676,7 +624,7 @@ export function buildXmlModelDeserializer(
|
|
|
676
624
|
if (!type.name) {
|
|
677
625
|
reportDiagnostic(context.program, {
|
|
678
626
|
code: "anonymous-type-deserialization",
|
|
679
|
-
target: type.__raw || NoTarget
|
|
627
|
+
target: type.__raw || NoTarget,
|
|
680
628
|
});
|
|
681
629
|
return undefined;
|
|
682
630
|
}
|
|
@@ -700,7 +648,7 @@ export function buildXmlModelDeserializer(
|
|
|
700
648
|
context,
|
|
701
649
|
type,
|
|
702
650
|
NameType.Operation,
|
|
703
|
-
options.skipDiscriminatedUnionSuffix
|
|
651
|
+
options.skipDiscriminatedUnionSuffix,
|
|
704
652
|
)}XmlDeserializer`;
|
|
705
653
|
|
|
706
654
|
if (options.nameOnly) {
|
|
@@ -709,7 +657,7 @@ export function buildXmlModelDeserializer(
|
|
|
709
657
|
|
|
710
658
|
const deserializeFromXmlRef = resolveReference(XmlHelpers.deserializeFromXml);
|
|
711
659
|
const xmlPropertyDeserializeMetadataRef = resolveReference(
|
|
712
|
-
XmlHelpers.XmlPropertyDeserializeMetadata
|
|
660
|
+
XmlHelpers.XmlPropertyDeserializeMetadata,
|
|
713
661
|
);
|
|
714
662
|
|
|
715
663
|
const properties = getAllProperties(context, type, getAllAncestors(type));
|
|
@@ -717,45 +665,38 @@ export function buildXmlModelDeserializer(
|
|
|
717
665
|
const xmlRootNs = getXmlRootNs(type);
|
|
718
666
|
|
|
719
667
|
// Build property metadata array for deserialization
|
|
720
|
-
const propertyMetadata = buildDeserializePropertyMetadataArray(
|
|
721
|
-
context,
|
|
722
|
-
properties
|
|
723
|
-
);
|
|
668
|
+
const propertyMetadata = buildDeserializePropertyMetadataArray(context, properties);
|
|
724
669
|
|
|
725
670
|
const statements: string[] = [];
|
|
726
671
|
|
|
727
672
|
// Generate the properties metadata constant
|
|
728
673
|
statements.push(
|
|
729
|
-
`const properties: ${xmlPropertyDeserializeMetadataRef}[] = [${propertyMetadata}]
|
|
674
|
+
`const properties: ${xmlPropertyDeserializeMetadataRef}[] = [${propertyMetadata}];`,
|
|
730
675
|
);
|
|
731
676
|
|
|
732
677
|
// Generate additionalProperties config if applicable
|
|
733
|
-
const additionalPropsConfigExpr = buildAdditionalPropertiesConfigExpr(
|
|
734
|
-
context,
|
|
735
|
-
type,
|
|
736
|
-
properties
|
|
737
|
-
);
|
|
678
|
+
const additionalPropsConfigExpr = buildAdditionalPropertiesConfigExpr(context, type, properties);
|
|
738
679
|
|
|
739
680
|
// Generate the deserialization call
|
|
740
681
|
const typeRef = resolveReference(refkey(type));
|
|
741
682
|
if (xmlRootNs) {
|
|
742
683
|
if (additionalPropsConfigExpr) {
|
|
743
684
|
statements.push(
|
|
744
|
-
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" }, undefined, ${additionalPropsConfigExpr})
|
|
685
|
+
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" }, undefined, ${additionalPropsConfigExpr});`,
|
|
745
686
|
);
|
|
746
687
|
} else {
|
|
747
688
|
statements.push(
|
|
748
|
-
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" })
|
|
689
|
+
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}", { namespace: "${xmlRootNs.namespace}", prefix: "${xmlRootNs.prefix}" });`,
|
|
749
690
|
);
|
|
750
691
|
}
|
|
751
692
|
} else {
|
|
752
693
|
if (additionalPropsConfigExpr) {
|
|
753
694
|
statements.push(
|
|
754
|
-
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}", undefined, undefined, ${additionalPropsConfigExpr})
|
|
695
|
+
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}", undefined, undefined, ${additionalPropsConfigExpr});`,
|
|
755
696
|
);
|
|
756
697
|
} else {
|
|
757
698
|
statements.push(
|
|
758
|
-
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}")
|
|
699
|
+
`return ${deserializeFromXmlRef}<${typeRef}>(xmlString, properties, "${xmlRootName}");`,
|
|
759
700
|
);
|
|
760
701
|
}
|
|
761
702
|
}
|
|
@@ -767,11 +708,11 @@ export function buildXmlModelDeserializer(
|
|
|
767
708
|
parameters: [
|
|
768
709
|
{
|
|
769
710
|
name: "xmlString",
|
|
770
|
-
type: "string"
|
|
771
|
-
}
|
|
711
|
+
type: "string",
|
|
712
|
+
},
|
|
772
713
|
],
|
|
773
714
|
returnType: resolveReference(refkey(type)),
|
|
774
|
-
statements
|
|
715
|
+
statements,
|
|
775
716
|
};
|
|
776
717
|
|
|
777
718
|
return deserializerFunction;
|
|
@@ -782,7 +723,7 @@ export function buildXmlModelDeserializer(
|
|
|
782
723
|
*/
|
|
783
724
|
function buildDeserializePropertyMetadataArray(
|
|
784
725
|
context: SdkContext,
|
|
785
|
-
properties: SdkModelPropertyType[]
|
|
726
|
+
properties: SdkModelPropertyType[],
|
|
786
727
|
): string {
|
|
787
728
|
const metadataEntries: string[] = [];
|
|
788
729
|
|
|
@@ -800,12 +741,11 @@ function buildDeserializePropertyMetadataArray(
|
|
|
800
741
|
const cleanPropertyName = propertyName.replace(/^"|"$/g, "");
|
|
801
742
|
|
|
802
743
|
// Use XML name if available, fall back to JSON name, then property name
|
|
803
|
-
const serializedName =
|
|
804
|
-
xmlOptions?.name ?? jsonOptions?.name ?? property.name;
|
|
744
|
+
const serializedName = xmlOptions?.name ?? jsonOptions?.name ?? property.name;
|
|
805
745
|
|
|
806
746
|
const metadataObj: string[] = [
|
|
807
747
|
`propertyName: "${cleanPropertyName}"`,
|
|
808
|
-
`xmlOptions: { name: "${serializedName}"${buildXmlOptionsString(xmlOptions)} }
|
|
748
|
+
`xmlOptions: { name: "${serializedName}"${buildXmlOptionsString(xmlOptions)} }`,
|
|
809
749
|
];
|
|
810
750
|
|
|
811
751
|
// Add type information for special handling
|
|
@@ -842,16 +782,13 @@ function buildDeserializePropertyMetadataArray(
|
|
|
842
782
|
* Gets the nested XML deserializer function reference for complex types.
|
|
843
783
|
* Uses the XML object deserializer to properly handle XML property names.
|
|
844
784
|
*/
|
|
845
|
-
function getNestedXmlDeserializer(
|
|
846
|
-
context: SdkContext,
|
|
847
|
-
type: SdkType
|
|
848
|
-
): string | undefined {
|
|
785
|
+
function getNestedXmlDeserializer(context: SdkContext, type: SdkType): string | undefined {
|
|
849
786
|
if (type.kind === "model") {
|
|
850
787
|
// For nested objects, use the XML object deserializer which takes parsed XML objects
|
|
851
788
|
// and uses XML property names for mapping
|
|
852
789
|
const deserializerName = buildXmlObjectModelDeserializer(context, type, {
|
|
853
790
|
nameOnly: true,
|
|
854
|
-
skipDiscriminatedUnionSuffix: false
|
|
791
|
+
skipDiscriminatedUnionSuffix: false,
|
|
855
792
|
});
|
|
856
793
|
if (typeof deserializerName === "string") {
|
|
857
794
|
return deserializerName;
|
|
@@ -860,14 +797,10 @@ function getNestedXmlDeserializer(
|
|
|
860
797
|
if (type.kind === "array" && type.valueType.kind === "model") {
|
|
861
798
|
// For arrays, use the XML object deserializer for items
|
|
862
799
|
// The XML helper calls this for each item and handles the array mapping
|
|
863
|
-
const itemDeserializer = buildXmlObjectModelDeserializer(
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
nameOnly: true,
|
|
868
|
-
skipDiscriminatedUnionSuffix: false
|
|
869
|
-
}
|
|
870
|
-
);
|
|
800
|
+
const itemDeserializer = buildXmlObjectModelDeserializer(context, type.valueType, {
|
|
801
|
+
nameOnly: true,
|
|
802
|
+
skipDiscriminatedUnionSuffix: false,
|
|
803
|
+
});
|
|
871
804
|
if (typeof itemDeserializer === "string") {
|
|
872
805
|
return itemDeserializer;
|
|
873
806
|
}
|
|
@@ -885,8 +818,8 @@ export function buildXmlObjectModelDeserializer(
|
|
|
885
818
|
type: SdkModelType,
|
|
886
819
|
options: ModelSerializeOptions = {
|
|
887
820
|
nameOnly: false,
|
|
888
|
-
skipDiscriminatedUnionSuffix: false
|
|
889
|
-
}
|
|
821
|
+
skipDiscriminatedUnionSuffix: false,
|
|
822
|
+
},
|
|
890
823
|
): FunctionDeclarationStructure | string | undefined {
|
|
891
824
|
if (!isSupportedSerializeType(type)) {
|
|
892
825
|
return undefined;
|
|
@@ -895,7 +828,7 @@ export function buildXmlObjectModelDeserializer(
|
|
|
895
828
|
if (!type.name) {
|
|
896
829
|
reportDiagnostic(context.program, {
|
|
897
830
|
code: "anonymous-type-deserialization",
|
|
898
|
-
target: type.__raw || NoTarget
|
|
831
|
+
target: type.__raw || NoTarget,
|
|
899
832
|
});
|
|
900
833
|
return undefined;
|
|
901
834
|
}
|
|
@@ -919,52 +852,41 @@ export function buildXmlObjectModelDeserializer(
|
|
|
919
852
|
context,
|
|
920
853
|
type,
|
|
921
854
|
NameType.Operation,
|
|
922
|
-
options.skipDiscriminatedUnionSuffix
|
|
855
|
+
options.skipDiscriminatedUnionSuffix,
|
|
923
856
|
)}XmlObjectDeserializer`;
|
|
924
857
|
|
|
925
858
|
if (options.nameOnly) {
|
|
926
859
|
return resolveReference(refkey(type, "xmlObjectDeserializer"));
|
|
927
860
|
}
|
|
928
861
|
|
|
929
|
-
const deserializeXmlObjectRef = resolveReference(
|
|
930
|
-
XmlHelpers.deserializeXmlObject
|
|
931
|
-
);
|
|
862
|
+
const deserializeXmlObjectRef = resolveReference(XmlHelpers.deserializeXmlObject);
|
|
932
863
|
const xmlPropertyDeserializeMetadataRef = resolveReference(
|
|
933
|
-
XmlHelpers.XmlPropertyDeserializeMetadata
|
|
864
|
+
XmlHelpers.XmlPropertyDeserializeMetadata,
|
|
934
865
|
);
|
|
935
866
|
|
|
936
867
|
const properties = getAllProperties(context, type, getAllAncestors(type));
|
|
937
868
|
|
|
938
869
|
// Build property metadata array for deserialization
|
|
939
|
-
const propertyMetadata = buildDeserializePropertyMetadataArray(
|
|
940
|
-
context,
|
|
941
|
-
properties
|
|
942
|
-
);
|
|
870
|
+
const propertyMetadata = buildDeserializePropertyMetadataArray(context, properties);
|
|
943
871
|
|
|
944
872
|
const statements: string[] = [];
|
|
945
873
|
|
|
946
874
|
// Generate the properties metadata constant
|
|
947
875
|
statements.push(
|
|
948
|
-
`const properties: ${xmlPropertyDeserializeMetadataRef}[] = [${propertyMetadata}]
|
|
876
|
+
`const properties: ${xmlPropertyDeserializeMetadataRef}[] = [${propertyMetadata}];`,
|
|
949
877
|
);
|
|
950
878
|
|
|
951
879
|
// Generate additionalProperties config if applicable
|
|
952
|
-
const additionalPropsConfigExpr = buildAdditionalPropertiesConfigExpr(
|
|
953
|
-
context,
|
|
954
|
-
type,
|
|
955
|
-
properties
|
|
956
|
-
);
|
|
880
|
+
const additionalPropsConfigExpr = buildAdditionalPropertiesConfigExpr(context, type, properties);
|
|
957
881
|
|
|
958
882
|
// Generate the deserialization call - no rootName needed for object deserializer
|
|
959
883
|
const typeRef = resolveReference(refkey(type));
|
|
960
884
|
if (additionalPropsConfigExpr) {
|
|
961
885
|
statements.push(
|
|
962
|
-
`return ${deserializeXmlObjectRef}<${typeRef}>(xmlObject, properties, ${additionalPropsConfigExpr})
|
|
886
|
+
`return ${deserializeXmlObjectRef}<${typeRef}>(xmlObject, properties, ${additionalPropsConfigExpr});`,
|
|
963
887
|
);
|
|
964
888
|
} else {
|
|
965
|
-
statements.push(
|
|
966
|
-
`return ${deserializeXmlObjectRef}<${typeRef}>(xmlObject, properties);`
|
|
967
|
-
);
|
|
889
|
+
statements.push(`return ${deserializeXmlObjectRef}<${typeRef}>(xmlObject, properties);`);
|
|
968
890
|
}
|
|
969
891
|
|
|
970
892
|
const deserializerFunction: FunctionDeclarationStructure = {
|
|
@@ -974,11 +896,11 @@ export function buildXmlObjectModelDeserializer(
|
|
|
974
896
|
parameters: [
|
|
975
897
|
{
|
|
976
898
|
name: "xmlObject",
|
|
977
|
-
type: "Record<string, unknown>"
|
|
978
|
-
}
|
|
899
|
+
type: "Record<string, unknown>",
|
|
900
|
+
},
|
|
979
901
|
],
|
|
980
902
|
returnType: resolveReference(refkey(type)),
|
|
981
|
-
statements
|
|
903
|
+
statements,
|
|
982
904
|
};
|
|
983
905
|
|
|
984
906
|
return deserializerFunction;
|
|
@@ -993,12 +915,11 @@ export function buildXmlObjectModelDeserializer(
|
|
|
993
915
|
function buildAdditionalPropertiesConfigExpr(
|
|
994
916
|
context: SdkContext,
|
|
995
917
|
type: SdkModelType,
|
|
996
|
-
properties: SdkModelPropertyType[]
|
|
918
|
+
properties: SdkModelPropertyType[],
|
|
997
919
|
): string | undefined {
|
|
998
920
|
const additionalPropertyType = getAdditionalPropertiesType(type);
|
|
999
921
|
const isErrorModel =
|
|
1000
|
-
type.usage !== undefined &&
|
|
1001
|
-
(type.usage & UsageFlags.Exception) === UsageFlags.Exception;
|
|
922
|
+
type.usage !== undefined && (type.usage & UsageFlags.Exception) === UsageFlags.Exception;
|
|
1002
923
|
|
|
1003
924
|
if (!additionalPropertyType && !isErrorModel) {
|
|
1004
925
|
return undefined;
|