@azure-tools/typespec-ts 0.13.0 → 0.13.1-alpha.20230609.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 +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +37 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/modelUtils.d.ts +2 -0
- package/dist/src/modelUtils.d.ts.map +1 -1
- package/dist/src/modelUtils.js +82 -13
- package/dist/src/modelUtils.js.map +1 -1
- package/dist/src/modular/buildApiIndex.d.ts.map +1 -1
- package/dist/src/modular/buildApiIndex.js +1 -1
- package/dist/src/modular/buildApiIndex.js.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +6 -6
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +9 -3
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -1
- package/dist/src/modular/buildCodeModel.js +190 -169
- package/dist/src/modular/buildCodeModel.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +20 -2
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildRootIndex.js +2 -2
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSharedTypes.d.ts.map +1 -1
- package/dist/src/modular/buildSharedTypes.js +8 -10
- package/dist/src/modular/buildSharedTypes.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +19 -6
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +2 -11
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/credentialHelpers.js +1 -1
- package/dist/src/modular/helpers/credentialHelpers.js.map +1 -1
- package/dist/src/modular/helpers/fixmeHelpers.d.ts +2 -0
- package/dist/src/modular/helpers/fixmeHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/fixmeHelpers.js +4 -0
- package/dist/src/modular/helpers/fixmeHelpers.js.map +1 -0
- package/dist/src/modular/helpers/namingHelpers.d.ts +10 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +20 -0
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +2 -0
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +117 -35
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/parameterHelpers.js +1 -1
- package/dist/src/modular/helpers/parameterHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +31 -12
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/modularCodeModel.d.ts +2 -1
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -1
- package/dist/src/operationUtil.d.ts +1 -1
- package/dist/src/operationUtil.d.ts.map +1 -1
- package/dist/src/operationUtil.js +21 -3
- package/dist/src/operationUtil.js.map +1 -1
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +2 -2
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +9 -0
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +27 -1
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.d.ts +1 -0
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +36 -35
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +9 -0
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +10 -1
- 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 -0
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -15
- package/src/index.ts +47 -2
- package/src/modelUtils.ts +90 -15
- package/src/modular/buildApiIndex.ts +3 -1
- package/src/modular/buildClassicalClient.ts +8 -6
- package/src/modular/buildClientContext.ts +11 -3
- package/src/modular/buildCodeModel.ts +221 -196
- package/src/modular/buildOperations.ts +23 -1
- package/src/modular/buildRootIndex.ts +2 -2
- package/src/modular/buildSharedTypes.ts +8 -10
- package/src/modular/emitModels.ts +14 -0
- package/src/modular/helpers/clientHelpers.ts +3 -13
- package/src/modular/helpers/credentialHelpers.ts +1 -1
- package/src/modular/helpers/fixmeHelpers.ts +3 -0
- package/src/modular/helpers/namingHelpers.ts +35 -1
- package/src/modular/helpers/operationHelpers.ts +173 -66
- package/src/modular/helpers/parameterHelpers.ts +1 -1
- package/src/modular/helpers/typeHelpers.ts +33 -12
- package/src/modular/modularCodeModel.ts +3 -1
- package/src/operationUtil.ts +24 -3
- package/src/transform/transform.ts +4 -1
- package/src/transform/transformApiVersionInfo.ts +8 -0
- package/src/transform/transformHelperFunctionDetails.ts +25 -1
- package/src/transform/transformParameters.ts +52 -41
- package/src/transform/transformPaths.ts +8 -0
- package/src/transform/transformResponses.ts +9 -1
- package/src/transform/transformSchemas.ts +8 -0
- package/.eslintrc.json +0 -23
- package/.prettierignore +0 -1
- package/.prettierrc +0 -7
- package/.rush/temp/operation/build/all.log +0 -1
- package/.rush/temp/operation/build/state.json +0 -3
- package/.rush/temp/package-deps_build.json +0 -442
- package/.rush/temp/shrinkwrap-deps.json +0 -490
- package/CONTRIBUTING.md +0 -137
- package/test/commands/cadl-ranch-list.ts +0 -116
- package/test/commands/check-clean-tree.ts +0 -55
- package/test/commands/childProcessOnExit.ts +0 -16
- package/test/commands/gen-cadl-ranch.ts +0 -25
- package/test/commands/run.ts +0 -31
- package/test/integration/arrayItemTypes.spec.ts +0 -96
- package/test/integration/authApiKey.spec.ts +0 -38
- package/test/integration/authOauth2.spec.ts +0 -65
- package/test/integration/authUnion.spec.ts +0 -72
- package/test/integration/azurecore.spec.ts +0 -170
- package/test/integration/collectionFormat.spec.ts +0 -118
- package/test/integration/dictionary.spec.ts +0 -106
- package/test/integration/extensibleEnums.spec.ts +0 -61
- package/test/integration/fixedEnums.spec.ts +0 -52
- package/test/integration/generated/arrays/itemTypes/src/arrayItemTypesClient.ts +0 -35
- package/test/integration/generated/arrays/itemTypes/src/clientDefinitions.ts +0 -165
- package/test/integration/generated/arrays/itemTypes/src/index.ts +0 -13
- package/test/integration/generated/arrays/itemTypes/src/logger.ts +0 -5
- package/test/integration/generated/arrays/itemTypes/src/models.ts +0 -9
- package/test/integration/generated/arrays/itemTypes/src/outputModels.ts +0 -9
- package/test/integration/generated/arrays/itemTypes/src/parameters.ts +0 -86
- package/test/integration/generated/arrays/itemTypes/src/responses.ts +0 -115
- package/test/integration/generated/arrays/itemTypes/tspconfig.yaml +0 -15
- package/test/integration/generated/authentication/apiKey/.eslintrc.json +0 -11
- package/test/integration/generated/authentication/apiKey/README.md +0 -56
- package/test/integration/generated/authentication/apiKey/api-extractor.json +0 -18
- package/test/integration/generated/authentication/apiKey/karma.conf.js +0 -133
- package/test/integration/generated/authentication/apiKey/package.json +0 -103
- package/test/integration/generated/authentication/apiKey/rollup.config.js +0 -118
- package/test/integration/generated/authentication/apiKey/src/authApiKeyClient.ts +0 -45
- package/test/integration/generated/authentication/apiKey/src/clientDefinitions.ts +0 -33
- package/test/integration/generated/authentication/apiKey/src/index.ts +0 -12
- package/test/integration/generated/authentication/apiKey/src/logger.ts +0 -5
- package/test/integration/generated/authentication/apiKey/src/outputModels.ts +0 -6
- package/test/integration/generated/authentication/apiKey/src/parameters.ts +0 -7
- package/test/integration/generated/authentication/apiKey/src/responses.ts +0 -21
- package/test/integration/generated/authentication/apiKey/test/public/sampleTest.spec.ts +0 -23
- package/test/integration/generated/authentication/apiKey/test/public/utils/env.browser.ts +0 -2
- package/test/integration/generated/authentication/apiKey/test/public/utils/env.ts +0 -6
- package/test/integration/generated/authentication/apiKey/test/public/utils/recordedClient.ts +0 -29
- package/test/integration/generated/authentication/apiKey/tsconfig.json +0 -25
- package/test/integration/generated/authentication/apiKey/tspconfig.yaml +0 -13
- package/test/integration/generated/authentication/oauth2/karma.conf.js +0 -133
- package/test/integration/generated/authentication/oauth2/src/authOauth2Client.ts +0 -45
- package/test/integration/generated/authentication/oauth2/src/clientDefinitions.ts +0 -33
- package/test/integration/generated/authentication/oauth2/src/index.ts +0 -12
- package/test/integration/generated/authentication/oauth2/src/logger.ts +0 -5
- package/test/integration/generated/authentication/oauth2/src/outputModels.ts +0 -6
- package/test/integration/generated/authentication/oauth2/src/parameters.ts +0 -7
- package/test/integration/generated/authentication/oauth2/src/responses.ts +0 -21
- package/test/integration/generated/authentication/oauth2/test/public/sampleTest.spec.ts +0 -23
- package/test/integration/generated/authentication/oauth2/test/public/utils/env.browser.ts +0 -2
- package/test/integration/generated/authentication/oauth2/test/public/utils/env.ts +0 -6
- package/test/integration/generated/authentication/oauth2/test/public/utils/recordedClient.ts +0 -29
- package/test/integration/generated/authentication/oauth2/tspconfig.yaml +0 -15
- package/test/integration/generated/authentication/union/karma.conf.js +0 -133
- package/test/integration/generated/authentication/union/src/authUnionClient.ts +0 -46
- package/test/integration/generated/authentication/union/src/clientDefinitions.ts +0 -27
- package/test/integration/generated/authentication/union/src/index.ts +0 -11
- package/test/integration/generated/authentication/union/src/logger.ts +0 -5
- package/test/integration/generated/authentication/union/src/parameters.ts +0 -7
- package/test/integration/generated/authentication/union/src/responses.ts +0 -14
- package/test/integration/generated/authentication/union/test/public/sampleTest.spec.ts +0 -23
- package/test/integration/generated/authentication/union/test/public/utils/env.browser.ts +0 -2
- package/test/integration/generated/authentication/union/test/public/utils/env.ts +0 -6
- package/test/integration/generated/authentication/union/test/public/utils/recordedClient.ts +0 -29
- package/test/integration/generated/authentication/union/tspconfig.yaml +0 -15
- package/test/integration/generated/azure/core/.eslintrc.json +0 -11
- package/test/integration/generated/azure/core/README.md +0 -56
- package/test/integration/generated/azure/core/api-extractor.json +0 -18
- package/test/integration/generated/azure/core/package.json +0 -81
- package/test/integration/generated/azure/core/rollup.config.js +0 -118
- package/test/integration/generated/azure/core/src/azureCoreClient.ts +0 -35
- package/test/integration/generated/azure/core/src/clientDefinitions.ts +0 -108
- package/test/integration/generated/azure/core/src/index.ts +0 -16
- package/test/integration/generated/azure/core/src/isUnexpected.ts +0 -178
- package/test/integration/generated/azure/core/src/logger.ts +0 -5
- package/test/integration/generated/azure/core/src/models.ts +0 -18
- package/test/integration/generated/azure/core/src/outputModels.ts +0 -38
- package/test/integration/generated/azure/core/src/paginateHelper.ts +0 -204
- package/test/integration/generated/azure/core/src/parameters.ts +0 -68
- package/test/integration/generated/azure/core/src/responses.ts +0 -158
- package/test/integration/generated/azure/core/src/serializeHelper.ts +0 -16
- package/test/integration/generated/azure/core/tsconfig.json +0 -25
- package/test/integration/generated/azure/core/tspconfig.yaml +0 -15
- package/test/integration/generated/azure/core-traits/.eslintrc.json +0 -11
- package/test/integration/generated/azure/core-traits/README.md +0 -56
- package/test/integration/generated/azure/core-traits/api-extractor.json +0 -18
- package/test/integration/generated/azure/core-traits/package.json +0 -80
- package/test/integration/generated/azure/core-traits/rollup.config.js +0 -118
- package/test/integration/generated/azure/core-traits/src/azureCoreTraitsClient.ts +0 -35
- package/test/integration/generated/azure/core-traits/src/clientDefinitions.ts +0 -22
- package/test/integration/generated/azure/core-traits/src/index.ts +0 -13
- package/test/integration/generated/azure/core-traits/src/isUnexpected.ts +0 -97
- package/test/integration/generated/azure/core-traits/src/logger.ts +0 -5
- package/test/integration/generated/azure/core-traits/src/outputModels.ts +0 -25
- package/test/integration/generated/azure/core-traits/src/parameters.ts +0 -26
- package/test/integration/generated/azure/core-traits/src/responses.ts +0 -32
- package/test/integration/generated/azure/core-traits/tsconfig.json +0 -25
- package/test/integration/generated/azure/core-traits/tspconfig.yaml +0 -15
- package/test/integration/generated/dictionary/.eslintrc.json +0 -11
- package/test/integration/generated/dictionary/README.md +0 -56
- package/test/integration/generated/dictionary/api-extractor.json +0 -18
- package/test/integration/generated/dictionary/package.json +0 -80
- package/test/integration/generated/dictionary/rollup.config.js +0 -118
- package/test/integration/generated/dictionary/src/clientDefinitions.ts +0 -180
- package/test/integration/generated/dictionary/src/dictClient.ts +0 -33
- package/test/integration/generated/dictionary/src/index.ts +0 -13
- package/test/integration/generated/dictionary/src/logger.ts +0 -5
- package/test/integration/generated/dictionary/src/models.ts +0 -9
- package/test/integration/generated/dictionary/src/outputModels.ts +0 -9
- package/test/integration/generated/dictionary/src/parameters.ts +0 -94
- package/test/integration/generated/dictionary/src/responses.ts +0 -126
- package/test/integration/generated/dictionary/tsconfig.json +0 -25
- package/test/integration/generated/dictionary/tspconfig.yaml +0 -15
- package/test/integration/generated/enums/extensible/.eslintrc.json +0 -11
- package/test/integration/generated/enums/extensible/README.md +0 -56
- package/test/integration/generated/enums/extensible/api-extractor.json +0 -18
- package/test/integration/generated/enums/extensible/package.json +0 -80
- package/test/integration/generated/enums/extensible/rollup.config.js +0 -118
- package/test/integration/generated/enums/extensible/src/clientDefinitions.ts +0 -45
- package/test/integration/generated/enums/extensible/src/index.ts +0 -11
- package/test/integration/generated/enums/extensible/src/logger.ts +0 -5
- package/test/integration/generated/enums/extensible/src/parameters.ts +0 -23
- package/test/integration/generated/enums/extensible/src/responses.ts +0 -26
- package/test/integration/generated/enums/extensible/src/typeEnumExtensible.ts +0 -35
- package/test/integration/generated/enums/extensible/tsconfig.json +0 -25
- package/test/integration/generated/enums/extensible/tspconfig.yaml +0 -14
- package/test/integration/generated/enums/fixed/.eslintrc.json +0 -11
- package/test/integration/generated/enums/fixed/README.md +0 -56
- package/test/integration/generated/enums/fixed/api-extractor.json +0 -18
- package/test/integration/generated/enums/fixed/package.json +0 -80
- package/test/integration/generated/enums/fixed/rollup.config.js +0 -118
- package/test/integration/generated/enums/fixed/src/clientDefinitions.ts +0 -43
- package/test/integration/generated/enums/fixed/src/index.ts +0 -11
- package/test/integration/generated/enums/fixed/src/logger.ts +0 -5
- package/test/integration/generated/enums/fixed/src/parameters.ts +0 -36
- package/test/integration/generated/enums/fixed/src/responses.ts +0 -27
- package/test/integration/generated/enums/fixed/src/typeEnumFixed.ts +0 -35
- package/test/integration/generated/enums/fixed/tsconfig.json +0 -25
- package/test/integration/generated/enums/fixed/tspconfig.yaml +0 -14
- package/test/integration/generated/hello/.eslintrc.json +0 -11
- package/test/integration/generated/hello/README.md +0 -56
- package/test/integration/generated/hello/api-extractor.json +0 -18
- package/test/integration/generated/hello/package.json +0 -80
- package/test/integration/generated/hello/rollup.config.js +0 -118
- package/test/integration/generated/hello/src/clientDefinitions.ts +0 -19
- package/test/integration/generated/hello/src/hello.ts +0 -29
- package/test/integration/generated/hello/src/index.ts +0 -11
- package/test/integration/generated/hello/src/parameters.ts +0 -6
- package/test/integration/generated/hello/src/responses.ts +0 -10
- package/test/integration/generated/hello/tsconfig.json +0 -25
- package/test/integration/generated/hello/tspconfig.yaml +0 -14
- package/test/integration/generated/internal/src/clientDefinitions.ts +0 -53
- package/test/integration/generated/internal/src/index.ts +0 -12
- package/test/integration/generated/internal/src/internalClient.ts +0 -35
- package/test/integration/generated/internal/src/logger.ts +0 -5
- package/test/integration/generated/internal/src/outputModels.ts +0 -17
- package/test/integration/generated/internal/src/parameters.ts +0 -45
- package/test/integration/generated/internal/src/responses.ts +0 -33
- package/test/integration/generated/internal/tspconfig.yaml +0 -14
- package/test/integration/generated/lro/lroCore/.eslintrc.json +0 -11
- package/test/integration/generated/lro/lroCore/README.md +0 -56
- package/test/integration/generated/lro/lroCore/api-extractor.json +0 -18
- package/test/integration/generated/lro/lroCore/package.json +0 -82
- package/test/integration/generated/lro/lroCore/rollup.config.js +0 -118
- package/test/integration/generated/lro/lroCore/src/clientDefinitions.ts +0 -54
- package/test/integration/generated/lro/lroCore/src/index.ts +0 -15
- package/test/integration/generated/lro/lroCore/src/isUnexpected.ts +0 -135
- package/test/integration/generated/lro/lroCore/src/logger.ts +0 -5
- package/test/integration/generated/lro/lroCore/src/models.ts +0 -8
- package/test/integration/generated/lro/lroCore/src/outputModels.ts +0 -50
- package/test/integration/generated/lro/lroCore/src/parameters.ts +0 -25
- package/test/integration/generated/lro/lroCore/src/pollingHelper.ts +0 -113
- package/test/integration/generated/lro/lroCore/src/responses.ts +0 -109
- package/test/integration/generated/lro/lroCore/src/specsAzureCoreLroStandard.ts +0 -35
- package/test/integration/generated/lro/lroCore/tsconfig.json +0 -25
- package/test/integration/generated/lro/lroCore/tspconfig.yaml +0 -14
- package/test/integration/generated/lro/lroRPC/.eslintrc.json +0 -11
- package/test/integration/generated/lro/lroRPC/README.md +0 -56
- package/test/integration/generated/lro/lroRPC/api-extractor.json +0 -18
- package/test/integration/generated/lro/lroRPC/package.json +0 -82
- package/test/integration/generated/lro/lroRPC/rollup.config.js +0 -118
- package/test/integration/generated/lro/lroRPC/src/clientDefinitions.ts +0 -79
- package/test/integration/generated/lro/lroRPC/src/index.ts +0 -15
- package/test/integration/generated/lro/lroRPC/src/isUnexpected.ts +0 -153
- package/test/integration/generated/lro/lroRPC/src/logger.ts +0 -5
- package/test/integration/generated/lro/lroRPC/src/models.ts +0 -8
- package/test/integration/generated/lro/lroRPC/src/outputModels.ts +0 -40
- package/test/integration/generated/lro/lroRPC/src/parameters.ts +0 -20
- package/test/integration/generated/lro/lroRPC/src/pollingHelper.ts +0 -127
- package/test/integration/generated/lro/lroRPC/src/responses.ts +0 -124
- package/test/integration/generated/lro/lroRPC/src/specsAzureCoreLroRpc.ts +0 -35
- package/test/integration/generated/lro/lroRPC/tsconfig.json +0 -25
- package/test/integration/generated/lro/lroRPC/tspconfig.yaml +0 -14
- package/test/integration/generated/models/inheritance/.eslintrc.json +0 -11
- package/test/integration/generated/models/inheritance/README.md +0 -56
- package/test/integration/generated/models/inheritance/api-extractor.json +0 -18
- package/test/integration/generated/models/inheritance/package.json +0 -80
- package/test/integration/generated/models/inheritance/rollup.config.js +0 -118
- package/test/integration/generated/models/inheritance/src/clientDefinitions.ts +0 -81
- package/test/integration/generated/models/inheritance/src/index.ts +0 -13
- package/test/integration/generated/models/inheritance/src/logger.ts +0 -5
- package/test/integration/generated/models/inheritance/src/models.ts +0 -52
- package/test/integration/generated/models/inheritance/src/outputModels.ts +0 -52
- package/test/integration/generated/models/inheritance/src/parameters.ts +0 -35
- package/test/integration/generated/models/inheritance/src/responses.ts +0 -56
- package/test/integration/generated/models/inheritance/src/typeModelInheritance.ts +0 -35
- package/test/integration/generated/models/inheritance/tsconfig.json +0 -25
- package/test/integration/generated/models/inheritance/tspconfig.yaml +0 -14
- package/test/integration/generated/models/propertyNullable/.eslintrc.json +0 -11
- package/test/integration/generated/models/propertyNullable/README.md +0 -56
- package/test/integration/generated/models/propertyNullable/api-extractor.json +0 -18
- package/test/integration/generated/models/propertyNullable/package.json +0 -80
- package/test/integration/generated/models/propertyNullable/rollup.config.js +0 -118
- package/test/integration/generated/models/propertyNullable/src/clientDefinitions.ts +0 -227
- package/test/integration/generated/models/propertyNullable/src/index.ts +0 -13
- package/test/integration/generated/models/propertyNullable/src/logger.ts +0 -5
- package/test/integration/generated/models/propertyNullable/src/models.ts +0 -56
- package/test/integration/generated/models/propertyNullable/src/outputModels.ts +0 -56
- package/test/integration/generated/models/propertyNullable/src/parameters.ts +0 -197
- package/test/integration/generated/models/propertyNullable/src/responses.ts +0 -144
- package/test/integration/generated/models/propertyNullable/src/typePropertyNullable.ts +0 -35
- package/test/integration/generated/models/propertyNullable/tsconfig.json +0 -25
- package/test/integration/generated/models/propertyNullable/tspconfig.yaml +0 -14
- package/test/integration/generated/models/propertyOptional/.eslintrc.json +0 -11
- package/test/integration/generated/models/propertyOptional/README.md +0 -56
- package/test/integration/generated/models/propertyOptional/api-extractor.json +0 -18
- package/test/integration/generated/models/propertyOptional/package.json +0 -80
- package/test/integration/generated/models/propertyOptional/rollup.config.js +0 -118
- package/test/integration/generated/models/propertyOptional/src/clientDefinitions.ts +0 -263
- package/test/integration/generated/models/propertyOptional/src/index.ts +0 -13
- package/test/integration/generated/models/propertyOptional/src/logger.ts +0 -5
- package/test/integration/generated/models/propertyOptional/src/models.ts +0 -46
- package/test/integration/generated/models/propertyOptional/src/outputModels.ts +0 -46
- package/test/integration/generated/models/propertyOptional/src/parameters.ts +0 -125
- package/test/integration/generated/models/propertyOptional/src/responses.ts +0 -169
- package/test/integration/generated/models/propertyOptional/src/typePropertyOptional.ts +0 -35
- package/test/integration/generated/models/propertyOptional/tsconfig.json +0 -25
- package/test/integration/generated/models/propertyOptional/tspconfig.yaml +0 -14
- package/test/integration/generated/models/propertyTypes/.eslintrc.json +0 -11
- package/test/integration/generated/models/propertyTypes/README.md +0 -56
- package/test/integration/generated/models/propertyTypes/api-extractor.json +0 -18
- package/test/integration/generated/models/propertyTypes/package.json +0 -80
- package/test/integration/generated/models/propertyTypes/rollup.config.js +0 -118
- package/test/integration/generated/models/propertyTypes/src/clientDefinitions.ts +0 -310
- package/test/integration/generated/models/propertyTypes/src/index.ts +0 -13
- package/test/integration/generated/models/propertyTypes/src/logger.ts +0 -5
- package/test/integration/generated/models/propertyTypes/src/models.ts +0 -123
- package/test/integration/generated/models/propertyTypes/src/outputModels.ts +0 -123
- package/test/integration/generated/models/propertyTypes/src/parameters.ts +0 -189
- package/test/integration/generated/models/propertyTypes/src/responses.ts +0 -234
- package/test/integration/generated/models/propertyTypes/src/typePropertyValueTypes.ts +0 -35
- package/test/integration/generated/models/propertyTypes/tsconfig.json +0 -25
- package/test/integration/generated/models/propertyTypes/tspconfig.yaml +0 -14
- package/test/integration/generated/models/usage/.eslintrc.json +0 -11
- package/test/integration/generated/models/usage/README.md +0 -56
- package/test/integration/generated/models/usage/api-extractor.json +0 -18
- package/test/integration/generated/models/usage/package.json +0 -80
- package/test/integration/generated/models/usage/rollup.config.js +0 -118
- package/test/integration/generated/models/usage/src/clientDefinitions.ts +0 -41
- package/test/integration/generated/models/usage/src/index.ts +0 -13
- package/test/integration/generated/models/usage/src/logger.ts +0 -5
- package/test/integration/generated/models/usage/src/models.ts +0 -12
- package/test/integration/generated/models/usage/src/outputModels.ts +0 -12
- package/test/integration/generated/models/usage/src/parameters.ts +0 -19
- package/test/integration/generated/models/usage/src/responses.ts +0 -22
- package/test/integration/generated/models/usage/src/typeModelUsage.ts +0 -35
- package/test/integration/generated/models/usage/tsconfig.json +0 -25
- package/test/integration/generated/models/usage/tspconfig.yaml +0 -14
- package/test/integration/generated/models/visibility/.eslintrc.json +0 -11
- package/test/integration/generated/models/visibility/README.md +0 -56
- package/test/integration/generated/models/visibility/api-extractor.json +0 -18
- package/test/integration/generated/models/visibility/package.json +0 -80
- package/test/integration/generated/models/visibility/rollup.config.js +0 -118
- package/test/integration/generated/models/visibility/src/clientDefinitions.ts +0 -40
- package/test/integration/generated/models/visibility/src/index.ts +0 -13
- package/test/integration/generated/models/visibility/src/logger.ts +0 -5
- package/test/integration/generated/models/visibility/src/models.ts +0 -14
- package/test/integration/generated/models/visibility/src/outputModels.ts +0 -16
- package/test/integration/generated/models/visibility/src/parameters.ts +0 -41
- package/test/integration/generated/models/visibility/src/responses.ts +0 -36
- package/test/integration/generated/models/visibility/src/typeModelVisibility.ts +0 -35
- package/test/integration/generated/models/visibility/tsconfig.json +0 -25
- package/test/integration/generated/models/visibility/tspconfig.yaml +0 -14
- package/test/integration/generated/parameters/collection-format/src/clientDefinitions.ts +0 -63
- package/test/integration/generated/parameters/collection-format/src/collectionFormatClient.ts +0 -35
- package/test/integration/generated/parameters/collection-format/src/index.ts +0 -12
- package/test/integration/generated/parameters/collection-format/src/logger.ts +0 -5
- package/test/integration/generated/parameters/collection-format/src/parameters.ts +0 -71
- package/test/integration/generated/parameters/collection-format/src/responses.ts +0 -34
- package/test/integration/generated/parameters/collection-format/src/serializeHelper.ts +0 -28
- package/test/integration/generated/parameters/collection-format/tspconfig.yaml +0 -14
- package/test/integration/generated/parameters/spread/src/clientDefinitions.ts +0 -61
- package/test/integration/generated/parameters/spread/src/index.ts +0 -12
- package/test/integration/generated/parameters/spread/src/logger.ts +0 -5
- package/test/integration/generated/parameters/spread/src/models.ts +0 -7
- package/test/integration/generated/parameters/spread/src/parameters.ts +0 -61
- package/test/integration/generated/parameters/spread/src/parametersSpread.ts +0 -35
- package/test/integration/generated/parameters/spread/src/responses.ts +0 -25
- package/test/integration/generated/parameters/spread/tspconfig.yaml +0 -12
- package/test/integration/generated/projection/src/clientDefinitions.ts +0 -71
- package/test/integration/generated/projection/src/index.ts +0 -12
- package/test/integration/generated/projection/src/logger.ts +0 -5
- package/test/integration/generated/projection/src/models.ts +0 -22
- package/test/integration/generated/projection/src/parameters.ts +0 -48
- package/test/integration/generated/projection/src/projectionClient.ts +0 -35
- package/test/integration/generated/projection/src/responses.ts +0 -34
- package/test/integration/generated/projection/tspconfig.yaml +0 -14
- package/test/integration/generated/resiliency/srvDriven1/.eslintrc.json +0 -11
- package/test/integration/generated/resiliency/srvDriven1/README.md +0 -56
- package/test/integration/generated/resiliency/srvDriven1/api-extractor.json +0 -18
- package/test/integration/generated/resiliency/srvDriven1/package.json +0 -80
- package/test/integration/generated/resiliency/srvDriven1/rollup.config.js +0 -118
- package/test/integration/generated/resiliency/srvDriven1/src/clientDefinitions.ts +0 -46
- package/test/integration/generated/resiliency/srvDriven1/src/index.ts +0 -11
- package/test/integration/generated/resiliency/srvDriven1/src/logger.ts +0 -5
- package/test/integration/generated/resiliency/srvDriven1/src/parameters.ts +0 -30
- package/test/integration/generated/resiliency/srvDriven1/src/responses.ts +0 -19
- package/test/integration/generated/resiliency/srvDriven1/src/serviceDrivenOldClient.ts +0 -43
- package/test/integration/generated/resiliency/srvDriven1/tsconfig.json +0 -25
- package/test/integration/generated/resiliency/srvDriven1/tspconfig.yaml +0 -15
- package/test/integration/generated/resiliency/srvDriven2/.eslintrc.json +0 -11
- package/test/integration/generated/resiliency/srvDriven2/README.md +0 -65
- package/test/integration/generated/resiliency/srvDriven2/api-extractor.json +0 -18
- package/test/integration/generated/resiliency/srvDriven2/package.json +0 -80
- package/test/integration/generated/resiliency/srvDriven2/rollup.config.js +0 -118
- package/test/integration/generated/resiliency/srvDriven2/src/clientDefinitions.ts +0 -57
- package/test/integration/generated/resiliency/srvDriven2/src/index.ts +0 -11
- package/test/integration/generated/resiliency/srvDriven2/src/logger.ts +0 -5
- package/test/integration/generated/resiliency/srvDriven2/src/parameters.ts +0 -45
- package/test/integration/generated/resiliency/srvDriven2/src/responses.ts +0 -24
- package/test/integration/generated/resiliency/srvDriven2/src/serviceDrivenNewClient.ts +0 -43
- package/test/integration/generated/resiliency/srvDriven2/tsconfig.json +0 -25
- package/test/integration/generated/resiliency/srvDriven2/tspconfig.yaml +0 -15
- package/test/integration/generated/server/path/multiple/src/clientDefinitions.ts +0 -35
- package/test/integration/generated/server/path/multiple/src/index.ts +0 -11
- package/test/integration/generated/server/path/multiple/src/logger.ts +0 -5
- package/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts +0 -43
- package/test/integration/generated/server/path/multiple/src/parameters.ts +0 -7
- package/test/integration/generated/server/path/multiple/src/responses.ts +0 -14
- package/test/integration/generated/server/path/multiple/tspconfig.yaml +0 -14
- package/test/integration/generated/server/path/single/src/clientDefinitions.ts +0 -19
- package/test/integration/generated/server/path/single/src/index.ts +0 -11
- package/test/integration/generated/server/path/single/src/logger.ts +0 -5
- package/test/integration/generated/server/path/single/src/parameters.ts +0 -6
- package/test/integration/generated/server/path/single/src/responses.ts +0 -9
- package/test/integration/generated/server/path/single/src/singleParamInServerPathClient.ts +0 -38
- package/test/integration/generated/server/path/single/tspconfig.yaml +0 -14
- package/test/integration/generated/specialWords/src/clientDefinitions.ts +0 -61
- package/test/integration/generated/specialWords/src/index.ts +0 -13
- package/test/integration/generated/specialWords/src/logger.ts +0 -5
- package/test/integration/generated/specialWords/src/models.ts +0 -17
- package/test/integration/generated/specialWords/src/outputModels.ts +0 -17
- package/test/integration/generated/specialWords/src/parameters.ts +0 -37
- package/test/integration/generated/specialWords/src/responses.ts +0 -31
- package/test/integration/generated/specialWords/src/specialWordsClient.ts +0 -35
- package/test/integration/generated/specialWords/tspconfig.yaml +0 -14
- package/test/integration/generated/unions/src/clientDefinitions.ts +0 -53
- package/test/integration/generated/unions/src/index.ts +0 -12
- package/test/integration/generated/unions/src/logger.ts +0 -5
- package/test/integration/generated/unions/src/models.ts +0 -27
- package/test/integration/generated/unions/src/parameters.ts +0 -34
- package/test/integration/generated/unions/src/responses.ts +0 -24
- package/test/integration/generated/unions/src/unionsClient.ts +0 -35
- package/test/integration/generated/unions/tspconfig.yaml +0 -14
- package/test/integration/internal.spec.ts +0 -76
- package/test/integration/lroCore.spec.ts +0 -89
- package/test/integration/modelInheritance.spec.ts +0 -192
- package/test/integration/modelPropertyNullable.spec.ts +0 -115
- package/test/integration/modelPropertyOptional.spec.ts +0 -362
- package/test/integration/modelPropertyType.spec.ts +0 -135
- package/test/integration/modelUsage.spec.ts +0 -47
- package/test/integration/projection.spec.ts +0 -102
- package/test/integration/resiliencyDpgCustomization.spec.ts +0 -147
- package/test/integration/server.spec.ts +0 -59
- package/test/integration/specialWords.spec.ts +0 -73
- package/test/integration/spreadParameters.spec.ts +0 -82
- package/test/integration/unions.spec.ts +0 -69
- package/test/tsconfig.json +0 -4
- package/test/unit/apiVersion.spec.ts +0 -400
- package/test/unit/azureCoreOperationsGenerator.spec.ts +0 -71
- package/test/unit/clientDefinitionGenerator.spec.ts +0 -73
- package/test/unit/clientFactoryGenerator.spec.ts +0 -404
- package/test/unit/docsGenerator.spec.ts +0 -201
- package/test/unit/modelsGenerator.spec.ts +0 -1529
- package/test/unit/parametersGenerator.spec.ts +0 -561
- package/test/unit/responsesGenerator.spec.ts +0 -462
- package/test/unit/spreadAndAlias.spec.ts +0 -200
- package/test/unit/util/emitUtil.ts +0 -166
- package/test/unit/util/testUtil.ts +0 -88
- package/test/util/customBearerTokenTestingPolicy.ts +0 -78
- package/test/util/matrix.ts +0 -48
- package/tsconfig.json +0 -36
- package/tsconfig.test.json +0 -7
- package/typespec-ts.build.log +0 -1
|
@@ -1,561 +0,0 @@
|
|
|
1
|
-
import { assert } from "chai";
|
|
2
|
-
import { emitParameterFromCadl } from "./util/emitUtil.js";
|
|
3
|
-
import { assertEqualContent } from "./util/testUtil.js";
|
|
4
|
-
|
|
5
|
-
describe("Parameters.ts", () => {
|
|
6
|
-
describe("handle query apiVersion", () => {
|
|
7
|
-
it("should't generate apiVersion if there's a client level apiVersion", async () => {
|
|
8
|
-
const parameters = await emitParameterFromCadl(
|
|
9
|
-
`
|
|
10
|
-
model ApiVersionParameter {
|
|
11
|
-
@query
|
|
12
|
-
"api-version": string;
|
|
13
|
-
}
|
|
14
|
-
op test(...ApiVersionParameter): string;
|
|
15
|
-
`
|
|
16
|
-
);
|
|
17
|
-
assert.ok(parameters);
|
|
18
|
-
assertEqualContent(
|
|
19
|
-
parameters?.content!,
|
|
20
|
-
`
|
|
21
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
22
|
-
|
|
23
|
-
export type TestParameters = RequestParameters;
|
|
24
|
-
`
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("should generate apiVersion if there's no client level apiVersion", async () => {
|
|
29
|
-
const parameters = await emitParameterFromCadl(
|
|
30
|
-
`
|
|
31
|
-
model ApiVersionParameter {
|
|
32
|
-
@query
|
|
33
|
-
"api-version": string;
|
|
34
|
-
}
|
|
35
|
-
op test(...ApiVersionParameter): string;
|
|
36
|
-
`,
|
|
37
|
-
false,
|
|
38
|
-
true
|
|
39
|
-
);
|
|
40
|
-
assert.ok(parameters);
|
|
41
|
-
assertEqualContent(
|
|
42
|
-
parameters?.content!,
|
|
43
|
-
`
|
|
44
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
45
|
-
|
|
46
|
-
export interface TestQueryParamProperties {
|
|
47
|
-
"api-version": string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface TestQueryParam {
|
|
51
|
-
queryParameters: TestQueryParamProperties;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type TestParameters = TestQueryParam & RequestParameters;
|
|
55
|
-
`
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe("query parameters generation", () => {
|
|
61
|
-
it("should generate user-custom-query ", async () => {
|
|
62
|
-
const parameters = await emitParameterFromCadl(
|
|
63
|
-
`
|
|
64
|
-
model CustomParameter {
|
|
65
|
-
@query
|
|
66
|
-
"user-custom-query": string;
|
|
67
|
-
}
|
|
68
|
-
op test(...CustomParameter): string;
|
|
69
|
-
`
|
|
70
|
-
);
|
|
71
|
-
assert.ok(parameters);
|
|
72
|
-
assertEqualContent(
|
|
73
|
-
parameters?.content!,
|
|
74
|
-
`
|
|
75
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
76
|
-
|
|
77
|
-
export interface TestQueryParamProperties {
|
|
78
|
-
"user-custom-query": string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface TestQueryParam {
|
|
82
|
-
queryParameters: TestQueryParamProperties;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type TestParameters = TestQueryParam & RequestParameters;
|
|
86
|
-
`
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe("binary request generation", () => {
|
|
92
|
-
it("bytes request with application/json will be treated as string", async () => {
|
|
93
|
-
const parameters = await emitParameterFromCadl(
|
|
94
|
-
`
|
|
95
|
-
@post op read(@body body: bytes): {};
|
|
96
|
-
`
|
|
97
|
-
);
|
|
98
|
-
assert.ok(parameters);
|
|
99
|
-
assertEqualContent(
|
|
100
|
-
parameters?.content!,
|
|
101
|
-
`import { RequestParameters } from "@azure-rest/core-client";
|
|
102
|
-
|
|
103
|
-
export interface ReadBodyParam {
|
|
104
|
-
body: string;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
108
|
-
`
|
|
109
|
-
);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("bytes request should respect @header contentType and use binary format when not json or text", async () => {
|
|
113
|
-
const parameters = await emitParameterFromCadl(
|
|
114
|
-
`
|
|
115
|
-
@post op read(@header contentType: "image/png", @body body: bytes): {};
|
|
116
|
-
`
|
|
117
|
-
);
|
|
118
|
-
assert.ok(parameters);
|
|
119
|
-
assertEqualContent(
|
|
120
|
-
parameters?.content!,
|
|
121
|
-
`
|
|
122
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
123
|
-
|
|
124
|
-
export interface ReadBodyParam {
|
|
125
|
-
/** Value may contain any sequence of octets */
|
|
126
|
-
body:
|
|
127
|
-
| string
|
|
128
|
-
| Uint8Array
|
|
129
|
-
| ReadableStream<Uint8Array>
|
|
130
|
-
| NodeJS.ReadableStream;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface ReadMediaTypesParam {
|
|
134
|
-
contentType: "image/png";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export type ReadParameters = ReadMediaTypesParam &
|
|
138
|
-
ReadBodyParam &
|
|
139
|
-
RequestParameters;
|
|
140
|
-
`
|
|
141
|
-
);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// TODO: we need more discussions about current behavior
|
|
145
|
-
// issue tracked https://github.com/Azure/autorest.typescript/issues/1486
|
|
146
|
-
it("multiple contentTypes defined @header", async () => {
|
|
147
|
-
const parameters = await emitParameterFromCadl(
|
|
148
|
-
`
|
|
149
|
-
@post op read(@header contentType: "image/png" | "application/json", @body body: bytes): {};
|
|
150
|
-
`
|
|
151
|
-
);
|
|
152
|
-
assert.ok(parameters);
|
|
153
|
-
assertEqualContent(
|
|
154
|
-
parameters?.content!,
|
|
155
|
-
`
|
|
156
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
157
|
-
|
|
158
|
-
export interface ReadBodyParam {
|
|
159
|
-
/** Value may contain any sequence of octets */
|
|
160
|
-
body:
|
|
161
|
-
| string
|
|
162
|
-
| Uint8Array
|
|
163
|
-
| ReadableStream<Uint8Array>
|
|
164
|
-
| NodeJS.ReadableStream;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface ReadMediaTypesParam {
|
|
168
|
-
contentType: "image/png" | "application/json";
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export type ReadParameters = ReadMediaTypesParam &
|
|
172
|
-
ReadBodyParam &
|
|
173
|
-
RequestParameters;
|
|
174
|
-
`
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it("contentTypes has binary data", async () => {
|
|
179
|
-
const parameters = await emitParameterFromCadl(
|
|
180
|
-
`
|
|
181
|
-
@route("/uploadFileViaBody")
|
|
182
|
-
@post op uploadFileViaBody(
|
|
183
|
-
@header contentType: "application/octet-stream",
|
|
184
|
-
@body body: bytes
|
|
185
|
-
): void;
|
|
186
|
-
`
|
|
187
|
-
);
|
|
188
|
-
assert.ok(parameters);
|
|
189
|
-
assertEqualContent(
|
|
190
|
-
parameters?.content!,
|
|
191
|
-
`
|
|
192
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
193
|
-
|
|
194
|
-
export interface UploadFileViaBodyBodyParam {
|
|
195
|
-
/** Value may contain any sequence of octets */
|
|
196
|
-
body:
|
|
197
|
-
| string
|
|
198
|
-
| Uint8Array
|
|
199
|
-
| ReadableStream<Uint8Array>
|
|
200
|
-
| NodeJS.ReadableStream;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface UploadFileViaBodyMediaTypesParam {
|
|
204
|
-
contentType: "application/octet-stream";
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export type UploadFileViaBodyParameters = UploadFileViaBodyMediaTypesParam &
|
|
208
|
-
UploadFileViaBodyBodyParam &
|
|
209
|
-
RequestParameters;
|
|
210
|
-
`
|
|
211
|
-
);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it("contentTypes has multiple form data", async () => {
|
|
215
|
-
const parameters = await emitParameterFromCadl(
|
|
216
|
-
`
|
|
217
|
-
@route("/uploadFile")
|
|
218
|
-
@post op uploadFile(
|
|
219
|
-
@header contentType: "multipart/form-data",
|
|
220
|
-
@body body: {
|
|
221
|
-
name: string;
|
|
222
|
-
file: bytes;
|
|
223
|
-
}
|
|
224
|
-
): void;
|
|
225
|
-
`
|
|
226
|
-
);
|
|
227
|
-
assert.ok(parameters);
|
|
228
|
-
assertEqualContent(
|
|
229
|
-
parameters?.content!,
|
|
230
|
-
`
|
|
231
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
232
|
-
|
|
233
|
-
export interface UploadFileBodyParam {
|
|
234
|
-
body: UploadFileFormBody;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface UploadFileFormBody {
|
|
238
|
-
name: string;
|
|
239
|
-
file:
|
|
240
|
-
| string
|
|
241
|
-
| Uint8Array
|
|
242
|
-
| ReadableStream<Uint8Array>
|
|
243
|
-
| NodeJS.ReadableStream;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export interface UploadFileMediaTypesParam {
|
|
247
|
-
contentType: "multipart/form-data";
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export type UploadFileParameters = UploadFileMediaTypesParam &
|
|
251
|
-
UploadFileBodyParam &
|
|
252
|
-
RequestParameters;
|
|
253
|
-
`
|
|
254
|
-
);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it("contentTypes has array data defined in form body", async () => {
|
|
258
|
-
const parameters = await emitParameterFromCadl(
|
|
259
|
-
`
|
|
260
|
-
@route("/uploadFiles")
|
|
261
|
-
@post op uploadFiles(
|
|
262
|
-
@header contentType: "multipart/form-data",
|
|
263
|
-
@body body: {
|
|
264
|
-
files: bytes[];
|
|
265
|
-
}
|
|
266
|
-
): void;
|
|
267
|
-
`
|
|
268
|
-
);
|
|
269
|
-
assert.ok(parameters);
|
|
270
|
-
assertEqualContent(
|
|
271
|
-
parameters?.content!,
|
|
272
|
-
`
|
|
273
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
274
|
-
|
|
275
|
-
export interface UploadFilesBodyParam {
|
|
276
|
-
body: UploadFilesFormBody;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export interface UploadFilesFormBody {
|
|
280
|
-
files: Array<
|
|
281
|
-
string | Uint8Array | ReadableStream<Uint8Array> | NodeJS.ReadableStream
|
|
282
|
-
>;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
export interface UploadFilesMediaTypesParam {
|
|
286
|
-
contentType: "multipart/form-data";
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export type UploadFilesParameters = UploadFilesMediaTypesParam &
|
|
290
|
-
UploadFilesBodyParam &
|
|
291
|
-
RequestParameters;
|
|
292
|
-
`
|
|
293
|
-
);
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
describe("Array in body generation", () => {
|
|
298
|
-
it("unknown array request generation", async () => {
|
|
299
|
-
const parameters = await emitParameterFromCadl(`
|
|
300
|
-
@post op read(@body body: unknown[]): void;
|
|
301
|
-
`);
|
|
302
|
-
assert.ok(parameters);
|
|
303
|
-
assertEqualContent(
|
|
304
|
-
parameters?.content!,
|
|
305
|
-
`
|
|
306
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
307
|
-
|
|
308
|
-
export interface ReadBodyParam {
|
|
309
|
-
body:unknown[];
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
313
|
-
`
|
|
314
|
-
);
|
|
315
|
-
});
|
|
316
|
-
it("string array request generation", async () => {
|
|
317
|
-
const parameters = await emitParameterFromCadl(`
|
|
318
|
-
@post op read(@body body: string[]): void;
|
|
319
|
-
`);
|
|
320
|
-
assert.ok(parameters);
|
|
321
|
-
assertEqualContent(
|
|
322
|
-
parameters?.content!,
|
|
323
|
-
`
|
|
324
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
325
|
-
|
|
326
|
-
export interface ReadBodyParam {
|
|
327
|
-
body:string[];
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
331
|
-
`
|
|
332
|
-
);
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
it("int32 array request generation", async () => {
|
|
336
|
-
const parameters = await emitParameterFromCadl(`
|
|
337
|
-
@post op read(@body body: int32[]): void ;
|
|
338
|
-
`);
|
|
339
|
-
assert.ok(parameters);
|
|
340
|
-
assertEqualContent(
|
|
341
|
-
parameters?.content!,
|
|
342
|
-
`
|
|
343
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
344
|
-
|
|
345
|
-
export interface ReadBodyParam {
|
|
346
|
-
body:number[];
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
350
|
-
`
|
|
351
|
-
);
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
it("int64 array request generation", async () => {
|
|
355
|
-
const parameters = await emitParameterFromCadl(`
|
|
356
|
-
@post op read(@body body: int64[]): void ;
|
|
357
|
-
`);
|
|
358
|
-
assert.ok(parameters);
|
|
359
|
-
assertEqualContent(
|
|
360
|
-
parameters?.content!,
|
|
361
|
-
`
|
|
362
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
363
|
-
|
|
364
|
-
export interface ReadBodyParam {
|
|
365
|
-
body:number[];
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
369
|
-
`
|
|
370
|
-
);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
it("float32 array request generation", async () => {
|
|
374
|
-
const parameters = await emitParameterFromCadl(`
|
|
375
|
-
@post op read(@body body: float32[]): void ;
|
|
376
|
-
`);
|
|
377
|
-
assert.ok(parameters);
|
|
378
|
-
assertEqualContent(
|
|
379
|
-
parameters?.content!,
|
|
380
|
-
`
|
|
381
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
382
|
-
|
|
383
|
-
export interface ReadBodyParam {
|
|
384
|
-
body:number[];
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
388
|
-
`
|
|
389
|
-
);
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
it("boolean array request generation", async () => {
|
|
393
|
-
const parameters = await emitParameterFromCadl(`
|
|
394
|
-
@post op read(@body body: boolean[]): void ;
|
|
395
|
-
`);
|
|
396
|
-
assert.ok(parameters);
|
|
397
|
-
assertEqualContent(
|
|
398
|
-
parameters?.content!,
|
|
399
|
-
`
|
|
400
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
401
|
-
|
|
402
|
-
export interface ReadBodyParam {
|
|
403
|
-
body:boolean[];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
407
|
-
`
|
|
408
|
-
);
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
it("bytes array request generation", async () => {
|
|
412
|
-
const parameters = await emitParameterFromCadl(`
|
|
413
|
-
@post op read(@body body: bytes[]): void ;
|
|
414
|
-
`);
|
|
415
|
-
assert.ok(parameters);
|
|
416
|
-
assertEqualContent(
|
|
417
|
-
parameters?.content!,
|
|
418
|
-
`
|
|
419
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
420
|
-
|
|
421
|
-
export interface ReadBodyParam {
|
|
422
|
-
body:string[];
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
426
|
-
`
|
|
427
|
-
);
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
it("plainDate array request generation", async () => {
|
|
431
|
-
const parameters = await emitParameterFromCadl(`
|
|
432
|
-
@post op read(@body body: plainDate[]): void;
|
|
433
|
-
`);
|
|
434
|
-
assert.ok(parameters);
|
|
435
|
-
assertEqualContent(
|
|
436
|
-
parameters?.content!,
|
|
437
|
-
`
|
|
438
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
439
|
-
|
|
440
|
-
export interface ReadBodyParam {
|
|
441
|
-
body: Date[] | string[];
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
445
|
-
`
|
|
446
|
-
);
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
it("datetime array request generation", async () => {
|
|
450
|
-
const parameters = await emitParameterFromCadl(`
|
|
451
|
-
@post op read(@body body: utcDateTime[]): void;
|
|
452
|
-
`);
|
|
453
|
-
assert.ok(parameters);
|
|
454
|
-
assertEqualContent(
|
|
455
|
-
parameters?.content!,
|
|
456
|
-
`
|
|
457
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
458
|
-
|
|
459
|
-
export interface ReadBodyParam {
|
|
460
|
-
body: Date[] | string[];
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
464
|
-
`
|
|
465
|
-
);
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
it("duration array request generation", async () => {
|
|
469
|
-
const parameters = await emitParameterFromCadl(`
|
|
470
|
-
@post op read(@body body: duration[]): void;
|
|
471
|
-
`);
|
|
472
|
-
assert.ok(parameters);
|
|
473
|
-
assertEqualContent(
|
|
474
|
-
parameters?.content!,
|
|
475
|
-
`
|
|
476
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
477
|
-
|
|
478
|
-
export interface ReadBodyParam {
|
|
479
|
-
body:string[];
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
483
|
-
`
|
|
484
|
-
);
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
it("SimpleModel array request generation", async () => {
|
|
488
|
-
const parameters = await emitParameterFromCadl(`
|
|
489
|
-
model SimpleModel {
|
|
490
|
-
prop1: string;
|
|
491
|
-
prop2: int32;
|
|
492
|
-
}
|
|
493
|
-
@post op read(@body body: SimpleModel[]): void;
|
|
494
|
-
`);
|
|
495
|
-
assert.ok(parameters);
|
|
496
|
-
assertEqualContent(
|
|
497
|
-
parameters?.content!,
|
|
498
|
-
`
|
|
499
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
500
|
-
import { SimpleModel } from "./models";
|
|
501
|
-
|
|
502
|
-
export interface ReadBodyParam {
|
|
503
|
-
body:Array<SimpleModel>;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
507
|
-
`
|
|
508
|
-
);
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
it("InnerModel array request generation", async () => {
|
|
512
|
-
const parameters = await emitParameterFromCadl(`
|
|
513
|
-
model InnerModel {
|
|
514
|
-
property: string;
|
|
515
|
-
children?: InnerModel[];
|
|
516
|
-
}
|
|
517
|
-
@post op read(@body body: InnerModel[]): void;
|
|
518
|
-
`);
|
|
519
|
-
assert.ok(parameters);
|
|
520
|
-
assertEqualContent(
|
|
521
|
-
parameters?.content!,
|
|
522
|
-
`
|
|
523
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
524
|
-
import { InnerModel } from "./models";
|
|
525
|
-
|
|
526
|
-
export interface ReadBodyParam {
|
|
527
|
-
body:Array<InnerModel>;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
531
|
-
`
|
|
532
|
-
);
|
|
533
|
-
});
|
|
534
|
-
});
|
|
535
|
-
|
|
536
|
-
describe("Dictionary in body generation", () => {
|
|
537
|
-
it("Simple model dictionary request generation", async () => {
|
|
538
|
-
const parameters = await emitParameterFromCadl(`
|
|
539
|
-
model SimpleModel {
|
|
540
|
-
prop1: string;
|
|
541
|
-
prop2: int32;
|
|
542
|
-
}
|
|
543
|
-
@post op read(@body body: Record<SimpleModel>): SimpleModel;
|
|
544
|
-
`);
|
|
545
|
-
assert.ok(parameters);
|
|
546
|
-
assertEqualContent(
|
|
547
|
-
parameters?.content!,
|
|
548
|
-
`
|
|
549
|
-
import { RequestParameters } from "@azure-rest/core-client";
|
|
550
|
-
import { SimpleModel } from "./models";
|
|
551
|
-
|
|
552
|
-
export interface ReadBodyParam {
|
|
553
|
-
body: Record<string, SimpleModel>;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
export type ReadParameters = ReadBodyParam & RequestParameters;
|
|
557
|
-
`
|
|
558
|
-
);
|
|
559
|
-
});
|
|
560
|
-
});
|
|
561
|
-
});
|