@azure-tools/typespec-ts 0.54.0-dev.5 → 0.54.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/contextManager.d.ts +5 -5
- package/dist/src/contextManager.d.ts.map +1 -1
- package/dist/src/contextManager.js.map +1 -1
- package/dist/src/framework/declaration.d.ts +1 -1
- package/dist/src/framework/declaration.d.ts.map +1 -1
- package/dist/src/framework/declaration.js +2 -4
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +12 -20
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +8 -11
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/hooks/useDependencies.d.ts.map +1 -1
- package/dist/src/framework/hooks/useDependencies.js +1 -1
- package/dist/src/framework/hooks/useDependencies.js.map +1 -1
- package/dist/src/framework/load-static-helpers.d.ts +1 -1
- package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
- package/dist/src/framework/load-static-helpers.js +12 -25
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.d.ts.map +1 -1
- package/dist/src/framework/reference.js +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/framework/sample.js +8 -8
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +47 -48
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +140 -140
- package/dist/src/lib.js.map +1 -1
- package/dist/src/metaTree.d.ts +1 -1
- package/dist/src/metaTree.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +49 -62
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts +2 -2
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +4 -7
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts +2 -2
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +30 -36
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildModularOptions.d.ts +1 -1
- package/dist/src/modular/buildModularOptions.d.ts.map +1 -1
- package/dist/src/modular/buildModularOptions.js +2 -2
- package/dist/src/modular/buildModularOptions.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +3 -3
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +22 -23
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +7 -9
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts +1 -1
- package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +11 -11
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts +2 -2
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +30 -39
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +9 -17
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
- package/dist/src/modular/emitLoggerFile.js +2 -2
- package/dist/src/modular/emitLoggerFile.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +54 -72
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +6 -7
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.d.ts.map +1 -1
- package/dist/src/modular/emitSamples.js +40 -52
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.d.ts.map +1 -1
- package/dist/src/modular/emitTests.js +9 -12
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/external-dependencies.js +54 -54
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +27 -36
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +20 -38
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +39 -58
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +4 -5
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +2 -2
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +136 -196
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +1 -1
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +50 -56
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +52 -59
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +43 -51
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.js +4 -11
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
- package/dist/src/modular/static-helpers-metadata.js +60 -60
- package/dist/src/modular/type-expressions/get-credential-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +7 -9
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +4 -8
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -1
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -1
- package/dist/src/rlc-common/buildClient.d.ts +1 -1
- package/dist/src/rlc-common/buildClient.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClient.js +48 -66
- package/dist/src/rlc-common/buildClient.js.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.d.ts.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +24 -42
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.js +57 -57
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +32 -35
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/src/rlc-common/buildLogger.d.ts.map +1 -1
- package/dist/src/rlc-common/buildLogger.js +3 -3
- package/dist/src/rlc-common/buildLogger.js.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.d.ts.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +3 -3
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.js +29 -46
- 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 +42 -50
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.js +5 -5
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.d.ts.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.js +19 -22
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts +1 -1
- package/dist/src/rlc-common/buildSamples.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSamples.js +2 -2
- package/dist/src/rlc-common/buildSchemaType.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSchemaType.js +9 -13
- package/dist/src/rlc-common/buildSchemaType.js.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.d.ts.map +1 -1
- package/dist/src/rlc-common/buildSerializeHelper.js +4 -4
- package/dist/src/rlc-common/buildSerializeHelper.js.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.d.ts.map +1 -1
- package/dist/src/rlc-common/buildTopLevelIndexFile.js +9 -13
- package/dist/src/rlc-common/buildTopLevelIndexFile.js.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +2 -3
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +23 -25
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +8 -13
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +8 -12
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/pathUtils.js +1 -3
- package/dist/src/rlc-common/helpers/pathUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/shortcutMethods.js +2 -2
- package/dist/src/rlc-common/helpers/shortcutMethods.js.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.d.ts.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +1 -2
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +3 -4
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/src/rlc-common/index.d.ts +28 -28
- package/dist/src/rlc-common/index.d.ts.map +1 -1
- package/dist/src/rlc-common/index.js +28 -28
- package/dist/src/rlc-common/index.js.map +1 -1
- package/dist/src/rlc-common/interfaces.d.ts.map +1 -1
- package/dist/src/rlc-common/interfaces.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +13 -13
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -5
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildLicenseFile.js +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +16 -16
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +10 -18
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +2 -3
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +8 -8
- package/dist/src/rlc-common/metadata/buildTsConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +23 -21
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -2
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +13 -13
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +22 -26
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js +15 -16
- package/dist/src/rlc-common/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js +8 -8
- package/dist/src/rlc-common/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.d.ts.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +26 -29
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/test/buildKarmaConfig.js +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +3 -3
- package/dist/src/rlc-common/test/buildSampleTest.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +2 -2
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.d.ts.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.js +4 -6
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.d.ts.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.js +19 -23
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +1 -1
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/transform/transform.d.ts +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +10 -11
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +8 -10
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +9 -11
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +22 -28
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +11 -12
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +1 -1
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +12 -12
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +9 -15
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts +1 -1
- package/dist/src/transform/transformTelemetryInfo.d.ts.map +1 -1
- package/dist/src/transform/transformTelemetryInfo.js +3 -3
- package/dist/src/transform/transformTelemetryInfo.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +14 -26
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.d.ts +1 -1
- package/dist/src/utils/clientUtils.d.ts.map +1 -1
- package/dist/src/utils/clientUtils.js +11 -14
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.d.ts +1 -1
- package/dist/src/utils/credentialUtils.d.ts.map +1 -1
- package/dist/src/utils/credentialUtils.js +3 -3
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.d.ts.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +8 -12
- package/dist/src/utils/crossLanguageDef.js.map +1 -1
- package/dist/src/utils/emitUtil.d.ts +1 -1
- package/dist/src/utils/emitUtil.d.ts.map +1 -1
- package/dist/src/utils/emitUtil.js +4 -6
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +2 -2
- package/dist/src/utils/fileSystemUtils.js.map +1 -1
- package/dist/src/utils/importHelper.d.ts.map +1 -1
- package/dist/src/utils/importHelper.js +2 -4
- package/dist/src/utils/importHelper.js.map +1 -1
- package/dist/src/utils/interfaces.d.ts +1 -1
- package/dist/src/utils/interfaces.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.d.ts.map +1 -1
- package/dist/src/utils/mediaTypes.js +7 -19
- package/dist/src/utils/mediaTypes.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts +2 -2
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +107 -170
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.d.ts.map +1 -1
- package/dist/src/utils/namespaceUtils.js +2 -2
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +29 -42
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/src/utils/parameterUtils.d.ts +1 -1
- package/dist/src/utils/parameterUtils.d.ts.map +1 -1
- package/dist/src/utils/parameterUtils.js +19 -22
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/src/utils/resolve-project-root.js +2 -2
- package/dist/src/utils/resolve-project-root.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -5
- 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 +111 -180
- package/src/lib.ts +143 -158
- package/src/metaTree.ts +1 -1
- package/src/modular/buildClassicalClient.ts +83 -160
- package/src/modular/buildClassicalOperationGroups.ts +14 -39
- package/src/modular/buildClientContext.ts +54 -83
- package/src/modular/buildModularOptions.ts +4 -5
- package/src/modular/buildOperations.ts +46 -73
- package/src/modular/buildProjectFiles.ts +18 -47
- package/src/modular/buildRestorePoller.ts +27 -46
- package/src/modular/buildRootIndex.ts +86 -159
- package/src/modular/buildSubpathIndex.ts +35 -58
- package/src/modular/emitLoggerFile.ts +4 -9
- package/src/modular/emitModels.ts +136 -266
- package/src/modular/emitModelsOptions.ts +10 -16
- package/src/modular/emitSamples.ts +91 -177
- package/src/modular/emitTests.ts +28 -61
- package/src/modular/external-dependencies.ts +54 -54
- package/src/modular/helpers/classicalOperationHelpers.ts +73 -126
- package/src/modular/helpers/clientHelpers.ts +41 -88
- package/src/modular/helpers/clientOptionHelpers.ts +4 -11
- package/src/modular/helpers/exampleValueHelpers.ts +97 -209
- package/src/modular/helpers/namingHelpers.ts +12 -28
- package/src/modular/helpers/operationHelpers.ts +430 -757
- package/src/modular/helpers/typeHelpers.ts +11 -22
- package/src/modular/serialization/buildDeserializerFunction.ts +88 -122
- package/src/modular/serialization/buildSerializerFunction.ts +91 -129
- package/src/modular/serialization/buildXmlSerializerFunction.ts +104 -183
- package/src/modular/serialization/serializeUtils.ts +12 -21
- package/src/modular/static/rollup.test.config.js +11 -14
- package/src/modular/static/scripts/renameOutput.mjs +2 -2
- package/src/modular/static-helpers-metadata.ts +60 -60
- package/src/modular/type-expressions/get-credential-expression.ts +1 -1
- package/src/modular/type-expressions/get-enum-expression.ts +5 -10
- package/src/modular/type-expressions/get-model-expression.ts +13 -17
- package/src/modular/type-expressions/get-nullable-expression.ts +4 -5
- package/src/modular/type-expressions/get-type-expression.ts +8 -12
- package/src/modular/type-expressions/get-union-expression.ts +4 -4
- package/src/modular/type-expressions/utils.ts +1 -1
- package/src/rlc-common/buildClient.ts +70 -141
- package/src/rlc-common/buildClientDefinitions.ts +43 -87
- package/src/rlc-common/buildIndexFile.ts +78 -78
- package/src/rlc-common/buildIsUnexpectedHelper.ts +34 -41
- package/src/rlc-common/buildLogger.ts +7 -7
- package/src/rlc-common/buildMethodShortcuts.ts +9 -21
- package/src/rlc-common/buildObjectTypes.ts +78 -155
- package/src/rlc-common/buildPaginateHelper.ts +9 -12
- package/src/rlc-common/buildParameterTypes.ts +92 -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 +12 -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 +4 -6
- package/src/utils/importHelper.ts +5 -10
- package/src/utils/interfaces.ts +1 -1
- package/src/utils/mediaTypes.ts +13 -34
- package/src/utils/modelUtils.ts +174 -383
- package/src/utils/namespaceUtils.ts +8 -24
- package/src/utils/operationUtil.ts +98 -190
- package/src/utils/parameterUtils.ts +31 -54
- package/src/utils/resolve-project-root.ts +3 -3
- package/static/static-helpers/cloudSettingHelpers.ts +4 -6
- package/static/static-helpers/multipartHelpers.ts +3 -3
- package/static/static-helpers/pagingHelpers.ts +28 -63
- package/static/static-helpers/pollingHelpers.ts +15 -28
- package/static/static-helpers/serialization/build-multi-collection.ts +1 -4
- package/static/static-helpers/serialization/check-prop-undefined.ts +1 -4
- package/static/static-helpers/serialization/get-binary-response.ts +2 -2
- package/static/static-helpers/serialization/get-binary-stream-response.ts +2 -4
- package/static/static-helpers/serialization/serialize-record.ts +1 -1
- package/static/static-helpers/serialization/serializers.ts +4 -7
- package/static/static-helpers/serialization/xml-helpers.ts +41 -89
- package/static/static-helpers/simplePollerHelpers.ts +9 -18
- package/static/static-helpers/storageCompatResponse.ts +10 -27
- package/static/static-helpers/urlTemplate.ts +4 -7
- package/static/test-helpers/recordedClient.ts +5 -10
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { NameType, SchemaContext, isArraySchema, normalizeName } from "../rlc-common/index.js";
|
|
4
|
-
import { NoTarget, getDiscriminator, getDoc, getEffectiveModelType, getEncode, getFormat, getFriendlyName, getLifecycleVisibilityEnum, getMaxLength, getMaxValue, getMinLength, getMinValue, getPattern, getProperty, getPropertyType, getSummary, getVisibilityForClass, isArrayModelType, isNeverType, isNullType, isNumericType, isRecordModelType, isSecret, isStringType, isTemplateDeclaration, isUnknownType, listServices } from "@typespec/compiler";
|
|
5
|
-
import { Visibility, getHeaderFieldName, getHttpFileModel, getHttpPart, getPathParamName, getQueryParamName, isBody, isStatusCode } from "@typespec/http";
|
|
6
|
-
import { KnownMediaType, hasMediaType, isMediaTypeMultipartFormData } from "./mediaTypes.js";
|
|
7
|
-
import { getDefaultApiVersion, getWireName, isApiVersion } from "@azure-tools/typespec-client-generator-core";
|
|
8
3
|
import { getUnionAsEnum } from "@azure-tools/typespec-azure-core";
|
|
9
|
-
import {
|
|
4
|
+
import { getDefaultApiVersion, getWireName, isApiVersion, } from "@azure-tools/typespec-client-generator-core";
|
|
5
|
+
import { NoTarget, getDiscriminator, getDoc, getEffectiveModelType, getEncode, getFormat, getFriendlyName, getLifecycleVisibilityEnum, getMaxLength, getMaxValue, getMinLength, getMinValue, getPattern, getProperty, getPropertyType, getSummary, getVisibilityForClass, isArrayModelType, isNeverType, isNullType, isNumericType, isRecordModelType, isSecret, isStringType, isTemplateDeclaration, isUnknownType, listServices, } from "@typespec/compiler";
|
|
6
|
+
import { Visibility, getHeaderFieldName, getHttpFileModel, getHttpPart, getPathParamName, getQueryParamName, isBody, isStatusCode, } from "@typespec/http";
|
|
7
|
+
import { NameType, SchemaContext, isArraySchema, normalizeName, } from "../rlc-common/index.js";
|
|
8
|
+
import { KnownMediaType, hasMediaType, isMediaTypeMultipartFormData } from "./mediaTypes.js";
|
|
10
9
|
import { reportDiagnostic } from "../lib.js";
|
|
10
|
+
import { getModelNamespaceName } from "./namespaceUtils.js";
|
|
11
11
|
export const BINARY_TYPE_UNION = "string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream";
|
|
12
12
|
export const BINARY_AND_FILE_TYPE_UNION = `${BINARY_TYPE_UNION} | File`;
|
|
13
13
|
export function getBinaryType(usage) {
|
|
14
|
-
return usage.includes(SchemaContext.Output)
|
|
15
|
-
? "Uint8Array"
|
|
16
|
-
: BINARY_TYPE_UNION;
|
|
14
|
+
return usage.includes(SchemaContext.Output) ? "Uint8Array" : BINARY_TYPE_UNION;
|
|
17
15
|
}
|
|
18
16
|
export function isByteOrByteUnion(dpgContext, type) {
|
|
19
17
|
const schema = getSchemaForType(dpgContext, type);
|
|
20
18
|
return isBytesType(schema) || isBytesUnion(schema);
|
|
21
19
|
}
|
|
22
20
|
function isBytesType(schema) {
|
|
23
|
-
return
|
|
24
|
-
(schema.format === "bytes" || schema.format === "binary"));
|
|
21
|
+
return schema.type === "string" && (schema.format === "bytes" || schema.format === "binary");
|
|
25
22
|
}
|
|
26
23
|
function isBytesUnion(schema) {
|
|
27
24
|
if (!Array.isArray(schema.enum)) {
|
|
@@ -35,10 +32,7 @@ function isBytesUnion(schema) {
|
|
|
35
32
|
return false;
|
|
36
33
|
}
|
|
37
34
|
function refineByteType(schema) {
|
|
38
|
-
schema.typeName = getBinaryType([
|
|
39
|
-
SchemaContext.Input,
|
|
40
|
-
SchemaContext.Exception
|
|
41
|
-
]);
|
|
35
|
+
schema.typeName = getBinaryType([SchemaContext.Input, SchemaContext.Exception]);
|
|
42
36
|
schema.outputTypeName = getBinaryType([SchemaContext.Output]);
|
|
43
37
|
return schema;
|
|
44
38
|
}
|
|
@@ -89,13 +83,13 @@ export function getSchemaForType(dpgContext, typeInput, options) {
|
|
|
89
83
|
multipartOptions: {
|
|
90
84
|
filenameSchema: {
|
|
91
85
|
required: !fileModel.filename.optional,
|
|
92
|
-
...getSchemaForType(dpgContext, fileModel.filename, options)
|
|
86
|
+
...getSchemaForType(dpgContext, fileModel.filename, options),
|
|
93
87
|
},
|
|
94
88
|
contentTypeSchema: {
|
|
95
89
|
required: !fileModel.contentType.optional,
|
|
96
|
-
...getSchemaForType(dpgContext, fileModel.contentType, options)
|
|
97
|
-
}
|
|
98
|
-
}
|
|
90
|
+
...getSchemaForType(dpgContext, fileModel.contentType, options),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
99
93
|
};
|
|
100
94
|
}
|
|
101
95
|
else {
|
|
@@ -110,11 +104,9 @@ export function getSchemaForType(dpgContext, typeInput, options) {
|
|
|
110
104
|
if (isAnonymousObjectSchema(schema)) {
|
|
111
105
|
if (Object.keys(schema.properties ?? {}).length === 0) {
|
|
112
106
|
// Handle empty anonymous model as Record
|
|
113
|
-
schema.typeName =
|
|
114
|
-
schema.type === "object" ? "Record<string, unknown>" : "unknown";
|
|
107
|
+
schema.typeName = schema.type === "object" ? "Record<string, unknown>" : "unknown";
|
|
115
108
|
if (usage && usage.includes(SchemaContext.Output)) {
|
|
116
|
-
schema.outputTypeName =
|
|
117
|
-
schema.type === "object" ? "Record<string, any>" : "any";
|
|
109
|
+
schema.outputTypeName = schema.type === "object" ? "Record<string, any>" : "any";
|
|
118
110
|
}
|
|
119
111
|
schema.type = "unknown";
|
|
120
112
|
}
|
|
@@ -122,13 +114,12 @@ export function getSchemaForType(dpgContext, typeInput, options) {
|
|
|
122
114
|
// Handle non-empty anonymous model as inline model
|
|
123
115
|
if (usage && usage.includes(SchemaContext.Output)) {
|
|
124
116
|
schema.outputTypeName = getModelInlineSigniture(schema, {
|
|
125
|
-
usage: [SchemaContext.Output]
|
|
117
|
+
usage: [SchemaContext.Output],
|
|
126
118
|
});
|
|
127
119
|
}
|
|
128
120
|
schema.typeName = getModelInlineSigniture(schema, {
|
|
129
121
|
usage: [SchemaContext.Input],
|
|
130
|
-
multipart: options?.isRequestBody &&
|
|
131
|
-
isMediaTypeMultipartFormData(options?.mediaTypes ?? [])
|
|
122
|
+
multipart: options?.isRequestBody && isMediaTypeMultipartFormData(options?.mediaTypes ?? []),
|
|
132
123
|
});
|
|
133
124
|
schema.type = "object";
|
|
134
125
|
}
|
|
@@ -178,9 +169,9 @@ export function getSchemaForType(dpgContext, typeInput, options) {
|
|
|
178
169
|
code: "invalid-schema",
|
|
179
170
|
format: {
|
|
180
171
|
type: type.kind,
|
|
181
|
-
property: options?.relevantProperty?.name ?? ""
|
|
172
|
+
property: options?.relevantProperty?.name ?? "",
|
|
182
173
|
},
|
|
183
|
-
target: type
|
|
174
|
+
target: type,
|
|
184
175
|
});
|
|
185
176
|
return undefined;
|
|
186
177
|
}
|
|
@@ -233,10 +224,10 @@ function mergeFormatAndEncoding(format, encoding, encodeAsFormat) {
|
|
|
233
224
|
function getSchemaForScalar(dpgContext, scalar, options) {
|
|
234
225
|
let result = {};
|
|
235
226
|
const isStd = dpgContext.program.checker.isStdType(scalar);
|
|
236
|
-
const { relevantProperty, isRequestBody, isParentRequestBody, mediaTypes: contentTypes } = options ?? {};
|
|
227
|
+
const { relevantProperty, isRequestBody, isParentRequestBody, mediaTypes: contentTypes, } = options ?? {};
|
|
237
228
|
if (isStd) {
|
|
238
229
|
result = getSchemaForStdScalar(dpgContext.program, scalar, {
|
|
239
|
-
relevantProperty
|
|
230
|
+
relevantProperty,
|
|
240
231
|
});
|
|
241
232
|
}
|
|
242
233
|
else if (scalar.baseScalar) {
|
|
@@ -256,20 +247,15 @@ function getSchemaForScalar(dpgContext, scalar, options) {
|
|
|
256
247
|
}
|
|
257
248
|
else {
|
|
258
249
|
// for other cases we would trust the @encode decorator if not present we would treat it as string
|
|
259
|
-
const withDecorators = applyEncoding(dpgContext, scalar, result
|
|
260
|
-
|
|
261
|
-
: undefined);
|
|
262
|
-
if (withDecorators.type === "string" &&
|
|
263
|
-
withDecorators.format === "binary") {
|
|
250
|
+
const withDecorators = applyEncoding(dpgContext, scalar, result ? applyIntrinsicDecorators(dpgContext.program, scalar, result) : undefined);
|
|
251
|
+
if (withDecorators.type === "string" && withDecorators.format === "binary") {
|
|
264
252
|
withDecorators.typeName = BINARY_TYPE_UNION;
|
|
265
253
|
withDecorators.outputTypeName = "Uint8Array";
|
|
266
254
|
}
|
|
267
255
|
return withDecorators;
|
|
268
256
|
}
|
|
269
257
|
function isBinaryAsRequestBody() {
|
|
270
|
-
return (hasMediaType(KnownMediaType.Binary, contentTypes) &&
|
|
271
|
-
isRequestBody &&
|
|
272
|
-
isBytesType(result));
|
|
258
|
+
return (hasMediaType(KnownMediaType.Binary, contentTypes) && isRequestBody && isBytesType(result));
|
|
273
259
|
}
|
|
274
260
|
function isFormDataBytesInRequestBody() {
|
|
275
261
|
return (hasMediaType(KnownMediaType.MultipartFormData, contentTypes) &&
|
|
@@ -287,7 +273,7 @@ function getSchemaForUnion(dpgContext, union, options) {
|
|
|
287
273
|
for (const [_, member] of asEnum.members.entries()) {
|
|
288
274
|
const memberType = getSchemaForType(dpgContext, member.type, {
|
|
289
275
|
...options,
|
|
290
|
-
needRef: options?.needRef ?? false
|
|
276
|
+
needRef: options?.needRef ?? false,
|
|
291
277
|
});
|
|
292
278
|
values.push(memberType);
|
|
293
279
|
if (memberType.name) {
|
|
@@ -300,7 +286,7 @@ function getSchemaForUnion(dpgContext, union, options) {
|
|
|
300
286
|
// We already know it's not a model type
|
|
301
287
|
const variantType = getSchemaForType(dpgContext, variant.type, {
|
|
302
288
|
...options,
|
|
303
|
-
needRef: isAnonymousModelType(variant.type) ? false : true
|
|
289
|
+
needRef: isAnonymousModelType(variant.type) ? false : true,
|
|
304
290
|
});
|
|
305
291
|
values.push(variantType);
|
|
306
292
|
if (variantType.typeName) {
|
|
@@ -314,21 +300,15 @@ function getSchemaForUnion(dpgContext, union, options) {
|
|
|
314
300
|
schema.enum = values;
|
|
315
301
|
const unionAlias = asEnum?.open && asEnum?.kind && !namedUnionMember
|
|
316
302
|
? asEnum.kind + (asEnum.nullable ? " | null" : "")
|
|
317
|
-
: values
|
|
318
|
-
.map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`)
|
|
319
|
-
.join(" | ");
|
|
303
|
+
: values.map((item) => `${getTypeName(item, [SchemaContext.Input]) ?? item}`).join(" | ");
|
|
320
304
|
const outputUnionAlias = asEnum?.open && asEnum?.kind && !namedUnionMember
|
|
321
305
|
? asEnum.kind + (asEnum.nullable ? " | null" : "")
|
|
322
|
-
: values
|
|
323
|
-
.map((item) => `${getTypeName(item, [SchemaContext.Output]) ?? item}`)
|
|
324
|
-
.join(" | ");
|
|
306
|
+
: values.map((item) => `${getTypeName(item, [SchemaContext.Output]) ?? item}`).join(" | ");
|
|
325
307
|
schema.alias = unionAlias;
|
|
326
308
|
schema.outputAlias = outputUnionAlias;
|
|
327
309
|
}
|
|
328
310
|
if (!union.expression) {
|
|
329
|
-
const unionName = union.name
|
|
330
|
-
? normalizeName(union.name, NameType.Interface)
|
|
331
|
-
: undefined;
|
|
311
|
+
const unionName = union.name ? normalizeName(union.name, NameType.Interface) : undefined;
|
|
332
312
|
schema.name = unionName;
|
|
333
313
|
schema.type = "object";
|
|
334
314
|
schema.typeName = unionName;
|
|
@@ -344,9 +324,7 @@ function getSchemaForUnion(dpgContext, union, options) {
|
|
|
344
324
|
else {
|
|
345
325
|
schema.type = "union";
|
|
346
326
|
schema.typeName = union.name ?? schema.alias;
|
|
347
|
-
schema.outputTypeName = union.name
|
|
348
|
-
? union.name + "Output"
|
|
349
|
-
: schema.outputAlias;
|
|
327
|
+
schema.outputTypeName = union.name ? union.name + "Output" : schema.outputAlias;
|
|
350
328
|
delete schema.alias;
|
|
351
329
|
delete schema.outputAlias;
|
|
352
330
|
}
|
|
@@ -391,8 +369,7 @@ function isStringLiteral(type) {
|
|
|
391
369
|
return true;
|
|
392
370
|
}
|
|
393
371
|
return (type.kind === "String" ||
|
|
394
|
-
(type.kind === "EnumMember" &&
|
|
395
|
-
typeof (type.value ?? type.name) === "string") ||
|
|
372
|
+
(type.kind === "EnumMember" && typeof (type.value ?? type.name) === "string") ||
|
|
396
373
|
(type.kind === "UnionVariant" && type.type.kind === "String"));
|
|
397
374
|
}
|
|
398
375
|
// Return any string literal values for type
|
|
@@ -420,18 +397,16 @@ function validateDiscriminator(program, discriminator, derivedModels) {
|
|
|
420
397
|
reportDiagnostic(program, {
|
|
421
398
|
code: "discriminator",
|
|
422
399
|
messageId: "missing",
|
|
423
|
-
target: t
|
|
400
|
+
target: t,
|
|
424
401
|
});
|
|
425
402
|
return false;
|
|
426
403
|
}
|
|
427
404
|
let retval = true;
|
|
428
|
-
if (!isOasString(prop.type) &&
|
|
429
|
-
prop.type.kind !== "EnumMember" &&
|
|
430
|
-
prop.type.kind !== "Enum") {
|
|
405
|
+
if (!isOasString(prop.type) && prop.type.kind !== "EnumMember" && prop.type.kind !== "Enum") {
|
|
431
406
|
reportDiagnostic(program, {
|
|
432
407
|
code: "discriminator",
|
|
433
408
|
messageId: "type",
|
|
434
|
-
target: prop
|
|
409
|
+
target: prop,
|
|
435
410
|
});
|
|
436
411
|
retval = false;
|
|
437
412
|
}
|
|
@@ -439,7 +414,7 @@ function validateDiscriminator(program, discriminator, derivedModels) {
|
|
|
439
414
|
reportDiagnostic(program, {
|
|
440
415
|
code: "discriminator",
|
|
441
416
|
messageId: "required",
|
|
442
|
-
target: prop
|
|
417
|
+
target: prop,
|
|
443
418
|
});
|
|
444
419
|
retval = false;
|
|
445
420
|
}
|
|
@@ -455,7 +430,7 @@ function validateDiscriminator(program, discriminator, derivedModels) {
|
|
|
455
430
|
reportDiagnostic(program, {
|
|
456
431
|
code: "discriminator-value",
|
|
457
432
|
messageId: "literal",
|
|
458
|
-
target: prop || t
|
|
433
|
+
target: prop || t,
|
|
459
434
|
});
|
|
460
435
|
}
|
|
461
436
|
if (prop) {
|
|
@@ -468,9 +443,9 @@ function validateDiscriminator(program, discriminator, derivedModels) {
|
|
|
468
443
|
format: {
|
|
469
444
|
val: val,
|
|
470
445
|
model1: discriminatorValues.get(val),
|
|
471
|
-
model2: t.name
|
|
446
|
+
model2: t.name,
|
|
472
447
|
},
|
|
473
|
-
target: prop
|
|
448
|
+
target: prop,
|
|
474
449
|
});
|
|
475
450
|
retVals.push(false);
|
|
476
451
|
}
|
|
@@ -495,7 +470,7 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
495
470
|
type: "object",
|
|
496
471
|
isMultipartBody,
|
|
497
472
|
description: getDoc(program, model) ?? "",
|
|
498
|
-
fromCore: isCoreModel
|
|
473
|
+
fromCore: isCoreModel,
|
|
499
474
|
};
|
|
500
475
|
// normalized the output name
|
|
501
476
|
modelSchema.name = normalizeName(modelSchema.name, NameType.Interface, true /** shouldGuard */);
|
|
@@ -516,20 +491,20 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
516
491
|
if (derivedModels.length > 0) {
|
|
517
492
|
modelSchema.children = {
|
|
518
493
|
all: [],
|
|
519
|
-
immediate: []
|
|
494
|
+
immediate: [],
|
|
520
495
|
};
|
|
521
496
|
}
|
|
522
497
|
for (const child of derivedModels) {
|
|
523
498
|
const childSchema = getSchemaForType(dpgContext, child, {
|
|
524
499
|
usage,
|
|
525
|
-
needRef: true
|
|
500
|
+
needRef: true,
|
|
526
501
|
});
|
|
527
502
|
for (const [name, prop] of child.properties) {
|
|
528
503
|
if (name === discriminator?.propertyName) {
|
|
529
504
|
const propSchema = getSchemaForType(dpgContext, prop.type, {
|
|
530
505
|
usage,
|
|
531
506
|
needRef: !isAnonymousModelType(prop.type),
|
|
532
|
-
relevantProperty: prop
|
|
507
|
+
relevantProperty: prop,
|
|
533
508
|
});
|
|
534
509
|
childSchema.discriminatorValue = propSchema.type.replace(/"/g, "");
|
|
535
510
|
break;
|
|
@@ -550,7 +525,7 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
550
525
|
modelSchema.discriminator = {
|
|
551
526
|
name: propertyName,
|
|
552
527
|
type: "string",
|
|
553
|
-
description: `Discriminator property for ${model.name}
|
|
528
|
+
description: `Discriminator property for ${model.name}.`,
|
|
554
529
|
};
|
|
555
530
|
modelSchema.discriminatorValue = propertyName;
|
|
556
531
|
modelSchema.isPolyParent = true;
|
|
@@ -562,7 +537,7 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
562
537
|
if (isRecordModelType(model)) {
|
|
563
538
|
modelSchema.parents = {
|
|
564
539
|
all: [getSchemaForRecordModel(dpgContext, model, { usage })],
|
|
565
|
-
immediate: [getSchemaForRecordModel(dpgContext, model, { usage })]
|
|
540
|
+
immediate: [getSchemaForRecordModel(dpgContext, model, { usage })],
|
|
566
541
|
};
|
|
567
542
|
}
|
|
568
543
|
for (const [propName, prop] of model.properties) {
|
|
@@ -577,7 +552,7 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
577
552
|
relevantProperty: prop,
|
|
578
553
|
isParentRequestBody: isRequestBody,
|
|
579
554
|
isRequestBody: false,
|
|
580
|
-
mediaTypes: contentTypes
|
|
555
|
+
mediaTypes: contentTypes,
|
|
581
556
|
});
|
|
582
557
|
if (propSchema === undefined) {
|
|
583
558
|
continue;
|
|
@@ -592,16 +567,14 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
592
567
|
modelSchema.properties[name] = propSchema;
|
|
593
568
|
// if this property is a discriminator property, remove it to keep autorest validation happy
|
|
594
569
|
const { propertyName } = getDiscriminator(program, model) || {};
|
|
595
|
-
if (propertyName &&
|
|
596
|
-
name === `"${propertyName}"` &&
|
|
597
|
-
modelSchema.discriminator) {
|
|
570
|
+
if (propertyName && name === `"${propertyName}"` && modelSchema.discriminator) {
|
|
598
571
|
modelSchema.discriminator = {
|
|
599
572
|
...modelSchema.discriminator,
|
|
600
573
|
...{
|
|
601
574
|
type: propSchema.typeName ?? propSchema.type,
|
|
602
575
|
typeName: propSchema.typeName,
|
|
603
|
-
outputTypeName: propSchema.outputTypeName
|
|
604
|
-
}
|
|
576
|
+
outputTypeName: propSchema.outputTypeName,
|
|
577
|
+
},
|
|
605
578
|
};
|
|
606
579
|
continue;
|
|
607
580
|
}
|
|
@@ -637,16 +610,16 @@ function getSchemaForModel(dpgContext, model, options) {
|
|
|
637
610
|
if (modelSchema.parents === undefined) {
|
|
638
611
|
modelSchema.parents = {
|
|
639
612
|
all: [],
|
|
640
|
-
immediate: []
|
|
613
|
+
immediate: [],
|
|
641
614
|
};
|
|
642
615
|
}
|
|
643
616
|
modelSchema.parents.all?.push(getSchemaForType(dpgContext, model.baseModel, {
|
|
644
617
|
usage,
|
|
645
|
-
needRef: true
|
|
618
|
+
needRef: true,
|
|
646
619
|
}));
|
|
647
620
|
modelSchema.parents.immediate?.push(getSchemaForType(dpgContext, model.baseModel, {
|
|
648
621
|
usage,
|
|
649
|
-
needRef: true
|
|
622
|
+
needRef: true,
|
|
650
623
|
}));
|
|
651
624
|
}
|
|
652
625
|
return modelSchema;
|
|
@@ -656,24 +629,19 @@ function getSdkVisibility(program, type) {
|
|
|
656
629
|
const visibility = getVisibilityForClass(program, type, lifecycle);
|
|
657
630
|
if (visibility) {
|
|
658
631
|
const result = [];
|
|
659
|
-
if (lifecycle.members.get("Read") &&
|
|
660
|
-
visibility.has(lifecycle.members.get("Read"))) {
|
|
632
|
+
if (lifecycle.members.get("Read") && visibility.has(lifecycle.members.get("Read"))) {
|
|
661
633
|
result.push(Visibility.Read);
|
|
662
634
|
}
|
|
663
|
-
if (lifecycle.members.get("Create") &&
|
|
664
|
-
visibility.has(lifecycle.members.get("Create"))) {
|
|
635
|
+
if (lifecycle.members.get("Create") && visibility.has(lifecycle.members.get("Create"))) {
|
|
665
636
|
result.push(Visibility.Create);
|
|
666
637
|
}
|
|
667
|
-
if (lifecycle.members.get("Update") &&
|
|
668
|
-
visibility.has(lifecycle.members.get("Update"))) {
|
|
638
|
+
if (lifecycle.members.get("Update") && visibility.has(lifecycle.members.get("Update"))) {
|
|
669
639
|
result.push(Visibility.Update);
|
|
670
640
|
}
|
|
671
|
-
if (lifecycle.members.get("Delete") &&
|
|
672
|
-
visibility.has(lifecycle.members.get("Delete"))) {
|
|
641
|
+
if (lifecycle.members.get("Delete") && visibility.has(lifecycle.members.get("Delete"))) {
|
|
673
642
|
result.push(Visibility.Delete);
|
|
674
643
|
}
|
|
675
|
-
if (lifecycle.members.get("Query") &&
|
|
676
|
-
visibility.has(lifecycle.members.get("Query"))) {
|
|
644
|
+
if (lifecycle.members.get("Query") && visibility.has(lifecycle.members.get("Query"))) {
|
|
677
645
|
result.push(Visibility.Query);
|
|
678
646
|
}
|
|
679
647
|
return result;
|
|
@@ -736,9 +704,7 @@ function getModelName(dpgContext, model) {
|
|
|
736
704
|
fullNamespacePrefix = "";
|
|
737
705
|
}
|
|
738
706
|
// 5. check if this model should be namespaced
|
|
739
|
-
return dpgContext.rlcOptions?.enableModelNamespace
|
|
740
|
-
? `${fullNamespacePrefix}${name}`
|
|
741
|
-
: name;
|
|
707
|
+
return dpgContext.rlcOptions?.enableModelNamespace ? `${fullNamespacePrefix}${name}` : name;
|
|
742
708
|
}
|
|
743
709
|
// Map an typespec type to an OA schema. Returns undefined when the resulting
|
|
744
710
|
// OA schema is just a regular object schema.
|
|
@@ -819,7 +785,7 @@ function getSchemaForEnum(dpgContext, e) {
|
|
|
819
785
|
if (type !== enumMemberType(option)) {
|
|
820
786
|
reportDiagnostic(dpgContext.program, {
|
|
821
787
|
code: "union-unsupported",
|
|
822
|
-
target: e
|
|
788
|
+
target: e,
|
|
823
789
|
});
|
|
824
790
|
continue;
|
|
825
791
|
}
|
|
@@ -831,7 +797,7 @@ function getSchemaForEnum(dpgContext, e) {
|
|
|
831
797
|
typeName: normalizeName(e.name, NameType.Interface),
|
|
832
798
|
outputTypeName: normalizeName(e.name, NameType.Interface) + "Output",
|
|
833
799
|
description: getDoc(dpgContext.program, e),
|
|
834
|
-
memberType: type
|
|
800
|
+
memberType: type,
|
|
835
801
|
};
|
|
836
802
|
if (values.length > 0) {
|
|
837
803
|
schema.enum = values;
|
|
@@ -872,9 +838,9 @@ function getSchemaForArrayModel(dpgContext, type, options) {
|
|
|
872
838
|
isParentRequestBody: hasMediaType(KnownMediaType.MultipartFormData, contentTypes)
|
|
873
839
|
? isParentRequestBody
|
|
874
840
|
: false,
|
|
875
|
-
needRef: !isAnonymousModelType(indexer.value)
|
|
841
|
+
needRef: !isAnonymousModelType(indexer.value),
|
|
876
842
|
}),
|
|
877
|
-
description: getDoc(program, type)
|
|
843
|
+
description: getDoc(program, type),
|
|
878
844
|
};
|
|
879
845
|
if (!program.checker.isStdType(indexer.value) &&
|
|
880
846
|
!isUnknownType(indexer.value) &&
|
|
@@ -920,9 +886,7 @@ function getSchemaForArrayModel(dpgContext, type, options) {
|
|
|
920
886
|
return `${typeName}[]`;
|
|
921
887
|
})
|
|
922
888
|
.join(" | ");
|
|
923
|
-
if (schema.items.outputTypeName &&
|
|
924
|
-
usage &&
|
|
925
|
-
usage.includes(SchemaContext.Output)) {
|
|
889
|
+
if (schema.items.outputTypeName && usage && usage.includes(SchemaContext.Output)) {
|
|
926
890
|
schema.outputTypeName = schema.items.outputTypeName
|
|
927
891
|
.split("|")
|
|
928
892
|
.map((typeName) => {
|
|
@@ -954,12 +918,12 @@ function getSchemaForRecordModel(dpgContext, type, options) {
|
|
|
954
918
|
if (isRecordModelType(type)) {
|
|
955
919
|
const valueType = getSchemaForType(dpgContext, indexer?.value, {
|
|
956
920
|
usage,
|
|
957
|
-
needRef: !isAnonymousModelType(indexer.value)
|
|
921
|
+
needRef: !isAnonymousModelType(indexer.value),
|
|
958
922
|
});
|
|
959
923
|
schema = {
|
|
960
924
|
type: "dictionary",
|
|
961
925
|
additionalProperties: valueType,
|
|
962
|
-
description: getDoc(program, type)
|
|
926
|
+
description: getDoc(program, type),
|
|
963
927
|
};
|
|
964
928
|
if (!program.checker.isStdType(indexer.value) &&
|
|
965
929
|
!isUnknownType(indexer.value) &&
|
|
@@ -978,12 +942,8 @@ function getSchemaForRecordModel(dpgContext, type, options) {
|
|
|
978
942
|
}
|
|
979
943
|
}
|
|
980
944
|
else {
|
|
981
|
-
schema.typeName = `Record<string, ${getTypeName(valueType, [
|
|
982
|
-
|
|
983
|
-
])}>`;
|
|
984
|
-
schema.outputTypeName = `Record<string, ${getTypeName(valueType, [
|
|
985
|
-
SchemaContext.Output
|
|
986
|
-
])}>`;
|
|
945
|
+
schema.typeName = `Record<string, ${getTypeName(valueType, [SchemaContext.Input])}>`;
|
|
946
|
+
schema.outputTypeName = `Record<string, ${getTypeName(valueType, [SchemaContext.Output])}>`;
|
|
987
947
|
}
|
|
988
948
|
schema.usage = usage;
|
|
989
949
|
return schema;
|
|
@@ -993,8 +953,7 @@ function isUnionType(type) {
|
|
|
993
953
|
return type.kind === "Union";
|
|
994
954
|
}
|
|
995
955
|
export function isObjectOrDictType(schema) {
|
|
996
|
-
return ((schema.type === "object" &&
|
|
997
|
-
schema.properties !== undefined) ||
|
|
956
|
+
return ((schema.type === "object" && schema.properties !== undefined) ||
|
|
998
957
|
schema.type === "dictionary");
|
|
999
958
|
}
|
|
1000
959
|
export function isArrayType(schema) {
|
|
@@ -1025,97 +984,97 @@ function getSchemaForStdScalar(program, type, options) {
|
|
|
1025
984
|
return { type: "string", format: "bytes", description };
|
|
1026
985
|
case "integer":
|
|
1027
986
|
return applyIntrinsicDecorators(program, type, {
|
|
1028
|
-
type: "number"
|
|
987
|
+
type: "number",
|
|
1029
988
|
});
|
|
1030
989
|
case "int8":
|
|
1031
990
|
return applyIntrinsicDecorators(program, type, {
|
|
1032
991
|
type: "number",
|
|
1033
|
-
format: "int8"
|
|
992
|
+
format: "int8",
|
|
1034
993
|
});
|
|
1035
994
|
case "int16":
|
|
1036
995
|
return applyIntrinsicDecorators(program, type, {
|
|
1037
996
|
type: "number",
|
|
1038
|
-
format: "int16"
|
|
997
|
+
format: "int16",
|
|
1039
998
|
});
|
|
1040
999
|
case "int32":
|
|
1041
1000
|
return applyIntrinsicDecorators(program, type, {
|
|
1042
1001
|
type: "number",
|
|
1043
|
-
format: "int32"
|
|
1002
|
+
format: "int32",
|
|
1044
1003
|
});
|
|
1045
1004
|
case "int64":
|
|
1046
1005
|
return applyIntrinsicDecorators(program, type, {
|
|
1047
1006
|
type: "number",
|
|
1048
|
-
format: "int64"
|
|
1007
|
+
format: "int64",
|
|
1049
1008
|
});
|
|
1050
1009
|
case "safeint":
|
|
1051
1010
|
return applyIntrinsicDecorators(program, type, {
|
|
1052
1011
|
type: "number",
|
|
1053
|
-
format: "safeint"
|
|
1012
|
+
format: "safeint",
|
|
1054
1013
|
});
|
|
1055
1014
|
case "numeric":
|
|
1056
1015
|
return applyIntrinsicDecorators(program, type, {
|
|
1057
|
-
type: "number"
|
|
1016
|
+
type: "number",
|
|
1058
1017
|
});
|
|
1059
1018
|
case "uint8":
|
|
1060
1019
|
return applyIntrinsicDecorators(program, type, {
|
|
1061
1020
|
type: "number",
|
|
1062
|
-
format: "uint8"
|
|
1021
|
+
format: "uint8",
|
|
1063
1022
|
});
|
|
1064
1023
|
case "uint16":
|
|
1065
1024
|
return applyIntrinsicDecorators(program, type, {
|
|
1066
1025
|
type: "number",
|
|
1067
|
-
format: "uint16"
|
|
1026
|
+
format: "uint16",
|
|
1068
1027
|
});
|
|
1069
1028
|
case "uint32":
|
|
1070
1029
|
return applyIntrinsicDecorators(program, type, {
|
|
1071
1030
|
type: "number",
|
|
1072
|
-
format: "uint32"
|
|
1031
|
+
format: "uint32",
|
|
1073
1032
|
});
|
|
1074
1033
|
case "uint64":
|
|
1075
1034
|
return applyIntrinsicDecorators(program, type, {
|
|
1076
1035
|
type: "number",
|
|
1077
|
-
format: "uint64"
|
|
1036
|
+
format: "uint64",
|
|
1078
1037
|
});
|
|
1079
1038
|
case "float64":
|
|
1080
1039
|
return applyIntrinsicDecorators(program, type, {
|
|
1081
1040
|
type: "number",
|
|
1082
|
-
format: "float64"
|
|
1041
|
+
format: "float64",
|
|
1083
1042
|
});
|
|
1084
1043
|
case "float32":
|
|
1085
1044
|
return applyIntrinsicDecorators(program, type, {
|
|
1086
1045
|
type: "number",
|
|
1087
|
-
format: "float32"
|
|
1046
|
+
format: "float32",
|
|
1088
1047
|
});
|
|
1089
1048
|
case "float":
|
|
1090
1049
|
return applyIntrinsicDecorators(program, type, {
|
|
1091
1050
|
type: "number",
|
|
1092
|
-
format: "float"
|
|
1051
|
+
format: "float",
|
|
1093
1052
|
});
|
|
1094
1053
|
case "decimal":
|
|
1095
1054
|
reportDiagnostic(program, {
|
|
1096
1055
|
code: "decimal-to-number",
|
|
1097
1056
|
format: {
|
|
1098
|
-
propertyName: relevantProperty?.name ?? ""
|
|
1057
|
+
propertyName: relevantProperty?.name ?? "",
|
|
1099
1058
|
},
|
|
1100
|
-
target: relevantProperty ?? NoTarget
|
|
1059
|
+
target: relevantProperty ?? NoTarget,
|
|
1101
1060
|
});
|
|
1102
1061
|
return applyIntrinsicDecorators(program, type, {
|
|
1103
1062
|
type: "number",
|
|
1104
1063
|
format: "decimal",
|
|
1105
|
-
description: "decimal"
|
|
1064
|
+
description: "decimal",
|
|
1106
1065
|
});
|
|
1107
1066
|
case "decimal128":
|
|
1108
1067
|
reportDiagnostic(program, {
|
|
1109
1068
|
code: "decimal-to-number",
|
|
1110
1069
|
format: {
|
|
1111
|
-
propertyName: relevantProperty?.name ?? ""
|
|
1070
|
+
propertyName: relevantProperty?.name ?? "",
|
|
1112
1071
|
},
|
|
1113
|
-
target: relevantProperty ?? NoTarget
|
|
1072
|
+
target: relevantProperty ?? NoTarget,
|
|
1114
1073
|
});
|
|
1115
1074
|
return applyIntrinsicDecorators(program, type, {
|
|
1116
1075
|
type: "number",
|
|
1117
1076
|
format: "decimal128",
|
|
1118
|
-
description: "decimal128"
|
|
1077
|
+
description: "decimal128",
|
|
1119
1078
|
});
|
|
1120
1079
|
case "string":
|
|
1121
1080
|
if (format === "binary") {
|
|
@@ -1124,11 +1083,11 @@ function getSchemaForStdScalar(program, type, options) {
|
|
|
1124
1083
|
format: "binary",
|
|
1125
1084
|
description,
|
|
1126
1085
|
typeName: BINARY_TYPE_UNION,
|
|
1127
|
-
outputTypeName: "Uint8Array"
|
|
1086
|
+
outputTypeName: "Uint8Array",
|
|
1128
1087
|
};
|
|
1129
1088
|
}
|
|
1130
1089
|
return applyIntrinsicDecorators(program, type, {
|
|
1131
|
-
type: "string"
|
|
1090
|
+
type: "string",
|
|
1132
1091
|
});
|
|
1133
1092
|
case "boolean":
|
|
1134
1093
|
return { type: "boolean", description };
|
|
@@ -1138,7 +1097,7 @@ function getSchemaForStdScalar(program, type, options) {
|
|
|
1138
1097
|
format,
|
|
1139
1098
|
description,
|
|
1140
1099
|
typeName: "string",
|
|
1141
|
-
outputTypeName: "string"
|
|
1100
|
+
outputTypeName: "string",
|
|
1142
1101
|
};
|
|
1143
1102
|
case "utcDateTime":
|
|
1144
1103
|
return {
|
|
@@ -1146,7 +1105,7 @@ function getSchemaForStdScalar(program, type, options) {
|
|
|
1146
1105
|
format,
|
|
1147
1106
|
description,
|
|
1148
1107
|
typeName: "Date | string",
|
|
1149
|
-
outputTypeName: "string"
|
|
1108
|
+
outputTypeName: "string",
|
|
1150
1109
|
};
|
|
1151
1110
|
case "offsetDateTime":
|
|
1152
1111
|
return {
|
|
@@ -1154,7 +1113,7 @@ function getSchemaForStdScalar(program, type, options) {
|
|
|
1154
1113
|
format: "date-time",
|
|
1155
1114
|
description,
|
|
1156
1115
|
typeName: "string",
|
|
1157
|
-
outputTypeName: "string"
|
|
1116
|
+
outputTypeName: "string",
|
|
1158
1117
|
};
|
|
1159
1118
|
case "plainTime":
|
|
1160
1119
|
return {
|
|
@@ -1162,7 +1121,7 @@ function getSchemaForStdScalar(program, type, options) {
|
|
|
1162
1121
|
format: "time",
|
|
1163
1122
|
description,
|
|
1164
1123
|
typeName: "string",
|
|
1165
|
-
outputTypeName: "string"
|
|
1124
|
+
outputTypeName: "string",
|
|
1166
1125
|
};
|
|
1167
1126
|
case "duration":
|
|
1168
1127
|
return { type: "string", format, description };
|
|
@@ -1174,14 +1133,8 @@ function isEncodeTypeEffective(type, encodeData) {
|
|
|
1174
1133
|
if (!encodeData) {
|
|
1175
1134
|
return false;
|
|
1176
1135
|
}
|
|
1177
|
-
const datetimeTypes = [
|
|
1178
|
-
|
|
1179
|
-
"utcdatetime",
|
|
1180
|
-
"offsetdatetime",
|
|
1181
|
-
"plaintime"
|
|
1182
|
-
];
|
|
1183
|
-
if (datetimeTypes.includes(type.name.toLowerCase()) &&
|
|
1184
|
-
encodeData.type.name === "string") {
|
|
1136
|
+
const datetimeTypes = ["plaindate", "utcdatetime", "offsetdatetime", "plaintime"];
|
|
1137
|
+
if (datetimeTypes.includes(type.name.toLowerCase()) && encodeData.type.name === "string") {
|
|
1185
1138
|
return false;
|
|
1186
1139
|
}
|
|
1187
1140
|
return true;
|
|
@@ -1211,9 +1164,7 @@ export function getImportedModelName(schema, usage) {
|
|
|
1211
1164
|
}
|
|
1212
1165
|
return [...ret];
|
|
1213
1166
|
}
|
|
1214
|
-
return getPriorityName(schema, usage)
|
|
1215
|
-
? [getPriorityName(schema, usage)]
|
|
1216
|
-
: [];
|
|
1167
|
+
return getPriorityName(schema, usage) ? [getPriorityName(schema, usage)] : [];
|
|
1217
1168
|
}
|
|
1218
1169
|
case "dictionary": {
|
|
1219
1170
|
const ret = new Set();
|
|
@@ -1234,9 +1185,7 @@ export function getImportedModelName(schema, usage) {
|
|
|
1234
1185
|
}
|
|
1235
1186
|
}
|
|
1236
1187
|
function getPriorityName(schema, usage) {
|
|
1237
|
-
return usage &&
|
|
1238
|
-
usage.includes(SchemaContext.Input) &&
|
|
1239
|
-
!usage.includes(SchemaContext.Output)
|
|
1188
|
+
return usage && usage.includes(SchemaContext.Input) && !usage.includes(SchemaContext.Output)
|
|
1240
1189
|
? (schema.typeName ?? schema.name)
|
|
1241
1190
|
: (schema.outputTypeName ?? schema.typeName ?? schema.name);
|
|
1242
1191
|
}
|
|
@@ -1264,8 +1213,7 @@ function getBinaryDescription(type) {
|
|
|
1264
1213
|
return undefined;
|
|
1265
1214
|
}
|
|
1266
1215
|
function getDecimalDescription(type) {
|
|
1267
|
-
if ((type.format === "decimal" || type.format === "decimal128") &&
|
|
1268
|
-
type.type === "number") {
|
|
1216
|
+
if ((type.format === "decimal" || type.format === "decimal128") && type.type === "number") {
|
|
1269
1217
|
return `NOTE: This property is represented as a 'number' in JavaScript, but it corresponds to a 'decimal' type in other languages.
|
|
1270
1218
|
Due to the inherent limitations of floating-point arithmetic in JavaScript, precision issues may arise when performing arithmetic operations.
|
|
1271
1219
|
If your application requires high precision for arithmetic operations or when round-tripping data back to other languages, consider using a library like decimal.js, which provides an arbitrary-precision Decimal type.
|
|
@@ -1304,7 +1252,7 @@ export function getValueTypeValue(value) {
|
|
|
1304
1252
|
case "ObjectValue":
|
|
1305
1253
|
return Object.fromEntries([...value.properties.keys()].map((x) => [
|
|
1306
1254
|
x,
|
|
1307
|
-
getValueTypeValue(value.properties.get(x).value)
|
|
1255
|
+
getValueTypeValue(value.properties.get(x).value),
|
|
1308
1256
|
]));
|
|
1309
1257
|
default:
|
|
1310
1258
|
// TODO: handle scalar value
|
|
@@ -1325,17 +1273,15 @@ export function predictDefaultValue(dpgContext, param) {
|
|
|
1325
1273
|
return;
|
|
1326
1274
|
}
|
|
1327
1275
|
const program = dpgContext.program;
|
|
1328
|
-
const specificDefault = param.defaultValue
|
|
1329
|
-
? getValueTypeValue(param.defaultValue)
|
|
1330
|
-
: undefined;
|
|
1276
|
+
const specificDefault = param.defaultValue ? getValueTypeValue(param.defaultValue) : undefined;
|
|
1331
1277
|
if (specificDefault) {
|
|
1332
1278
|
if (typeof specificDefault === "object") {
|
|
1333
1279
|
reportDiagnostic(program, {
|
|
1334
1280
|
code: "default-value-object",
|
|
1335
1281
|
format: {
|
|
1336
|
-
propertyName: param.name
|
|
1282
|
+
propertyName: param.name,
|
|
1337
1283
|
},
|
|
1338
|
-
target: param
|
|
1284
|
+
target: param,
|
|
1339
1285
|
});
|
|
1340
1286
|
return specificDefault.toString();
|
|
1341
1287
|
}
|
|
@@ -1356,13 +1302,13 @@ export function getDefaultService(program, isModularLibrary = true) {
|
|
|
1356
1302
|
if (!services || services.length === 0) {
|
|
1357
1303
|
reportDiagnostic(program, {
|
|
1358
1304
|
code: "no-service-defined",
|
|
1359
|
-
target: NoTarget
|
|
1305
|
+
target: NoTarget,
|
|
1360
1306
|
});
|
|
1361
1307
|
}
|
|
1362
1308
|
if (services.length > 1 && !isModularLibrary) {
|
|
1363
1309
|
reportDiagnostic(program, {
|
|
1364
1310
|
code: "more-than-one-service",
|
|
1365
|
-
target: NoTarget
|
|
1311
|
+
target: NoTarget,
|
|
1366
1312
|
});
|
|
1367
1313
|
}
|
|
1368
1314
|
return services[0];
|
|
@@ -1404,10 +1350,7 @@ export function isAzureCoreErrorType(program, t) {
|
|
|
1404
1350
|
function isAzureCoreFoundationsNamespace(t, skipFoundation = false) {
|
|
1405
1351
|
const namespaces = (skipFoundation ? ".Azure.Core" : ".Azure.Core.Foundations").split(".");
|
|
1406
1352
|
while (namespaces.length > 0 &&
|
|
1407
|
-
(t?.kind === "Model" ||
|
|
1408
|
-
t?.kind === "Enum" ||
|
|
1409
|
-
t?.kind === "Union" ||
|
|
1410
|
-
t?.kind === "Namespace") &&
|
|
1353
|
+
(t?.kind === "Model" || t?.kind === "Enum" || t?.kind === "Union" || t?.kind === "Namespace") &&
|
|
1411
1354
|
t.namespace?.name === namespaces.pop()) {
|
|
1412
1355
|
t = t.namespace;
|
|
1413
1356
|
}
|
|
@@ -1497,11 +1440,7 @@ export function isSchemaProperty(program, property) {
|
|
|
1497
1440
|
const pathInfo = getPathParamName(program, property);
|
|
1498
1441
|
const statusCodeInfo = isStatusCode(program, property);
|
|
1499
1442
|
const isNonVisibility = getSdkVisibility(program, property)?.includes(Visibility.None);
|
|
1500
|
-
return !(headerInfo ||
|
|
1501
|
-
queryInfo ||
|
|
1502
|
-
pathInfo ||
|
|
1503
|
-
statusCodeInfo ||
|
|
1504
|
-
isNonVisibility);
|
|
1443
|
+
return !(headerInfo || queryInfo || pathInfo || statusCodeInfo || isNonVisibility);
|
|
1505
1444
|
}
|
|
1506
1445
|
export function getEffectiveSchemaType(program, type) {
|
|
1507
1446
|
// If type is an anonymous model, tries to find a named model that has the same properties
|
|
@@ -1526,9 +1465,7 @@ export function getEffectiveSchemaType(program, type) {
|
|
|
1526
1465
|
return type;
|
|
1527
1466
|
}
|
|
1528
1467
|
export function isBodyRequired(parameter) {
|
|
1529
|
-
return parameter.body?.type && parameter.body?.property?.optional !== true
|
|
1530
|
-
? true
|
|
1531
|
-
: false;
|
|
1468
|
+
return parameter.body?.type && parameter.body?.property?.optional !== true ? true : false;
|
|
1532
1469
|
}
|
|
1533
1470
|
export function getCollectionFormat(context, param) {
|
|
1534
1471
|
const type = param.param;
|