@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,20 +1,20 @@
|
|
|
1
|
-
import { generateParameterTypeValue } from "./helpers/valueGenerationUtil.js";
|
|
2
1
|
import { getClientName } from "./helpers/nameConstructors.js";
|
|
3
|
-
import {
|
|
2
|
+
import { NameType, camelCase, normalizeName } from "./helpers/nameUtils.js";
|
|
3
|
+
import { isAzurePackage } from "./helpers/packageUtil.js";
|
|
4
4
|
import { buildSchemaObjectMap } from "./helpers/schemaHelpers.js";
|
|
5
|
+
import { generateParameterTypeValue } from "./helpers/valueGenerationUtil.js";
|
|
5
6
|
import {
|
|
6
|
-
RLCModel,
|
|
7
|
-
RLCSampleGroup,
|
|
8
|
-
Paths,
|
|
9
7
|
OperationMethod,
|
|
8
|
+
OperationParameter,
|
|
9
|
+
PathMetadata,
|
|
10
|
+
Paths,
|
|
11
|
+
RLCModel,
|
|
10
12
|
RLCSampleDetail,
|
|
11
|
-
|
|
13
|
+
RLCSampleGroup,
|
|
12
14
|
SampleParameter,
|
|
15
|
+
SampleParameters,
|
|
13
16
|
Schema,
|
|
14
|
-
PathMetadata,
|
|
15
|
-
OperationParameter
|
|
16
17
|
} from "./interfaces.js";
|
|
17
|
-
import { isAzurePackage } from "./helpers/packageUtil.js";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Transform the sample data based RLC detail e.g path, operations & schemas
|
|
@@ -28,10 +28,7 @@ export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
|
28
28
|
// Not support to generate if modular libraries
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
32
|
-
(model.sampleGroups && model.sampleGroups.length > 0) ||
|
|
33
|
-
!allowMockValue
|
|
34
|
-
) {
|
|
31
|
+
if ((model.sampleGroups && model.sampleGroups.length > 0) || !allowMockValue) {
|
|
35
32
|
// Skip to transform if already has sample data
|
|
36
33
|
// Skip to transform if not allow to mock value
|
|
37
34
|
return;
|
|
@@ -45,7 +42,7 @@ export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
|
45
42
|
: `${clientName}Client`;
|
|
46
43
|
const defaultFactoryName = normalizeName(
|
|
47
44
|
camelCase(`create ${clientInterfaceName}`),
|
|
48
|
-
NameType.Method
|
|
45
|
+
NameType.Method,
|
|
49
46
|
);
|
|
50
47
|
const packageName = model.options?.packageDetails?.name ?? "";
|
|
51
48
|
const methodParameterMap = buildMethodParamMap(model);
|
|
@@ -69,17 +66,17 @@ export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
|
69
66
|
const operatonConcante = getOperationConcate(
|
|
70
67
|
detail.operationName,
|
|
71
68
|
pathDetails.operationGroupName,
|
|
72
|
-
model.options?.sourceFrom
|
|
69
|
+
model.options?.sourceFrom,
|
|
73
70
|
);
|
|
74
71
|
const operationPrefix = normalizeName(
|
|
75
72
|
camelCase(transformSpecialLetterToSpace(operatonConcante)),
|
|
76
|
-
NameType.Operation
|
|
73
|
+
NameType.Operation,
|
|
77
74
|
);
|
|
78
75
|
const sampleGroup: RLCSampleGroup = {
|
|
79
76
|
filename: `${operationPrefix}Sample`,
|
|
80
77
|
defaultFactoryName,
|
|
81
78
|
clientPackageName: packageName,
|
|
82
|
-
samples: []
|
|
79
|
+
samples: [],
|
|
83
80
|
};
|
|
84
81
|
|
|
85
82
|
// initialize the sample
|
|
@@ -97,21 +94,17 @@ export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
|
97
94
|
method,
|
|
98
95
|
isLRO: detail.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
99
96
|
isPaging: detail.operationHelperDetail?.isPaging ?? false,
|
|
100
|
-
useLegacyLro: false
|
|
97
|
+
useLegacyLro: false,
|
|
101
98
|
};
|
|
102
99
|
// client-level, path-level and method-level parameter preparation
|
|
103
100
|
const parameters: SampleParameters = {
|
|
104
|
-
client: convertClientLevelParameters(
|
|
105
|
-
model,
|
|
106
|
-
importedDict,
|
|
107
|
-
schemaObjectMap
|
|
108
|
-
),
|
|
101
|
+
client: convertClientLevelParameters(model, importedDict, schemaObjectMap),
|
|
109
102
|
path: convertPathLevelParameters(pathDetails, path, schemaObjectMap),
|
|
110
103
|
method: convertMethodLevelParameters(
|
|
111
104
|
methodArray,
|
|
112
105
|
schemaObjectMap,
|
|
113
|
-
methodParameterMap.get(operatonConcante)
|
|
114
|
-
)
|
|
106
|
+
methodParameterMap.get(operatonConcante),
|
|
107
|
+
),
|
|
115
108
|
};
|
|
116
109
|
// enrich parameter details
|
|
117
110
|
enrichParameterInSample(sample, parameters);
|
|
@@ -119,12 +112,7 @@ export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
|
119
112
|
enrichLROAndPagingInSample(detail, importedDict, packageName);
|
|
120
113
|
sampleGroup.samples.push(sample);
|
|
121
114
|
rlcSampleGroups.push(sampleGroup);
|
|
122
|
-
enrichImportedString(
|
|
123
|
-
sampleGroup,
|
|
124
|
-
importedDict,
|
|
125
|
-
defaultFactoryName,
|
|
126
|
-
packageName
|
|
127
|
-
);
|
|
115
|
+
enrichImportedString(sampleGroup, importedDict, defaultFactoryName, packageName);
|
|
128
116
|
}
|
|
129
117
|
}
|
|
130
118
|
return rlcSampleGroups;
|
|
@@ -133,10 +121,9 @@ export function transformSampleGroups(model: RLCModel, allowMockValue = true) {
|
|
|
133
121
|
function enrichLROAndPagingInSample(
|
|
134
122
|
operation: OperationMethod,
|
|
135
123
|
importedDict: Record<string, Set<string>>,
|
|
136
|
-
packageName: string
|
|
124
|
+
packageName: string,
|
|
137
125
|
) {
|
|
138
|
-
const isLRO =
|
|
139
|
-
operation.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
126
|
+
const isLRO = operation.operationHelperDetail?.lroDetails?.isLongRunning ?? false,
|
|
140
127
|
isPaging = operation.operationHelperDetail?.isPaging ?? false;
|
|
141
128
|
if (isPaging) {
|
|
142
129
|
if (isLRO) {
|
|
@@ -163,7 +150,7 @@ function enrichImportedString(
|
|
|
163
150
|
sampleGroup: RLCSampleGroup,
|
|
164
151
|
importedDict: Record<string, Set<string>>,
|
|
165
152
|
defaultFactoryName: string,
|
|
166
|
-
packageName: string
|
|
153
|
+
packageName: string,
|
|
167
154
|
) {
|
|
168
155
|
const importedTypes: string[] = [];
|
|
169
156
|
if (!importedDict[packageName] || importedDict[packageName].size === 0) {
|
|
@@ -175,26 +162,19 @@ function enrichImportedString(
|
|
|
175
162
|
continue;
|
|
176
163
|
}
|
|
177
164
|
const values = Array.from(importedSet).join(", ");
|
|
178
|
-
const hasDefaultFactory =
|
|
179
|
-
|
|
180
|
-
importedTypes.push(
|
|
181
|
-
`import ${hasDefaultFactory} { ${values} } from "${key}";`
|
|
182
|
-
);
|
|
165
|
+
const hasDefaultFactory = key === packageName ? `${defaultFactoryName},` : "";
|
|
166
|
+
importedTypes.push(`import ${hasDefaultFactory} { ${values} } from "${key}";`);
|
|
183
167
|
}
|
|
184
168
|
sampleGroup.importedTypes = importedTypes;
|
|
185
169
|
}
|
|
186
170
|
|
|
187
|
-
function enrichParameterInSample(
|
|
188
|
-
sample: RLCSampleDetail,
|
|
189
|
-
parameters: SampleParameters
|
|
190
|
-
) {
|
|
171
|
+
function enrichParameterInSample(sample: RLCSampleDetail, parameters: SampleParameters) {
|
|
191
172
|
sample.clientParamAssignments = getAssignmentStrArray(parameters.client);
|
|
192
173
|
sample.clientParamNames = getContactParameterNames(parameters.client);
|
|
193
174
|
sample.pathParamAssignments = getAssignmentStrArray(parameters.path);
|
|
194
175
|
sample.pathParamNames = getContactParameterNames(parameters.path);
|
|
195
176
|
// Directly apply the inline option value as method parameter
|
|
196
|
-
sample.methodParamNames =
|
|
197
|
-
parameters.method.length > 0 ? (parameters.method[0]?.value ?? "") : "";
|
|
177
|
+
sample.methodParamNames = parameters.method.length > 0 ? (parameters.method[0]?.value ?? "") : "";
|
|
198
178
|
}
|
|
199
179
|
|
|
200
180
|
function getAssignmentStrArray(parameters: SampleParameter[]) {
|
|
@@ -211,7 +191,7 @@ function getContactParameterNames(parameters: SampleParameter[]) {
|
|
|
211
191
|
function convertClientLevelParameters(
|
|
212
192
|
model: RLCModel,
|
|
213
193
|
importedDict: Record<string, Set<string>>,
|
|
214
|
-
schemaMap: Map<string, Schema
|
|
194
|
+
schemaMap: Map<string, Schema>,
|
|
215
195
|
): SampleParameter[] {
|
|
216
196
|
if (!model.options) {
|
|
217
197
|
return [];
|
|
@@ -219,35 +199,27 @@ function convertClientLevelParameters(
|
|
|
219
199
|
const clientParams: SampleParameter[] = [];
|
|
220
200
|
const urlParameters = model?.urlInfo?.urlParameters?.filter(
|
|
221
201
|
// Do not include parameters with constant values in the signature, these should go in the options bag
|
|
222
|
-
(p) => p.value === undefined
|
|
202
|
+
(p) => p.value === undefined,
|
|
223
203
|
);
|
|
224
204
|
const {
|
|
225
205
|
addCredentials,
|
|
226
206
|
credentialScopes,
|
|
227
207
|
credentialKeyHeaderName,
|
|
228
208
|
customHttpAuthHeaderName,
|
|
229
|
-
flavor
|
|
209
|
+
flavor,
|
|
230
210
|
} = model.options;
|
|
231
211
|
const hasUrlParameter = !!urlParameters,
|
|
232
212
|
hasCredentials =
|
|
233
|
-
addCredentials &&
|
|
234
|
-
(credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName);
|
|
213
|
+
addCredentials && (credentialScopes || credentialKeyHeaderName || customHttpAuthHeaderName);
|
|
235
214
|
|
|
236
215
|
if (hasUrlParameter) {
|
|
237
216
|
// convert the host parameters in url
|
|
238
217
|
const clientParamAssignments = urlParameters.map((urlParameter) => {
|
|
239
|
-
const urlValue = generateParameterTypeValue(
|
|
240
|
-
|
|
241
|
-
urlParameter.name,
|
|
242
|
-
schemaMap
|
|
243
|
-
);
|
|
244
|
-
const normalizedName = normalizeName(
|
|
245
|
-
urlParameter.name,
|
|
246
|
-
NameType.Parameter
|
|
247
|
-
);
|
|
218
|
+
const urlValue = generateParameterTypeValue(urlParameter.type, urlParameter.name, schemaMap);
|
|
219
|
+
const normalizedName = normalizeName(urlParameter.name, NameType.Parameter);
|
|
248
220
|
return {
|
|
249
221
|
name: normalizedName,
|
|
250
|
-
assignment: `const ${normalizedName} = ` + urlValue +
|
|
222
|
+
assignment: `const ${normalizedName} = ` + urlValue + `;`,
|
|
251
223
|
};
|
|
252
224
|
});
|
|
253
225
|
|
|
@@ -264,35 +236,24 @@ function convertClientLevelParameters(
|
|
|
264
236
|
if (credentialKeyHeaderName && isAzurePackage(model)) {
|
|
265
237
|
clientParams.push({
|
|
266
238
|
name: "credential",
|
|
267
|
-
assignment: `const credential = new AzureKeyCredential("{Your API key}")
|
|
239
|
+
assignment: `const credential = new AzureKeyCredential("{Your API key}");`,
|
|
268
240
|
});
|
|
269
|
-
addValueInImportedDict(
|
|
270
|
-
|
|
271
|
-
"AzureKeyCredential",
|
|
272
|
-
importedDict
|
|
273
|
-
);
|
|
274
|
-
} else if (
|
|
275
|
-
(credentialKeyHeaderName && flavor !== "azure") ||
|
|
276
|
-
customHttpAuthHeaderName
|
|
277
|
-
) {
|
|
241
|
+
addValueInImportedDict(apiKeyCredentialPackage, "AzureKeyCredential", importedDict);
|
|
242
|
+
} else if ((credentialKeyHeaderName && flavor !== "azure") || customHttpAuthHeaderName) {
|
|
278
243
|
clientParams.push({
|
|
279
244
|
name: "credential",
|
|
280
|
-
assignment: `const credential = { key: "{Your API key}"}
|
|
245
|
+
assignment: `const credential = { key: "{Your API key}"};`,
|
|
281
246
|
});
|
|
282
247
|
} else if (isAzurePackage(model)) {
|
|
283
248
|
clientParams.push({
|
|
284
249
|
name: "credential",
|
|
285
|
-
assignment: "const credential = new DefaultAzureCredential();"
|
|
250
|
+
assignment: "const credential = new DefaultAzureCredential();",
|
|
286
251
|
});
|
|
287
|
-
addValueInImportedDict(
|
|
288
|
-
tokenCredentialPackage,
|
|
289
|
-
"DefaultAzureCredential",
|
|
290
|
-
importedDict
|
|
291
|
-
);
|
|
252
|
+
addValueInImportedDict(tokenCredentialPackage, "DefaultAzureCredential", importedDict);
|
|
292
253
|
} else {
|
|
293
254
|
clientParams.push({
|
|
294
255
|
name: "credential",
|
|
295
|
-
assignment: `const credential = {getToken: () => Promise.resolve({ token: "{Your token}", expiresOnTimestamp: 0 })}
|
|
256
|
+
assignment: `const credential = {getToken: () => Promise.resolve({ token: "{Your token}", expiresOnTimestamp: 0 })};`,
|
|
296
257
|
});
|
|
297
258
|
}
|
|
298
259
|
}
|
|
@@ -302,14 +263,14 @@ function convertClientLevelParameters(
|
|
|
302
263
|
function convertPathLevelParameters(
|
|
303
264
|
pathDetail: PathMetadata,
|
|
304
265
|
path: string,
|
|
305
|
-
schemaMap: Map<string, Schema
|
|
266
|
+
schemaMap: Map<string, Schema>,
|
|
306
267
|
): SampleParameter[] {
|
|
307
268
|
const pathItself = {
|
|
308
|
-
name: `"${path}"
|
|
269
|
+
name: `"${path}"`,
|
|
309
270
|
};
|
|
310
271
|
const pathParams = (pathDetail || []).pathParameters.map((p) => {
|
|
311
272
|
const pathParam: SampleParameter = {
|
|
312
|
-
name: normalizeName(p.name, NameType.Parameter)
|
|
273
|
+
name: normalizeName(p.name, NameType.Parameter),
|
|
313
274
|
};
|
|
314
275
|
const value = generateParameterTypeValue(p.type, p.name, schemaMap);
|
|
315
276
|
pathParam.assignment = `const ${pathParam.name} =` + value + `;`;
|
|
@@ -321,7 +282,7 @@ function convertPathLevelParameters(
|
|
|
321
282
|
function convertMethodLevelParameters(
|
|
322
283
|
methods: OperationMethod[],
|
|
323
284
|
schemaMap: Map<string, Schema>,
|
|
324
|
-
operationParameter?: OperationParameter
|
|
285
|
+
operationParameter?: OperationParameter,
|
|
325
286
|
): SampleParameter[] {
|
|
326
287
|
if (
|
|
327
288
|
!methods ||
|
|
@@ -359,7 +320,7 @@ function convertMethodLevelParameters(
|
|
|
359
320
|
schemaMap.set(bodyTypeName, body.oriSchema);
|
|
360
321
|
}
|
|
361
322
|
allSideAssignments.push(
|
|
362
|
-
` body: ` + generateParameterTypeValue(bodyTypeName, "body", schemaMap)
|
|
323
|
+
` body: ` + generateParameterTypeValue(bodyTypeName, "body", schemaMap),
|
|
363
324
|
);
|
|
364
325
|
}
|
|
365
326
|
}
|
|
@@ -369,14 +330,12 @@ function convertMethodLevelParameters(
|
|
|
369
330
|
.forEach((p) => {
|
|
370
331
|
const name = `${p.name}`;
|
|
371
332
|
querySideAssignments.push(
|
|
372
|
-
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap)
|
|
333
|
+
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap),
|
|
373
334
|
);
|
|
374
335
|
});
|
|
375
336
|
|
|
376
337
|
if (querySideAssignments.length > 0) {
|
|
377
|
-
allSideAssignments.push(
|
|
378
|
-
` queryParameters: { ` + querySideAssignments.join(", ") + `}`
|
|
379
|
-
);
|
|
338
|
+
allSideAssignments.push(` queryParameters: { ` + querySideAssignments.join(", ") + `}`);
|
|
380
339
|
}
|
|
381
340
|
requestParameter.parameters
|
|
382
341
|
?.filter((p) => p.type === "header")
|
|
@@ -384,13 +343,11 @@ function convertMethodLevelParameters(
|
|
|
384
343
|
.forEach((p) => {
|
|
385
344
|
const name = `${p.name}`;
|
|
386
345
|
headerSideAssignments.push(
|
|
387
|
-
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap)
|
|
346
|
+
`${name}: ` + generateParameterTypeValue(p.param.type, name, schemaMap),
|
|
388
347
|
);
|
|
389
348
|
});
|
|
390
349
|
if (headerSideAssignments.length > 0) {
|
|
391
|
-
allSideAssignments.push(
|
|
392
|
-
` headers: { ` + headerSideAssignments.join(", ") + `}`
|
|
393
|
-
);
|
|
350
|
+
allSideAssignments.push(` headers: { ` + headerSideAssignments.join(", ") + `}`);
|
|
394
351
|
}
|
|
395
352
|
const contentType = requestParameter.parameters
|
|
396
353
|
?.filter((p) => p.type === "header")
|
|
@@ -399,11 +356,7 @@ function convertMethodLevelParameters(
|
|
|
399
356
|
if (firstContentType) {
|
|
400
357
|
allSideAssignments.push(
|
|
401
358
|
` ${firstContentType.name}: ` +
|
|
402
|
-
generateParameterTypeValue(
|
|
403
|
-
firstContentType.param.type,
|
|
404
|
-
firstContentType.name,
|
|
405
|
-
schemaMap
|
|
406
|
-
)
|
|
359
|
+
generateParameterTypeValue(firstContentType.param.type, firstContentType.name, schemaMap),
|
|
407
360
|
);
|
|
408
361
|
}
|
|
409
362
|
let value: string = `{}`;
|
|
@@ -416,7 +369,7 @@ function convertMethodLevelParameters(
|
|
|
416
369
|
const optionParam: SampleParameter = {
|
|
417
370
|
name: "options",
|
|
418
371
|
assignment: `const options =` + value + `;`,
|
|
419
|
-
value
|
|
372
|
+
value,
|
|
420
373
|
};
|
|
421
374
|
return [optionParam];
|
|
422
375
|
}
|
|
@@ -424,7 +377,7 @@ function convertMethodLevelParameters(
|
|
|
424
377
|
function addValueInImportedDict(
|
|
425
378
|
key: string,
|
|
426
379
|
val: string,
|
|
427
|
-
importedDict: Record<string, Set<string
|
|
380
|
+
importedDict: Record<string, Set<string>>,
|
|
428
381
|
) {
|
|
429
382
|
if (!importedDict[key]) {
|
|
430
383
|
importedDict[key] = new Set<string>();
|
|
@@ -438,18 +391,14 @@ function buildMethodParamMap(model: RLCModel): Map<string, OperationParameter> {
|
|
|
438
391
|
const operatonConcante = getOperationConcate(
|
|
439
392
|
p.operationName,
|
|
440
393
|
p.operationGroup,
|
|
441
|
-
model.options?.sourceFrom
|
|
394
|
+
model.options?.sourceFrom,
|
|
442
395
|
);
|
|
443
396
|
map.set(operatonConcante, p);
|
|
444
397
|
});
|
|
445
398
|
return map;
|
|
446
399
|
}
|
|
447
400
|
|
|
448
|
-
function getOperationConcate(
|
|
449
|
-
opName: string,
|
|
450
|
-
opGroup: string,
|
|
451
|
-
sourceFrom?: string
|
|
452
|
-
) {
|
|
401
|
+
function getOperationConcate(opName: string, opGroup: string, sourceFrom?: string) {
|
|
453
402
|
return sourceFrom === "Swagger"
|
|
454
403
|
? opGroup === "" || opGroup === "Client"
|
|
455
404
|
? opName
|
package/src/testing/index.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createTestLibrary,
|
|
3
|
-
findTestPackageRoot
|
|
4
|
-
} from "@typespec/compiler/testing";
|
|
1
|
+
import { createTestLibrary, findTestPackageRoot } from "@typespec/compiler/testing";
|
|
5
2
|
|
|
6
3
|
export const TypespecTsTestLibrary = createTestLibrary({
|
|
7
4
|
name: "@azure-tools/typespec-ts",
|
|
8
5
|
// Set this to the absolute path to the root of the package. (e.g. in this case this file would be compiled to ./dist/src/testing/index.js)
|
|
9
|
-
packageRoot: await findTestPackageRoot(import.meta.url)
|
|
6
|
+
packageRoot: await findTestPackageRoot(import.meta.url),
|
|
10
7
|
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import { SdkClient } from "@azure-tools/typespec-client-generator-core";
|
|
5
|
+
import { getDoc } from "@typespec/compiler";
|
|
6
|
+
import { getServers } from "@typespec/http";
|
|
7
|
+
import * as path from "path";
|
|
4
8
|
import {
|
|
5
9
|
buildRuntimeImports,
|
|
6
10
|
Imports,
|
|
@@ -16,12 +20,8 @@ import {
|
|
|
16
20
|
Schema,
|
|
17
21
|
SchemaContext,
|
|
18
22
|
transformSampleGroups,
|
|
19
|
-
UrlInfo
|
|
23
|
+
UrlInfo,
|
|
20
24
|
} from "../rlc-common/index.js";
|
|
21
|
-
import { SdkClient } from "@azure-tools/typespec-client-generator-core";
|
|
22
|
-
import { getDoc } from "@typespec/compiler";
|
|
23
|
-
import { getServers } from "@typespec/http";
|
|
24
|
-
import * as path from "path";
|
|
25
25
|
import { SdkContext } from "../utils/interfaces.js";
|
|
26
26
|
import {
|
|
27
27
|
getDefaultService,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
getImportedModelName,
|
|
30
30
|
getSchemaForType,
|
|
31
31
|
getTypeName,
|
|
32
|
-
predictDefaultValue
|
|
32
|
+
predictDefaultValue,
|
|
33
33
|
} from "../utils/modelUtils.js";
|
|
34
34
|
import { getClientLroOverload } from "../utils/operationUtil.js";
|
|
35
35
|
import { transformApiVersionInfo } from "./transformApiVersionInfo.js";
|
|
@@ -42,7 +42,7 @@ import { transformTelemetryInfo } from "./transformTelemetryInfo.js";
|
|
|
42
42
|
|
|
43
43
|
export async function transformRLCModel(
|
|
44
44
|
client: SdkClient,
|
|
45
|
-
dpgContext: SdkContext
|
|
45
|
+
dpgContext: SdkContext,
|
|
46
46
|
): Promise<RLCModel> {
|
|
47
47
|
const program = dpgContext.program;
|
|
48
48
|
const options: RLCOptions = dpgContext.rlcOptions!;
|
|
@@ -51,7 +51,7 @@ export async function transformRLCModel(
|
|
|
51
51
|
dpgContext.generationPathDetail?.rlcSourcesDir ?? "",
|
|
52
52
|
options.batch && options.batch.length > 1
|
|
53
53
|
? normalizeName(client.name.replace("Client", ""), NameType.File)
|
|
54
|
-
: ""
|
|
54
|
+
: "",
|
|
55
55
|
);
|
|
56
56
|
const libraryName = normalizeName(
|
|
57
57
|
options.batch && (options.isModularLibrary || options.batch.length > 1)
|
|
@@ -60,28 +60,20 @@ export async function transformRLCModel(
|
|
|
60
60
|
client.name ??
|
|
61
61
|
getDefaultService(program, options.isModularLibrary)?.title ??
|
|
62
62
|
""),
|
|
63
|
-
NameType.Class
|
|
63
|
+
NameType.Class,
|
|
64
64
|
);
|
|
65
65
|
const importSet = initInternalImports();
|
|
66
66
|
const urlInfo = transformUrlInfo(client, dpgContext, importSet);
|
|
67
67
|
const paths: Paths = transformPaths(client, dpgContext, importSet);
|
|
68
68
|
const schemas: Schema[] = transformSchemas(client, dpgContext);
|
|
69
|
-
const responses: OperationResponse[] = transformToResponseTypes(
|
|
70
|
-
client,
|
|
71
|
-
dpgContext,
|
|
72
|
-
importSet
|
|
73
|
-
);
|
|
69
|
+
const responses: OperationResponse[] = transformToResponseTypes(client, dpgContext, importSet);
|
|
74
70
|
const parameters: OperationParameter[] = transformToParameterTypes(
|
|
75
71
|
client,
|
|
76
72
|
dpgContext,
|
|
77
73
|
importSet,
|
|
78
|
-
urlInfo?.apiVersionInfo
|
|
79
|
-
);
|
|
80
|
-
const helperDetails = transformHelperFunctionDetails(
|
|
81
|
-
client,
|
|
82
|
-
dpgContext,
|
|
83
|
-
options.flavor
|
|
74
|
+
urlInfo?.apiVersionInfo,
|
|
84
75
|
);
|
|
76
|
+
const helperDetails = transformHelperFunctionDetails(client, dpgContext, options.flavor);
|
|
85
77
|
// Enrich client-level annotation detail
|
|
86
78
|
helperDetails.clientLroOverload = getClientLroOverload(paths);
|
|
87
79
|
|
|
@@ -100,14 +92,13 @@ export async function transformRLCModel(
|
|
|
100
92
|
telemetryOptions,
|
|
101
93
|
importInfo: {
|
|
102
94
|
internalImports: importSet,
|
|
103
|
-
runtimeImports: buildRuntimeImports(options.flavor)
|
|
95
|
+
runtimeImports: buildRuntimeImports(options.flavor),
|
|
104
96
|
},
|
|
105
|
-
rlcSourceDir
|
|
97
|
+
rlcSourceDir,
|
|
106
98
|
};
|
|
107
99
|
model.sampleGroups = transformSampleGroups(
|
|
108
100
|
model,
|
|
109
|
-
options?.generateSample ===
|
|
110
|
-
true /* Enable mock sample content if generateSample === true */
|
|
101
|
+
options?.generateSample === true /* Enable mock sample content if generateSample === true */,
|
|
111
102
|
);
|
|
112
103
|
options.generateSample =
|
|
113
104
|
(options.generateSample === true || options.generateSample === undefined) &&
|
|
@@ -118,7 +109,7 @@ export async function transformRLCModel(
|
|
|
118
109
|
export function transformUrlInfo(
|
|
119
110
|
client: SdkClient,
|
|
120
111
|
dpgContext: SdkContext,
|
|
121
|
-
importDetails: Imports
|
|
112
|
+
importDetails: Imports,
|
|
122
113
|
): UrlInfo | undefined {
|
|
123
114
|
const importedModels = new Set<string>();
|
|
124
115
|
const usage = [SchemaContext.Exception, SchemaContext.Input];
|
|
@@ -144,12 +135,9 @@ export function transformUrlInfo(
|
|
|
144
135
|
const schema = getSchemaForType(dpgContext, type, {
|
|
145
136
|
usage: usage,
|
|
146
137
|
needRef: false,
|
|
147
|
-
relevantProperty: property
|
|
138
|
+
relevantProperty: property,
|
|
148
139
|
});
|
|
149
|
-
getImportedModelName(schema, usage)?.forEach(
|
|
150
|
-
importedModels.add,
|
|
151
|
-
importedModels
|
|
152
|
-
);
|
|
140
|
+
getImportedModelName(schema, usage)?.forEach(importedModels.add, importedModels);
|
|
153
141
|
const normName = normalizeName(key, NameType.Parameter, true);
|
|
154
142
|
if (normName !== key && endpoint) {
|
|
155
143
|
endpoint = endpoint.replace(`{${key}}`, `{${normName}}`);
|
|
@@ -162,7 +150,7 @@ export function transformUrlInfo(
|
|
|
162
150
|
(getDoc(program, property) &&
|
|
163
151
|
getFormattedPropertyDoc(program, property, schema, " ")) ??
|
|
164
152
|
getFormattedPropertyDoc(program, type, schema, " " /* separator*/),
|
|
165
|
-
value: predictDefaultValue(dpgContext, host?.[0]?.parameters.get(key))
|
|
153
|
+
value: predictDefaultValue(dpgContext, host?.[0]?.parameters.get(key)),
|
|
166
154
|
});
|
|
167
155
|
}
|
|
168
156
|
}
|
|
@@ -186,12 +174,12 @@ export function transformUrlInfo(
|
|
|
186
174
|
endpoint = "{endpointParam}";
|
|
187
175
|
urlParameters.push({
|
|
188
176
|
name: "endpointParam",
|
|
189
|
-
type: "string"
|
|
177
|
+
type: "string",
|
|
190
178
|
});
|
|
191
179
|
}
|
|
192
180
|
const apiVersionInfo = transformApiVersionInfo(client, dpgContext, {
|
|
193
181
|
endpoint,
|
|
194
|
-
urlParameters
|
|
182
|
+
urlParameters,
|
|
195
183
|
});
|
|
196
184
|
if (
|
|
197
185
|
apiVersionInfo &&
|
|
@@ -203,7 +191,7 @@ export function transformUrlInfo(
|
|
|
203
191
|
urlParameters.push({
|
|
204
192
|
oriName: "api-version",
|
|
205
193
|
name: "apiVersion",
|
|
206
|
-
type: "string"
|
|
194
|
+
type: "string",
|
|
207
195
|
});
|
|
208
196
|
}
|
|
209
197
|
return { endpoint, urlParameters, apiVersionInfo };
|
|
@@ -1,37 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getHttpOperationWithCache,
|
|
3
|
+
isApiVersion,
|
|
4
|
+
SdkClient,
|
|
5
|
+
} from "@azure-tools/typespec-client-generator-core";
|
|
1
6
|
import {
|
|
2
7
|
ApiVersionInfo,
|
|
3
8
|
ApiVersionPosition,
|
|
4
9
|
extractDefinedPosition,
|
|
5
10
|
extractPathApiVersion,
|
|
6
11
|
SchemaContext,
|
|
7
|
-
UrlInfo
|
|
12
|
+
UrlInfo,
|
|
8
13
|
} from "../rlc-common/index.js";
|
|
9
|
-
import {
|
|
10
|
-
getHttpOperationWithCache,
|
|
11
|
-
isApiVersion,
|
|
12
|
-
SdkClient
|
|
13
|
-
} from "@azure-tools/typespec-client-generator-core";
|
|
14
|
-
import { SdkContext } from "../utils/interfaces.js";
|
|
15
|
-
import {
|
|
16
|
-
getDefaultApiVersionString,
|
|
17
|
-
getSchemaForType,
|
|
18
|
-
trimUsage
|
|
19
|
-
} from "../utils/modelUtils.js";
|
|
20
14
|
import { listOperationsUnderRLCClient } from "../utils/clientUtils.js";
|
|
15
|
+
import { SdkContext } from "../utils/interfaces.js";
|
|
16
|
+
import { getDefaultApiVersionString, getSchemaForType, trimUsage } from "../utils/modelUtils.js";
|
|
21
17
|
|
|
22
18
|
export function transformApiVersionInfo(
|
|
23
19
|
client: SdkClient,
|
|
24
20
|
dpgContext: SdkContext,
|
|
25
|
-
urlInfo?: UrlInfo
|
|
21
|
+
urlInfo?: UrlInfo,
|
|
26
22
|
): ApiVersionInfo | undefined {
|
|
27
23
|
const queryVersionDetail = getOperationApiVersion(client, dpgContext);
|
|
28
24
|
const pathVersionDetail = extractPathApiVersion(urlInfo);
|
|
29
25
|
const isCrossedVersion =
|
|
30
26
|
queryVersionDetail || pathVersionDetail
|
|
31
|
-
? Boolean(
|
|
32
|
-
pathVersionDetail?.isCrossedVersion ||
|
|
33
|
-
queryVersionDetail?.isCrossedVersion
|
|
34
|
-
)
|
|
27
|
+
? Boolean(pathVersionDetail?.isCrossedVersion || queryVersionDetail?.isCrossedVersion)
|
|
35
28
|
: undefined;
|
|
36
29
|
const defaultValue =
|
|
37
30
|
(pathVersionDetail || queryVersionDetail) && !isCrossedVersion
|
|
@@ -47,19 +40,16 @@ export function transformApiVersionInfo(
|
|
|
47
40
|
dpgContext.hasApiVersionInClient = true;
|
|
48
41
|
}
|
|
49
42
|
return {
|
|
50
|
-
definedPosition: extractDefinedPosition(
|
|
51
|
-
queryVersionDetail,
|
|
52
|
-
pathVersionDetail
|
|
53
|
-
),
|
|
43
|
+
definedPosition: extractDefinedPosition(queryVersionDetail, pathVersionDetail),
|
|
54
44
|
isCrossedVersion,
|
|
55
45
|
defaultValue,
|
|
56
|
-
required: pathVersionDetail?.required ?? queryVersionDetail?.required
|
|
46
|
+
required: pathVersionDetail?.required ?? queryVersionDetail?.required,
|
|
57
47
|
};
|
|
58
48
|
}
|
|
59
49
|
|
|
60
50
|
export function getOperationApiVersion(
|
|
61
51
|
client: SdkClient,
|
|
62
|
-
dpgContext: SdkContext
|
|
52
|
+
dpgContext: SdkContext,
|
|
63
53
|
): ApiVersionInfo | undefined {
|
|
64
54
|
const apiVersionTypes = new Set<string>();
|
|
65
55
|
const locations = new Set<ApiVersionPosition>();
|
|
@@ -74,15 +64,13 @@ export function getOperationApiVersion(
|
|
|
74
64
|
continue;
|
|
75
65
|
}
|
|
76
66
|
const params = route.parameters.parameters.filter(
|
|
77
|
-
(p) =>
|
|
78
|
-
(p.type === "query" || p.type === "path") &&
|
|
79
|
-
isApiVersion(dpgContext, p.param)
|
|
67
|
+
(p) => (p.type === "query" || p.type === "path") && isApiVersion(dpgContext, p.param),
|
|
80
68
|
);
|
|
81
69
|
params.map((p) => {
|
|
82
70
|
const type = getSchemaForType(dpgContext, p.param.type, {
|
|
83
71
|
usage: [SchemaContext.Exception, SchemaContext.Input],
|
|
84
72
|
needRef: false,
|
|
85
|
-
relevantProperty: p.param
|
|
73
|
+
relevantProperty: p.param,
|
|
86
74
|
});
|
|
87
75
|
required.add(!p.param.optional);
|
|
88
76
|
if (p.type === "query" || p.type === "path") {
|
|
@@ -106,11 +94,10 @@ export function getOperationApiVersion(
|
|
|
106
94
|
return;
|
|
107
95
|
}
|
|
108
96
|
const detail: ApiVersionInfo = {
|
|
109
|
-
definedPosition:
|
|
110
|
-
locations.size > 1 ? "duplicate" : locations.values().next().value,
|
|
97
|
+
definedPosition: locations.size > 1 ? "duplicate" : locations.values().next().value,
|
|
111
98
|
isCrossedVersion: apiVersionTypes.size > 1,
|
|
112
99
|
defaultValue: undefined, // We won't prompt the query versions into client one
|
|
113
|
-
required: required.values().next().value
|
|
100
|
+
required: required.values().next().value,
|
|
114
101
|
};
|
|
115
102
|
return detail;
|
|
116
103
|
}
|