@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
package/CONTRIBUTING.md
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# How to Contribute
|
|
2
|
-
|
|
3
|
-
## Prerequisite
|
|
4
|
-
|
|
5
|
-
Please follow the **[Prerequisite](../../CONTRIBUTING.md#prerequisites)** part to install the dependencies.
|
|
6
|
-
|
|
7
|
-
## Steps to clone, build & test
|
|
8
|
-
|
|
9
|
-
1. Use the following command to clone the Typescript/Javascript SDK generator repository:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
git clone https://github.com/Azure/autorest.typescript.git
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
2. Use the following commands to build the SDK generator:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
rush update
|
|
19
|
-
rush rebuild
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
3. There are also 3 test-suites in the RLC generator:
|
|
23
|
-
|
|
24
|
-
1. Unit tests (which could be found at `test/unit/*`)
|
|
25
|
-
2. Integration tests (which could be found at `test/integration/*`)
|
|
26
|
-
3. Smoke tests (which could be found at `../../packages/typespec-test`)
|
|
27
|
-
|
|
28
|
-
1. You can run the Unit tests & Integration tests using the following command:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
npm run test
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Running the command above will do the following things:
|
|
35
|
-
|
|
36
|
-
- Start TestServer
|
|
37
|
-
- Build Cadl Typescript
|
|
38
|
-
- Generate all scenarios in parallel (i.e. Dictionary, Extensible Enums, Models, Resiliency)
|
|
39
|
-
- Run all the tests under test/integration
|
|
40
|
-
- Stop TestServer
|
|
41
|
-
|
|
42
|
-
**_Note_**: If your development environment is Windows, then run the command `npm run start-test-server`(in a seperate window) before running `npm run test` and run the command `npm run stop-test-server` after. (In non windows machines, we could run the test-server in the background automatically. But, in Windows machines, it has to be done manually.)
|
|
43
|
-
|
|
44
|
-
5. You can run the Smoke tests using the following command:
|
|
45
|
-
|
|
46
|
-
```shell
|
|
47
|
-
cd ../../packages/typespec-test
|
|
48
|
-
npm run smoke-test
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## How to add an integration test case
|
|
52
|
-
|
|
53
|
-
Whenever you work on adding a feature/fixing a bug, this would probably be your first step. You create a test case and then run it through the generator, see the result, modify the generator, run it again and so on, until you get the desired output.
|
|
54
|
-
|
|
55
|
-
1. Pick up a cadl as your test input in cadl-ranch. Below are some examples
|
|
56
|
-
|
|
57
|
-
Let us say your test input is `authentication/api-key/main.cadl` in @azure-tools/cadl-ranch-specs.
|
|
58
|
-
|
|
59
|
-
1. Now add an entry to the CadlRanchConfig to the file [`cadl-ranch-list.ts`](./test/commands/cadl-ranch-list.ts). In the file, add the following to the array.
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
{
|
|
63
|
-
outputPath: "authentication/apiKey",
|
|
64
|
-
inputPath: "authentication/api-key"
|
|
65
|
-
},
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
1. Create a tspconfig.yaml in `./test/integration/generated/authentication/apiKey` folder and put the following content in it.
|
|
69
|
-
|
|
70
|
-
```yaml
|
|
71
|
-
emit:
|
|
72
|
-
- "@azure-tools/typespec-ts"
|
|
73
|
-
options:
|
|
74
|
-
"@azure-tools/typespec-ts":
|
|
75
|
-
"emitter-output-dir": "{project-root}"
|
|
76
|
-
generateMetadata: true
|
|
77
|
-
generateTest: true
|
|
78
|
-
includeShortcuts: true
|
|
79
|
-
azureSdkForJs: false
|
|
80
|
-
addCredentials: false
|
|
81
|
-
isCadlTest: true
|
|
82
|
-
title: AuthApiKeyClient
|
|
83
|
-
packageDetails:
|
|
84
|
-
name: "@msinternal/auth-apikey"
|
|
85
|
-
description: "Auth api key Test Service"
|
|
86
|
-
version: "1.0.0"
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
1. Now, You can generate the RLC for your test case with the following command: (Initially, during your development, you do not want to run all the cases during every step of your development, you can comment out other test cases. But, once your code changes are complete for your case, then you need to run the entire suite to ensure that your changes did not cause any unwanted changes.)
|
|
90
|
-
|
|
91
|
-
```shell
|
|
92
|
-
npm run generate-cadl-only
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
1. Once you are satisfied with the generated code, you can add a spec file such as `testUserCaseRest.spec.ts` file [here](./test/integration). You can find several examples in the same place.
|
|
96
|
-
|
|
97
|
-
## How to debug
|
|
98
|
-
|
|
99
|
-
### `generate-cadl-only` step
|
|
100
|
-
|
|
101
|
-
If you would like to debug the `generate-cadl-only` step for our test input, Open the repository in VS Code -> Select `Generate code for CadlEmitter` section -> Click `Attach`.
|
|
102
|
-
|
|
103
|
-
### Spec file
|
|
104
|
-
|
|
105
|
-
If you would like to debug the `testUserCase.spec.ts` file (after the SDK is generated), Open the repository in VS Code -> Open the `testUserCase.spec.ts` file -> Select `Run and Debug` section -> Click `IntegrationTests - Current File`.
|
|
106
|
-
|
|
107
|
-
### How to debug an unit test case
|
|
108
|
-
|
|
109
|
-
- In VS Code, We have created a Debugging profile for UnitTests to start debugging:
|
|
110
|
-
|
|
111
|
-
1. Go to the debugger tab
|
|
112
|
-
2. Select the "[CADL] - Unit Test" Profile
|
|
113
|
-
3. Click the "Play" button
|
|
114
|
-
|
|
115
|
-
- Your breakpoints will start hitting, you can set breakpoints in either Test or Generator code
|
|
116
|
-
|
|
117
|
-
### Integration Tests
|
|
118
|
-
|
|
119
|
-
- In order to debug integration tests you need to start the test server, by running:
|
|
120
|
-
|
|
121
|
-
npm run start-test-server:v1
|
|
122
|
-
|
|
123
|
-
- Once the Test Server is running
|
|
124
|
-
|
|
125
|
-
1. In VSCode go to the debugger tab
|
|
126
|
-
2. Select the "[CADL] - Integration Test" profile from the drop down
|
|
127
|
-
3. Click the "Play" button
|
|
128
|
-
|
|
129
|
-
- **\*\***IMPORTANT**\*\***: Running Integration Tests for debugging, does not re-generate the test clients so make sure that after each change you do:
|
|
130
|
-
|
|
131
|
-
- Re-generate all the test swaggers
|
|
132
|
-
|
|
133
|
-
npm run generate-cadl-only -- --build
|
|
134
|
-
|
|
135
|
-
- Re-generate a specific swagger
|
|
136
|
-
|
|
137
|
-
npm run generate-cadl-only -- -i bodyComplexRest -b
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
export interface CadlRanchConfig {
|
|
2
|
-
outputPath: string;
|
|
3
|
-
inputPath: string;
|
|
4
|
-
debug?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const cadls: CadlRanchConfig[] = [
|
|
8
|
-
{
|
|
9
|
-
outputPath: "arrays/itemTypes",
|
|
10
|
-
inputPath: "type/array"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
outputPath: "authentication/apiKey",
|
|
14
|
-
inputPath: "authentication/api-key"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
outputPath: "authentication/oauth2",
|
|
18
|
-
inputPath: "authentication/oauth2"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
outputPath: "authentication/union",
|
|
22
|
-
inputPath: "authentication/union"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
outputPath: "dictionary",
|
|
26
|
-
inputPath: "type/dictionary"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
outputPath: "enums/extensible",
|
|
30
|
-
inputPath: "type/enum/extensible"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
outputPath: "enums/fixed",
|
|
34
|
-
inputPath: "type/enum/fixed"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
outputPath: "lro/lroCore",
|
|
38
|
-
inputPath: "azure/core/lro/standard"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
outputPath: "lro/lroRPC",
|
|
42
|
-
inputPath: "azure/core/lro/rpc"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
outputPath: "models/inheritance",
|
|
46
|
-
inputPath: "type/model/inheritance"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
outputPath: "models/propertyOptional",
|
|
50
|
-
inputPath: "type/property/optional"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
outputPath: "models/propertyNullable",
|
|
54
|
-
inputPath: "type/property/nullable"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
outputPath: "models/propertyTypes",
|
|
58
|
-
inputPath: "type/property/value-types"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
outputPath: "models/visibility",
|
|
62
|
-
inputPath: "type/model/visibility"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
outputPath: "models/usage",
|
|
66
|
-
inputPath: "type/model/usage"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
outputPath: "resiliency/srvDriven1",
|
|
70
|
-
inputPath: "resiliency/srv-driven/old.tsp"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
outputPath: "resiliency/srvDriven2",
|
|
74
|
-
inputPath: "resiliency/srv-driven/main.tsp"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
outputPath: "specialWords",
|
|
78
|
-
inputPath: "special-words"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
outputPath: "unions",
|
|
82
|
-
inputPath: "type/union"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
outputPath: "parameters/collection-format",
|
|
86
|
-
inputPath: "parameters/collection-format"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
outputPath: "parameters/spread",
|
|
90
|
-
inputPath: "parameters/spread"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
outputPath: "projection",
|
|
94
|
-
inputPath: "projection/projected-name"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
outputPath: "internal",
|
|
98
|
-
inputPath: "azure/client-generator-core/internal"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
outputPath: "server/path/single",
|
|
102
|
-
inputPath: "server/path/single"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
outputPath: "server/path/multiple",
|
|
106
|
-
inputPath: "server/path/multiple"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
outputPath: "azure/core",
|
|
110
|
-
inputPath: "azure/core/basic"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
outputPath: "azure/core-traits",
|
|
114
|
-
inputPath: "azure/core/traits"
|
|
115
|
-
}
|
|
116
|
-
];
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { spawn, ChildProcess } from "child_process";
|
|
2
|
-
|
|
3
|
-
const onExit = (childProcess: ChildProcess): Promise<string[]> => {
|
|
4
|
-
let messages: string[] = [];
|
|
5
|
-
return new Promise((resolve, reject) => {
|
|
6
|
-
if (childProcess.stdout) {
|
|
7
|
-
childProcess.stdout.on("data", (message) => messages.push(message));
|
|
8
|
-
}
|
|
9
|
-
childProcess.once("exit", (code: number) => {
|
|
10
|
-
if (code === 0) {
|
|
11
|
-
resolve(messages);
|
|
12
|
-
}
|
|
13
|
-
reject(new Error(`Exit with code: ${code}`));
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
childProcess.once("error", (error: Error) => {
|
|
17
|
-
reject(error);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
async function check_tree() {
|
|
23
|
-
await onExit(
|
|
24
|
-
spawn("git", ["add", "-A"], {
|
|
25
|
-
stdio: [process.stdin, process.stdout, process.stderr]
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
// If there is any output from this command it means that
|
|
30
|
-
// there are non committed changes so we need to handle
|
|
31
|
-
// stout
|
|
32
|
-
const messages = await onExit(
|
|
33
|
-
spawn("git", ["diff", "--staged", "--compact-summary"])
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
if (messages.length !== 0) {
|
|
37
|
-
// Once we have verified that there are non committed changes
|
|
38
|
-
// run git diff again, this time forwarding the stout to present
|
|
39
|
-
// a readable hint to the user
|
|
40
|
-
await onExit(
|
|
41
|
-
spawn("git", ["diff", "--staged", "--compact-summary"], {
|
|
42
|
-
stdio: [process.stdin, process.stdout, process.stderr]
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
throw new Error(
|
|
47
|
-
"Git tree is dirty, regenerate all test cadl files and make sure that there are no un-intended changes"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
check_tree().catch((error) => {
|
|
53
|
-
console.error(error);
|
|
54
|
-
process.exit(-1);
|
|
55
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ChildProcess } from "child_process";
|
|
2
|
-
|
|
3
|
-
export const onExit = (childProcess: ChildProcess) => {
|
|
4
|
-
return new Promise<void>((resolve, reject) => {
|
|
5
|
-
childProcess.once("exit", (code: number) => {
|
|
6
|
-
if (code === 0) {
|
|
7
|
-
resolve();
|
|
8
|
-
}
|
|
9
|
-
reject(new Error(`Exit with code: ${code}`));
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
childProcess.once("error", (error: Error) => {
|
|
13
|
-
reject(error);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { cadls } from "./cadl-ranch-list.js";
|
|
2
|
-
import { runTypespec } from "./run.js";
|
|
3
|
-
import pkg from "chalk";
|
|
4
|
-
const { bold } = pkg;
|
|
5
|
-
const logError = (str: string) => console.error(bold.red(str));
|
|
6
|
-
|
|
7
|
-
async function generateCadls(isDebugging = false) {
|
|
8
|
-
const list = cadls;
|
|
9
|
-
for (const cadl of list) {
|
|
10
|
-
if (isDebugging === true && cadl.debug !== true) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
await runTypespec(cadl);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function main() {
|
|
18
|
-
const isDebugging = process.argv.indexOf("--debug") !== -1;
|
|
19
|
-
await generateCadls(isDebugging);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
main().catch((error) => {
|
|
23
|
-
logError(error);
|
|
24
|
-
process.exit(-1);
|
|
25
|
-
});
|
package/test/commands/run.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
2
|
-
import { dirname, join as joinPath } from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { CadlRanchConfig } from "./cadl-ranch-list.js";
|
|
5
|
-
|
|
6
|
-
export async function runTypespec(config: CadlRanchConfig) {
|
|
7
|
-
const targetFolder = config.outputPath,
|
|
8
|
-
sourceTypespec = config.inputPath;
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = dirname(__filename);
|
|
11
|
-
console.log(`=== Start ${targetFolder} ===`);
|
|
12
|
-
|
|
13
|
-
const typespecPath = joinPath(
|
|
14
|
-
`${__dirname}`,
|
|
15
|
-
"..",
|
|
16
|
-
"..",
|
|
17
|
-
`./temp/http/${sourceTypespec}`
|
|
18
|
-
);
|
|
19
|
-
const outputPath = joinPath(
|
|
20
|
-
`${__dirname}`,
|
|
21
|
-
"..",
|
|
22
|
-
`./integration/generated/${targetFolder}`
|
|
23
|
-
);
|
|
24
|
-
const typespecCommand = `cd ${outputPath} && npx tsp`;
|
|
25
|
-
const commandArguments: string[] = ["compile", `${typespecPath}`];
|
|
26
|
-
const command = `${typespecCommand} ${commandArguments.join(" ")}`;
|
|
27
|
-
console.log(command);
|
|
28
|
-
const result = execSync(command);
|
|
29
|
-
console.log(`=== End ${targetFolder} ===`);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import ArrayItemTypesClientFactory, {
|
|
2
|
-
ArrayItemTypesClient
|
|
3
|
-
} from "./generated/arrays/itemTypes/src/index.js";
|
|
4
|
-
import { assert } from "chai";
|
|
5
|
-
import { matrix } from "../util/matrix.js";
|
|
6
|
-
|
|
7
|
-
interface TypeDetail {
|
|
8
|
-
type: string;
|
|
9
|
-
defaultValue: any;
|
|
10
|
-
convertedToFn?: (_: any) => any;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const testedTypes: TypeDetail[] = [
|
|
14
|
-
{
|
|
15
|
-
type: "int32",
|
|
16
|
-
defaultValue: [1, 2]
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: "int64",
|
|
20
|
-
defaultValue: [Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: "boolean",
|
|
24
|
-
defaultValue: [true, false]
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: "string",
|
|
28
|
-
defaultValue: ["hello", ""]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: "float32",
|
|
32
|
-
defaultValue: [42.42]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: "datetime",
|
|
36
|
-
defaultValue: ["2022-08-26T18:38:00Z"]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
type: "duration",
|
|
40
|
-
defaultValue: ["P123DT22H14M12.011S"]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "unknown",
|
|
44
|
-
defaultValue: [1, "hello", null]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: "model",
|
|
48
|
-
defaultValue: [{ property: "hello" }, { property: "world" }]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: "nullable-float",
|
|
52
|
-
defaultValue: [1.2, null, 3.0]
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
describe("Array Item-Types Client", () => {
|
|
56
|
-
let client: ArrayItemTypesClient;
|
|
57
|
-
|
|
58
|
-
beforeEach(() => {
|
|
59
|
-
client = ArrayItemTypesClientFactory({
|
|
60
|
-
allowInsecureConnection: true
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
matrix([testedTypes], async (params: TypeDetail) => {
|
|
65
|
-
it(`should get a ${params.type} value`, async () => {
|
|
66
|
-
try {
|
|
67
|
-
const result = await client
|
|
68
|
-
.path(`/type/array/${params.type}` as any)
|
|
69
|
-
.get();
|
|
70
|
-
assert.strictEqual(result.status, "200");
|
|
71
|
-
assert.deepEqual(result.body, params.defaultValue);
|
|
72
|
-
} catch (err) {
|
|
73
|
-
assert.fail(err as string);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it(`should put a ${params.type} value`, async () => {
|
|
78
|
-
try {
|
|
79
|
-
let property;
|
|
80
|
-
if (params.convertedToFn) {
|
|
81
|
-
property = params.convertedToFn(params.defaultValue);
|
|
82
|
-
} else {
|
|
83
|
-
property = params.defaultValue;
|
|
84
|
-
}
|
|
85
|
-
const result = await client
|
|
86
|
-
.path(`/type/array/${params.type}` as any)
|
|
87
|
-
.put({
|
|
88
|
-
body: property
|
|
89
|
-
});
|
|
90
|
-
assert.strictEqual(result.status, "204");
|
|
91
|
-
} catch (err) {
|
|
92
|
-
assert.fail(err as string);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import ApiKeyClientFactory, {
|
|
2
|
-
AuthApiKeyClient
|
|
3
|
-
} from "./generated/authentication/apiKey/src/index.js";
|
|
4
|
-
import { assert } from "chai";
|
|
5
|
-
describe("AuthApiKeyClient Rest Client", () => {
|
|
6
|
-
let client: AuthApiKeyClient;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
client = ApiKeyClientFactory(
|
|
10
|
-
{
|
|
11
|
-
key: "valid-key"
|
|
12
|
-
},
|
|
13
|
-
{ allowInsecureConnection: true }
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should return 204 when the apiKey is valid", async () => {
|
|
18
|
-
try {
|
|
19
|
-
const result = await client.path("/authentication/api-key/valid").get();
|
|
20
|
-
assert.strictEqual(result.status, "204");
|
|
21
|
-
} catch (err) {
|
|
22
|
-
console.log(err);
|
|
23
|
-
assert.fail(err as string);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should return 403 when the apiKey is invalid", async () => {
|
|
28
|
-
try {
|
|
29
|
-
const result = await client.path("/authentication/api-key/invalid").get();
|
|
30
|
-
assert.strictEqual(result.status, "403");
|
|
31
|
-
if (result.status === "403") {
|
|
32
|
-
assert.strictEqual(result.body.error, "invalid-api-key");
|
|
33
|
-
}
|
|
34
|
-
} catch (err) {
|
|
35
|
-
assert.fail(err as string);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import Outh2ClientFactory, {
|
|
2
|
-
AuthOauth2Client
|
|
3
|
-
} from "./generated/authentication/oauth2/src/index.js";
|
|
4
|
-
import { assert } from "chai";
|
|
5
|
-
import {
|
|
6
|
-
bearerTokenAuthenticationPolicyName,
|
|
7
|
-
PipelinePolicy
|
|
8
|
-
} from "@azure/core-rest-pipeline";
|
|
9
|
-
import { customBearerTokenAuthenticationPolicy } from "../util/customBearerTokenTestingPolicy.js";
|
|
10
|
-
|
|
11
|
-
describe("AuthOauth2Client Rest Client", () => {
|
|
12
|
-
let client: AuthOauth2Client;
|
|
13
|
-
let policy: PipelinePolicy;
|
|
14
|
-
const defaultScope = "https://security.microsoft.com/.default";
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
client = Outh2ClientFactory(
|
|
18
|
-
{
|
|
19
|
-
getToken: async () => Promise.resolve(null)
|
|
20
|
-
},
|
|
21
|
-
{ allowInsecureConnection: true }
|
|
22
|
-
);
|
|
23
|
-
policy = customBearerTokenAuthenticationPolicy({
|
|
24
|
-
scopes: defaultScope,
|
|
25
|
-
credential: {
|
|
26
|
-
getToken: async () => {
|
|
27
|
-
return {
|
|
28
|
-
token: defaultScope,
|
|
29
|
-
expiresOnTimestamp: Date.now()
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
client.pipeline.removePolicy({
|
|
35
|
-
name: bearerTokenAuthenticationPolicyName
|
|
36
|
-
});
|
|
37
|
-
client.pipeline.addPolicy(policy);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("should return 204 when the token is valid", async () => {
|
|
41
|
-
try {
|
|
42
|
-
const result = await client.path("/authentication/oauth2/valid").get();
|
|
43
|
-
assert.strictEqual(result.status, "204");
|
|
44
|
-
} catch (err) {
|
|
45
|
-
console.log(err);
|
|
46
|
-
assert.fail(err as string);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("should return 403 when the token is invalid", async () => {
|
|
51
|
-
try {
|
|
52
|
-
client.pipeline.removePolicy({
|
|
53
|
-
name: bearerTokenAuthenticationPolicyName
|
|
54
|
-
});
|
|
55
|
-
const result = await client.path("/authentication/oauth2/invalid").get();
|
|
56
|
-
assert.strictEqual(result.status, "403");
|
|
57
|
-
if (result.status === "403") {
|
|
58
|
-
assert.strictEqual(result.body.error, "invalid-grant");
|
|
59
|
-
}
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.log(err);
|
|
62
|
-
assert.fail(err as string);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { assert } from "chai";
|
|
2
|
-
import {
|
|
3
|
-
bearerTokenAuthenticationPolicyName,
|
|
4
|
-
PipelinePolicy
|
|
5
|
-
} from "@azure/core-rest-pipeline";
|
|
6
|
-
import { customBearerTokenAuthenticationPolicy } from "../util/customBearerTokenTestingPolicy.js";
|
|
7
|
-
import AuthUnionClientFactory, {
|
|
8
|
-
AuthUnionClient
|
|
9
|
-
} from "./generated/authentication/union/src/index.js";
|
|
10
|
-
|
|
11
|
-
describe("AuthUnionClient Rest Client", () => {
|
|
12
|
-
let client: AuthUnionClient;
|
|
13
|
-
let policy: PipelinePolicy;
|
|
14
|
-
const defaultScope = "https://security.microsoft.com/.default";
|
|
15
|
-
|
|
16
|
-
function prepareToken() {
|
|
17
|
-
client = AuthUnionClientFactory(
|
|
18
|
-
{
|
|
19
|
-
getToken: async () => Promise.resolve(null)
|
|
20
|
-
},
|
|
21
|
-
{ allowInsecureConnection: true }
|
|
22
|
-
);
|
|
23
|
-
policy = customBearerTokenAuthenticationPolicy({
|
|
24
|
-
scopes: defaultScope,
|
|
25
|
-
credential: {
|
|
26
|
-
getToken: async () => {
|
|
27
|
-
return {
|
|
28
|
-
token: defaultScope,
|
|
29
|
-
expiresOnTimestamp: Date.now()
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
client.pipeline.removePolicy({
|
|
35
|
-
name: bearerTokenAuthenticationPolicyName
|
|
36
|
-
});
|
|
37
|
-
client.pipeline.addPolicy(policy);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function prepareKey() {
|
|
41
|
-
client = AuthUnionClientFactory(
|
|
42
|
-
{
|
|
43
|
-
key: "valid-key"
|
|
44
|
-
},
|
|
45
|
-
{ allowInsecureConnection: true }
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
it("should return 204 when the token is valid", async () => {
|
|
50
|
-
prepareToken();
|
|
51
|
-
try {
|
|
52
|
-
const result = await client
|
|
53
|
-
.path("/authentication/union/validtoken")
|
|
54
|
-
.get();
|
|
55
|
-
assert.strictEqual(result.status, "204");
|
|
56
|
-
} catch (err) {
|
|
57
|
-
console.log(err);
|
|
58
|
-
assert.fail(err as string);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("should return 204 when the key is valid", async () => {
|
|
63
|
-
prepareKey();
|
|
64
|
-
try {
|
|
65
|
-
const result = await client.path("/authentication/union/validkey").get();
|
|
66
|
-
assert.strictEqual(result.status, "204");
|
|
67
|
-
} catch (err) {
|
|
68
|
-
console.log(err);
|
|
69
|
-
assert.fail(err as string);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|