@azure-tools/typespec-ts 0.11.0 → 0.12.0-alpha.20230501.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/.rush/temp/package-deps_build.json +265 -152
- package/.rush/temp/shrinkwrap-deps.json +58 -54
- package/CHANGELOG.md +4 -0
- package/CONTRIBUTING.md +5 -2
- package/README.md +3 -3
- package/dist/src/casingUtils.d.ts +4 -0
- package/dist/src/casingUtils.d.ts.map +1 -0
- package/dist/src/casingUtils.js +39 -0
- package/dist/src/casingUtils.js.map +1 -0
- package/dist/src/emitUtil.js +7 -1
- package/dist/src/emitUtil.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +41 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modelUtils.d.ts +22 -1
- package/dist/src/modelUtils.d.ts.map +1 -1
- package/dist/src/modelUtils.js +105 -13
- package/dist/src/modelUtils.js.map +1 -1
- package/dist/src/modular/buildApiIndex.d.ts +3 -0
- package/dist/src/modular/buildApiIndex.d.ts.map +1 -0
- package/dist/src/modular/buildApiIndex.js +12 -0
- package/dist/src/modular/buildApiIndex.js.map +1 -0
- package/dist/src/modular/buildClassicalClient.d.ts +4 -0
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -0
- package/dist/src/modular/buildClassicalClient.js +112 -0
- package/dist/src/modular/buildClassicalClient.js.map +1 -0
- package/dist/src/modular/buildClientContext.d.ts +7 -0
- package/dist/src/modular/buildClientContext.d.ts.map +1 -0
- package/dist/src/modular/buildClientContext.js +72 -0
- package/dist/src/modular/buildClientContext.js.map +1 -0
- package/dist/src/modular/buildCodeModel.d.ts +14 -0
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -0
- package/dist/src/modular/buildCodeModel.js +1110 -0
- package/dist/src/modular/buildCodeModel.js.map +1 -0
- package/dist/src/modular/buildOperations.d.ts +13 -0
- package/dist/src/modular/buildOperations.d.ts.map +1 -0
- package/dist/src/modular/buildOperations.js +70 -0
- package/dist/src/modular/buildOperations.js.map +1 -0
- package/dist/src/modular/buildProjectFiles.d.ts +5 -0
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -0
- package/dist/src/modular/buildProjectFiles.js +182 -0
- package/dist/src/modular/buildProjectFiles.js.map +1 -0
- package/dist/src/modular/buildRootIndex.d.ts +4 -0
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -0
- package/dist/src/modular/buildRootIndex.js +66 -0
- package/dist/src/modular/buildRootIndex.js.map +1 -0
- package/dist/src/modular/buildSharedTypes.d.ts +6 -0
- package/dist/src/modular/buildSharedTypes.d.ts.map +1 -0
- package/dist/src/modular/buildSharedTypes.js +33 -0
- package/dist/src/modular/buildSharedTypes.js.map +1 -0
- package/dist/src/modular/emitModels.d.ts +7 -0
- package/dist/src/modular/emitModels.d.ts.map +1 -0
- package/dist/src/modular/emitModels.js +63 -0
- package/dist/src/modular/emitModels.js.map +1 -0
- package/dist/src/modular/helpers/clientHelpers.d.ts +4 -0
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/clientHelpers.js +31 -0
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -0
- package/dist/src/modular/helpers/credentialHelpers.d.ts +7 -0
- package/dist/src/modular/helpers/credentialHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/credentialHelpers.js +32 -0
- package/dist/src/modular/helpers/credentialHelpers.js.map +1 -0
- package/dist/src/modular/helpers/namingHelpers.d.ts +3 -0
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/namingHelpers.js +4 -0
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -0
- package/dist/src/modular/helpers/operationHelpers.d.ts +8 -0
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/operationHelpers.js +274 -0
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -0
- package/dist/src/modular/helpers/parameterHelpers.d.ts +3 -0
- package/dist/src/modular/helpers/parameterHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/parameterHelpers.js +16 -0
- package/dist/src/modular/helpers/parameterHelpers.js.map +1 -0
- package/dist/src/modular/helpers/typeHelpers.d.ts +16 -0
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -0
- package/dist/src/modular/helpers/typeHelpers.js +92 -0
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -0
- package/dist/src/modular/interfaces.d.ts +10 -0
- package/dist/src/modular/interfaces.d.ts.map +1 -0
- package/dist/src/modular/interfaces.js +2 -0
- package/dist/src/modular/interfaces.js.map +1 -0
- package/dist/src/modular/modularCodeModel.d.ts +121 -0
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -0
- package/dist/src/modular/modularCodeModel.js +2 -0
- package/dist/src/modular/modularCodeModel.js.map +1 -0
- package/dist/src/operationUtil.d.ts +30 -4
- package/dist/src/operationUtil.d.ts.map +1 -1
- package/dist/src/operationUtil.js +77 -18
- package/dist/src/operationUtil.js.map +1 -1
- package/dist/src/transform/transform.d.ts +4 -6
- package/dist/src/transform/transform.d.ts.map +1 -1
- package/dist/src/transform/transform.js +17 -58
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.d.ts +5 -0
- package/dist/src/transform/transformApiVersionInfo.d.ts.map +1 -0
- package/dist/src/transform/transformApiVersionInfo.js +64 -0
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -0
- package/dist/src/transform/transformHelperFunctionDetails.d.ts +6 -0
- package/dist/src/transform/transformHelperFunctionDetails.d.ts.map +1 -0
- package/dist/src/transform/{transformAnnotationDetails.js → transformHelperFunctionDetails.js} +2 -2
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -0
- package/dist/src/transform/transformParameters.d.ts +2 -2
- package/dist/src/transform/transformParameters.d.ts.map +1 -1
- package/dist/src/transform/transformParameters.js +20 -7
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.d.ts +2 -2
- package/dist/src/transform/transformPaths.d.ts.map +1 -1
- package/dist/src/transform/transformPaths.js +15 -7
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.d.ts +2 -2
- package/dist/src/transform/transformResponses.d.ts.map +1 -1
- package/dist/src/transform/transformResponses.js +23 -2
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts +2 -2
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +10 -22
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.d.ts +2 -2
- package/dist/src/transform/transfromRLCOptions.js +1 -1
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -19
- package/src/casingUtils.ts +48 -0
- package/src/emitUtil.ts +9 -4
- package/src/index.ts +53 -10
- package/src/lib.ts +2 -1
- package/src/modelUtils.ts +137 -14
- package/src/modular/buildApiIndex.ts +13 -0
- package/src/modular/buildClassicalClient.ts +147 -0
- package/src/modular/buildClientContext.ts +104 -0
- package/src/modular/buildCodeModel.ts +1449 -0
- package/src/modular/buildOperations.ts +95 -0
- package/src/modular/buildProjectFiles.ts +219 -0
- package/src/modular/buildRootIndex.ts +94 -0
- package/src/modular/buildSharedTypes.ts +40 -0
- package/src/modular/emitModels.ts +72 -0
- package/src/modular/helpers/clientHelpers.ts +38 -0
- package/src/modular/helpers/credentialHelpers.ts +40 -0
- package/src/modular/helpers/namingHelpers.ts +5 -0
- package/src/modular/helpers/operationHelpers.ts +418 -0
- package/src/modular/helpers/parameterHelpers.ts +17 -0
- package/src/modular/helpers/typeHelpers.ts +106 -0
- package/src/modular/interfaces.ts +10 -0
- package/src/modular/modularCodeModel.ts +151 -0
- package/src/modular/static/karma.conf.cjs +120 -0
- package/src/modular/static/rollup.test.config.js +67 -0
- package/src/modular/static/scripts/renameOutput.mjs +17 -0
- package/src/operationUtil.ts +119 -31
- package/src/transform/transform.ts +33 -96
- package/src/transform/transformApiVersionInfo.ts +108 -0
- package/src/transform/{transformAnnotationDetails.ts → transformHelperFunctionDetails.ts} +11 -11
- package/src/transform/transformParameters.ts +30 -14
- package/src/transform/transformPaths.ts +29 -19
- package/src/transform/transformResponses.ts +50 -8
- package/src/transform/transformSchemas.ts +20 -28
- package/src/transform/transfromRLCOptions.ts +3 -3
- package/test/commands/cadl-ranch-list.ts +53 -20
- package/test/commands/gen-cadl-ranch.ts +6 -2
- package/test/commands/run.ts +3 -13
- package/test/integration/arrayItemTypes.spec.ts +6 -3
- package/test/integration/azurecore.spec.ts +130 -0
- package/test/integration/collectionFormat.spec.ts +118 -0
- package/test/integration/dictionary.spec.ts +6 -2
- package/test/integration/extensibleEnums.spec.ts +8 -8
- package/test/integration/fixedEnums.spec.ts +7 -7
- package/test/integration/generated/arrays/itemTypes/src/clientDefinitions.ts +33 -18
- package/test/integration/generated/arrays/itemTypes/src/parameters.ts +8 -0
- package/test/integration/generated/arrays/itemTypes/src/responses.ts +11 -0
- package/test/integration/generated/arrays/itemTypes/tspconfig.yaml +5 -2
- package/test/integration/generated/authentication/apiKey/package.json +2 -2
- package/test/integration/generated/authentication/apiKey/tspconfig.yaml +5 -2
- package/test/integration/generated/authentication/oauth2/tspconfig.yaml +5 -2
- package/test/integration/generated/authentication/union/tspconfig.yaml +5 -2
- package/test/integration/generated/{resiliency/devDriven → azure/core}/README.md +7 -7
- package/test/integration/generated/{lro/lroBasic → azure/core}/api-extractor.json +1 -1
- package/test/integration/generated/{resiliency/devDriven → azure/core}/package.json +6 -6
- package/test/integration/generated/azure/core/src/azureCoreClient.ts +31 -0
- package/test/integration/generated/azure/core/src/clientDefinitions.ts +108 -0
- package/test/integration/generated/{resiliency/devDriven → azure/core}/src/index.ts +4 -3
- package/test/integration/generated/azure/core/src/isUnexpected.ts +178 -0
- package/test/integration/generated/azure/core/src/models.ts +18 -0
- package/test/integration/generated/azure/core/src/outputModels.ts +32 -0
- package/test/integration/generated/{resiliency/devDriven → azure/core}/src/paginateHelper.ts +55 -5
- package/test/integration/generated/azure/core/src/parameters.ts +68 -0
- package/test/integration/generated/azure/core/src/responses.ts +158 -0
- package/test/integration/generated/azure/core/src/serializeHelper.ts +16 -0
- package/test/integration/generated/azure/core/tspconfig.yaml +15 -0
- package/test/integration/generated/azure/core-traits/README.md +56 -0
- package/test/integration/generated/azure/core-traits/api-extractor.json +18 -0
- package/test/integration/generated/azure/core-traits/package.json +80 -0
- package/test/integration/generated/azure/core-traits/src/azureCoreTraitsClient.ts +31 -0
- package/test/integration/generated/azure/core-traits/src/clientDefinitions.ts +22 -0
- package/test/integration/generated/azure/core-traits/src/index.ts +13 -0
- package/test/integration/generated/{resiliency/devDriven → azure/core-traits}/src/isUnexpected.ts +6 -26
- package/test/integration/generated/azure/core-traits/src/outputModels.ts +10 -0
- package/test/integration/generated/azure/core-traits/src/parameters.ts +26 -0
- package/test/integration/generated/azure/core-traits/src/responses.ts +32 -0
- package/test/integration/generated/azure/core-traits/tspconfig.yaml +15 -0
- package/test/integration/generated/dictionary/package.json +2 -2
- package/test/integration/generated/dictionary/src/clientDefinitions.ts +35 -20
- package/test/integration/generated/dictionary/src/parameters.ts +8 -0
- package/test/integration/generated/dictionary/src/responses.ts +11 -0
- package/test/integration/generated/dictionary/tspconfig.yaml +5 -2
- package/test/integration/generated/enums/extensible/README.md +3 -3
- package/test/integration/generated/enums/extensible/package.json +2 -2
- package/test/integration/generated/enums/extensible/src/clientDefinitions.ts +5 -5
- package/test/integration/generated/enums/extensible/src/index.ts +3 -3
- package/test/integration/generated/enums/extensible/src/{enumsExtensible.ts → typeEnumExtensible.ts} +4 -4
- package/test/integration/generated/enums/extensible/tspconfig.yaml +5 -2
- package/test/integration/generated/enums/fixed/README.md +3 -3
- package/test/integration/generated/enums/fixed/package.json +2 -2
- package/test/integration/generated/enums/fixed/src/clientDefinitions.ts +5 -5
- package/test/integration/generated/enums/fixed/src/index.ts +3 -3
- package/test/integration/generated/enums/fixed/src/{enumsFixed.ts → typeEnumFixed.ts} +4 -4
- package/test/integration/generated/enums/fixed/tspconfig.yaml +5 -2
- package/test/integration/generated/hello/package.json +2 -2
- package/test/integration/generated/hello/tspconfig.yaml +5 -2
- package/test/integration/generated/internal/src/clientDefinitions.ts +27 -0
- package/test/integration/generated/internal/src/index.ts +13 -0
- package/test/integration/generated/{lro/lroBasic/src/azureLro.ts → internal/src/internalClient.ts} +5 -5
- package/test/integration/generated/internal/src/models.ts +8 -0
- package/test/integration/generated/internal/src/outputModels.ts +13 -0
- package/test/integration/generated/internal/src/parameters.ts +21 -0
- package/test/integration/generated/internal/src/responses.ts +20 -0
- package/test/integration/generated/internal/tspconfig.yaml +14 -0
- package/test/integration/generated/lro/lroCore/.eslintrc.json +11 -0
- package/test/integration/generated/lro/lroCore/README.md +56 -0
- package/test/integration/generated/{resiliency/devDriven → lro/lroCore}/api-extractor.json +1 -1
- package/test/integration/generated/lro/{lroBasic → lroCore}/package.json +6 -6
- package/test/integration/generated/lro/lroCore/rollup.config.js +118 -0
- package/test/integration/generated/lro/lroCore/src/clientDefinitions.ts +54 -0
- package/test/integration/generated/lro/lroCore/src/index.ts +15 -0
- package/test/integration/generated/lro/lroCore/src/isUnexpected.ts +135 -0
- package/test/integration/generated/lro/lroCore/src/models.ts +8 -0
- package/test/integration/generated/lro/lroCore/src/outputModels.ts +50 -0
- package/test/integration/generated/lro/lroCore/src/parameters.ts +25 -0
- package/test/integration/generated/lro/{lroBasic → lroCore}/src/pollingHelper.ts +38 -0
- package/test/integration/generated/lro/lroCore/src/responses.ts +109 -0
- package/test/integration/generated/lro/lroCore/src/specsAzureCoreLroStandard.ts +31 -0
- package/test/integration/generated/lro/lroCore/tsconfig.json +25 -0
- package/test/integration/generated/lro/lroCore/tspconfig.yaml +14 -0
- package/test/integration/generated/lro/lroRPC/.eslintrc.json +11 -0
- package/test/integration/generated/lro/{lroBasic → lroRPC}/README.md +7 -7
- package/test/integration/generated/lro/lroRPC/api-extractor.json +18 -0
- package/test/integration/generated/lro/lroRPC/package.json +82 -0
- package/test/integration/generated/lro/lroRPC/rollup.config.js +118 -0
- package/test/integration/generated/lro/lroRPC/src/clientDefinitions.ts +79 -0
- package/test/integration/generated/lro/lroRPC/src/index.ts +15 -0
- package/test/integration/generated/lro/lroRPC/src/isUnexpected.ts +153 -0
- package/test/integration/generated/lro/lroRPC/src/models.ts +8 -0
- package/test/integration/generated/lro/lroRPC/src/outputModels.ts +40 -0
- package/test/integration/generated/lro/lroRPC/src/parameters.ts +20 -0
- package/test/integration/generated/lro/lroRPC/src/pollingHelper.ts +127 -0
- package/test/integration/generated/lro/lroRPC/src/responses.ts +124 -0
- package/test/integration/generated/lro/lroRPC/src/specsAzureCoreLroRpc.ts +31 -0
- package/test/integration/generated/lro/lroRPC/tsconfig.json +25 -0
- package/test/integration/generated/lro/lroRPC/tspconfig.yaml +14 -0
- package/test/integration/generated/models/inheritance/README.md +3 -3
- package/test/integration/generated/models/inheritance/package.json +2 -2
- package/test/integration/generated/models/inheritance/src/clientDefinitions.ts +13 -11
- package/test/integration/generated/models/inheritance/src/index.ts +3 -3
- package/test/integration/generated/models/inheritance/src/{modelsInheritance.ts → typeModelInheritance.ts} +4 -4
- package/test/integration/generated/models/inheritance/tspconfig.yaml +5 -2
- package/test/integration/generated/models/propertyNullable/.eslintrc.json +11 -0
- package/test/integration/generated/models/propertyNullable/README.md +56 -0
- package/test/integration/generated/models/propertyNullable/api-extractor.json +18 -0
- package/test/integration/generated/models/propertyNullable/package.json +80 -0
- package/test/integration/generated/models/propertyNullable/rollup.config.js +118 -0
- package/test/integration/generated/models/propertyNullable/src/clientDefinitions.ts +227 -0
- package/test/integration/generated/models/propertyNullable/src/index.ts +13 -0
- package/test/integration/generated/models/propertyNullable/src/models.ts +56 -0
- package/test/integration/generated/models/propertyNullable/src/outputModels.ts +56 -0
- package/test/integration/generated/models/propertyNullable/src/parameters.ts +197 -0
- package/test/integration/generated/models/propertyNullable/src/responses.ts +144 -0
- package/test/integration/generated/{resiliency/devDriven/src/resiliencyDevDriven.ts → models/propertyNullable/src/typePropertyNullable.ts} +5 -5
- package/test/integration/generated/models/propertyNullable/tsconfig.json +25 -0
- package/test/integration/generated/models/propertyNullable/tspconfig.yaml +14 -0
- package/test/integration/generated/models/propertyOptional/README.md +3 -3
- package/test/integration/generated/models/propertyOptional/package.json +2 -2
- package/test/integration/generated/models/propertyOptional/src/clientDefinitions.ts +47 -47
- package/test/integration/generated/models/propertyOptional/src/index.ts +3 -3
- package/test/integration/generated/models/propertyOptional/src/parameters.ts +7 -6
- package/test/integration/generated/models/propertyOptional/src/responses.ts +4 -4
- package/test/integration/generated/models/propertyOptional/src/{modelsPropertyOptional.ts → typePropertyOptional.ts} +4 -4
- package/test/integration/generated/models/propertyOptional/tspconfig.yaml +5 -2
- package/test/integration/generated/models/propertyTypes/README.md +3 -3
- package/test/integration/generated/models/propertyTypes/package.json +2 -2
- package/test/integration/generated/models/propertyTypes/src/clientDefinitions.ts +55 -47
- package/test/integration/generated/models/propertyTypes/src/index.ts +3 -3
- package/test/integration/generated/models/propertyTypes/src/parameters.ts +8 -6
- package/test/integration/generated/models/propertyTypes/src/responses.ts +4 -4
- package/test/integration/generated/models/propertyTypes/src/{modelsPropertyTypes.ts → typePropertyValueTypes.ts} +4 -4
- package/test/integration/generated/models/propertyTypes/tspconfig.yaml +5 -2
- package/test/integration/generated/models/usage/README.md +3 -3
- package/test/integration/generated/models/usage/package.json +2 -2
- package/test/integration/generated/models/usage/src/clientDefinitions.ts +7 -7
- package/test/integration/generated/models/usage/src/index.ts +3 -3
- package/test/integration/generated/models/usage/src/{modelsUsage.ts → typeModelUsage.ts} +4 -4
- package/test/integration/generated/models/usage/tspconfig.yaml +5 -2
- package/test/integration/generated/models/visibility/README.md +3 -3
- package/test/integration/generated/models/visibility/package.json +2 -2
- package/test/integration/generated/models/visibility/src/clientDefinitions.ts +3 -3
- package/test/integration/generated/models/visibility/src/index.ts +3 -3
- package/test/integration/generated/models/visibility/src/{modelsVisibilityAutomatic.ts → typeModelVisibility.ts} +4 -4
- package/test/integration/generated/models/visibility/tspconfig.yaml +5 -2
- package/test/integration/generated/parameters/collection-format/src/clientDefinitions.ts +63 -0
- package/test/integration/generated/parameters/collection-format/src/collectionFormatClient.ts +31 -0
- package/test/integration/generated/parameters/collection-format/src/index.ts +12 -0
- package/test/integration/generated/parameters/collection-format/src/parameters.ts +71 -0
- package/test/integration/generated/parameters/collection-format/src/responses.ts +34 -0
- package/test/integration/generated/parameters/collection-format/src/serializeHelper.ts +28 -0
- package/test/integration/generated/parameters/collection-format/tspconfig.yaml +14 -0
- package/test/integration/generated/parameters/spread/src/clientDefinitions.ts +61 -0
- package/test/integration/generated/{lro/lroBasic → parameters/spread}/src/index.ts +4 -4
- package/test/integration/generated/parameters/spread/src/models.ts +7 -0
- package/test/integration/generated/parameters/spread/src/parameters.ts +61 -0
- package/test/integration/generated/parameters/spread/src/parametersSpread.ts +31 -0
- package/test/integration/generated/parameters/spread/src/responses.ts +25 -0
- package/test/integration/generated/parameters/spread/tspconfig.yaml +12 -0
- package/test/integration/generated/projection/src/clientDefinitions.ts +71 -0
- package/test/integration/generated/projection/src/index.ts +12 -0
- package/test/integration/generated/projection/src/models.ts +22 -0
- package/test/integration/generated/projection/src/parameters.ts +48 -0
- package/test/integration/generated/projection/src/projectionClient.ts +31 -0
- package/test/integration/generated/projection/src/responses.ts +34 -0
- package/test/integration/generated/projection/tspconfig.yaml +14 -0
- package/test/integration/generated/resiliency/srvDriven1/README.md +4 -4
- package/test/integration/generated/resiliency/srvDriven1/package.json +2 -2
- package/test/integration/generated/resiliency/srvDriven1/src/clientDefinitions.ts +25 -49
- package/test/integration/generated/resiliency/srvDriven1/src/index.ts +3 -5
- package/test/integration/generated/resiliency/srvDriven1/src/parameters.ts +11 -32
- package/test/integration/generated/resiliency/srvDriven1/src/responses.ts +9 -24
- package/test/integration/generated/resiliency/srvDriven1/src/serviceDrivenOldClient.ts +39 -0
- package/test/integration/generated/resiliency/srvDriven1/tspconfig.yaml +6 -2
- package/test/integration/generated/resiliency/srvDriven2/README.md +13 -4
- package/test/integration/generated/resiliency/srvDriven2/package.json +2 -2
- package/test/integration/generated/resiliency/srvDriven2/src/clientDefinitions.ts +32 -68
- package/test/integration/generated/resiliency/srvDriven2/src/index.ts +3 -5
- package/test/integration/generated/resiliency/srvDriven2/src/parameters.ts +19 -42
- package/test/integration/generated/resiliency/srvDriven2/src/responses.ts +10 -31
- package/test/integration/generated/resiliency/srvDriven2/src/serviceDrivenNewClient.ts +39 -0
- package/test/integration/generated/resiliency/srvDriven2/tspconfig.yaml +6 -2
- package/test/integration/generated/server/path/multiple/src/clientDefinitions.ts +35 -0
- package/test/integration/generated/server/path/multiple/src/index.ts +11 -0
- package/test/integration/generated/server/path/multiple/src/multipleParamInServerPathClient.ts +39 -0
- package/test/integration/generated/server/path/multiple/src/parameters.ts +7 -0
- package/test/integration/generated/server/path/multiple/src/responses.ts +14 -0
- package/test/integration/generated/server/path/multiple/tspconfig.yaml +14 -0
- package/test/integration/generated/server/path/single/src/clientDefinitions.ts +19 -0
- package/test/integration/generated/server/path/single/src/index.ts +11 -0
- package/test/integration/generated/server/path/single/src/parameters.ts +6 -0
- package/test/integration/generated/server/path/single/src/responses.ts +9 -0
- package/test/integration/generated/server/path/single/src/singleParamInServerPathClient.ts +34 -0
- package/test/integration/generated/server/path/single/tspconfig.yaml +14 -0
- package/test/integration/generated/specialWords/tspconfig.yaml +5 -2
- package/test/integration/generated/unions/src/clientDefinitions.ts +8 -8
- package/test/integration/generated/unions/tspconfig.yaml +5 -2
- package/test/integration/internal.spec.ts +43 -0
- package/test/integration/lroCore.spec.ts +89 -0
- package/test/integration/modelInheritance.spec.ts +13 -13
- package/test/integration/modelPropertyNullable.spec.ts +115 -0
- package/test/integration/modelPropertyOptional.spec.ts +32 -32
- package/test/integration/modelPropertyType.spec.ts +6 -6
- package/test/integration/modelUsage.spec.ts +7 -7
- package/test/integration/projection.spec.ts +102 -0
- package/test/integration/resiliencyDpgCustomization.spec.ts +69 -35
- package/test/integration/server.spec.ts +59 -0
- package/test/integration/spreadParameters.spec.ts +82 -0
- package/test/integration/unions.spec.ts +4 -4
- package/test/unit/apiVersion.spec.ts +388 -0
- package/test/unit/clientFactoryGenerator.spec.ts +0 -131
- package/test/unit/modelsGenerator.spec.ts +2 -2
- package/test/unit/parametersGenerator.spec.ts +1 -1
- package/test/unit/responsesGenerator.spec.ts +1 -1
- package/test/unit/util/emitUtil.ts +6 -5
- package/test/unit/util/testUtil.ts +3 -3
- package/dist/src/transform/transformAnnotationDetails.d.ts +0 -6
- package/dist/src/transform/transformAnnotationDetails.d.ts.map +0 -1
- package/dist/src/transform/transformAnnotationDetails.js.map +0 -1
- package/dist/src/transform/transformApiVersionParam.d.ts +0 -5
- package/dist/src/transform/transformApiVersionParam.d.ts.map +0 -1
- package/dist/src/transform/transformApiVersionParam.js +0 -76
- package/dist/src/transform/transformApiVersionParam.js.map +0 -1
- package/src/transform/transformApiVersionParam.ts +0 -104
- package/test/integration/generated/lro/lroBasic/src/clientDefinitions.ts +0 -37
- package/test/integration/generated/lro/lroBasic/src/parameters.ts +0 -8
- package/test/integration/generated/lro/lroBasic/src/responses.ts +0 -22
- package/test/integration/generated/lro/lroBasic/tspconfig.yaml +0 -11
- package/test/integration/generated/resiliency/devDriven/src/clientDefinitions.ts +0 -75
- package/test/integration/generated/resiliency/devDriven/src/models.ts +0 -8
- package/test/integration/generated/resiliency/devDriven/src/outputModels.ts +0 -25
- package/test/integration/generated/resiliency/devDriven/src/parameters.ts +0 -17
- package/test/integration/generated/resiliency/devDriven/src/responses.ts +0 -62
- package/test/integration/generated/resiliency/devDriven/tspconfig.yaml +0 -11
- package/test/integration/generated/resiliency/srvDriven1/src/models.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven1/src/outputModels.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven1/src/resiliencyServiceDriven1.ts +0 -31
- package/test/integration/generated/resiliency/srvDriven2/src/models.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven2/src/outputModels.ts +0 -6
- package/test/integration/generated/resiliency/srvDriven2/src/resiliencyServiceDriven2.ts +0 -31
- package/test/integration/helloWorld.spec.ts +0 -20
- package/test/integration/lroBasic.spec.ts +0 -25
- /package/test/integration/generated/{resiliency/devDriven → azure/core}/.eslintrc.json +0 -0
- /package/test/integration/generated/{resiliency/devDriven → azure/core}/rollup.config.js +0 -0
- /package/test/integration/generated/{resiliency/devDriven → azure/core}/tsconfig.json +0 -0
- /package/test/integration/generated/{lro/lroBasic → azure/core-traits}/.eslintrc.json +0 -0
- /package/test/integration/generated/{lro/lroBasic → azure/core-traits}/rollup.config.js +0 -0
- /package/test/integration/generated/{lro/lroBasic → azure/core-traits}/tsconfig.json +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import TypePropertyOptionalClientFactory, {
|
|
2
|
+
TypePropertyOptionalClient
|
|
3
3
|
} from "./generated/models/propertyOptional/src/index.js";
|
|
4
4
|
import { assert } from "chai";
|
|
5
5
|
|
|
6
6
|
describe("ModelsPropertyOptional Rest Client", () => {
|
|
7
|
-
let client:
|
|
7
|
+
let client: TypePropertyOptionalClient;
|
|
8
8
|
|
|
9
9
|
beforeEach(() => {
|
|
10
|
-
client =
|
|
10
|
+
client = TypePropertyOptionalClientFactory({
|
|
11
11
|
allowInsecureConnection: true
|
|
12
12
|
});
|
|
13
13
|
});
|
|
@@ -15,7 +15,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
15
15
|
it("should get all string", async () => {
|
|
16
16
|
try {
|
|
17
17
|
const result = await client
|
|
18
|
-
.path("/
|
|
18
|
+
.path("/type/property/optional/string/all")
|
|
19
19
|
.get();
|
|
20
20
|
assert.strictEqual(result.status, "200");
|
|
21
21
|
assert.strictEqual(result.body.property, "hello");
|
|
@@ -27,7 +27,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
27
27
|
it("should get default string", async () => {
|
|
28
28
|
try {
|
|
29
29
|
const result = await client
|
|
30
|
-
.path("/
|
|
30
|
+
.path("/type/property/optional/string/default")
|
|
31
31
|
.get();
|
|
32
32
|
assert.strictEqual(result.status, "200");
|
|
33
33
|
} catch (err) {
|
|
@@ -38,7 +38,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
38
38
|
it("should put all string", async () => {
|
|
39
39
|
try {
|
|
40
40
|
const result = await client
|
|
41
|
-
.path("/
|
|
41
|
+
.path("/type/property/optional/string/all")
|
|
42
42
|
.put({
|
|
43
43
|
body: { property: "hello" }
|
|
44
44
|
});
|
|
@@ -51,7 +51,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
51
51
|
it("should put default string", async () => {
|
|
52
52
|
try {
|
|
53
53
|
const result = await client
|
|
54
|
-
.path("/
|
|
54
|
+
.path("/type/property/optional/string/default")
|
|
55
55
|
.put({ body: {} });
|
|
56
56
|
assert.strictEqual(result.status, "204");
|
|
57
57
|
} catch (err) {
|
|
@@ -62,7 +62,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
62
62
|
it("should get all bytes", async () => {
|
|
63
63
|
try {
|
|
64
64
|
const result = await client
|
|
65
|
-
.path("/
|
|
65
|
+
.path("/type/property/optional/bytes/all")
|
|
66
66
|
.get();
|
|
67
67
|
assert.strictEqual(result.status, "200");
|
|
68
68
|
assert.strictEqual(result.body.property, "aGVsbG8sIHdvcmxkIQ==");
|
|
@@ -74,7 +74,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
74
74
|
it("should get default bytes", async () => {
|
|
75
75
|
try {
|
|
76
76
|
const result = await client
|
|
77
|
-
.path("/
|
|
77
|
+
.path("/type/property/optional/bytes/default")
|
|
78
78
|
.get();
|
|
79
79
|
assert.strictEqual(result.status, "200");
|
|
80
80
|
} catch (err) {
|
|
@@ -85,7 +85,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
85
85
|
it("should put all bytes", async () => {
|
|
86
86
|
try {
|
|
87
87
|
const result = await client
|
|
88
|
-
.path("/
|
|
88
|
+
.path("/type/property/optional/bytes/all")
|
|
89
89
|
.put({
|
|
90
90
|
body: { property: "aGVsbG8sIHdvcmxkIQ==" }
|
|
91
91
|
});
|
|
@@ -98,7 +98,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
98
98
|
it("should put default bytes", async () => {
|
|
99
99
|
try {
|
|
100
100
|
const result = await client
|
|
101
|
-
.path("/
|
|
101
|
+
.path("/type/property/optional/bytes/default")
|
|
102
102
|
.put({
|
|
103
103
|
body: {}
|
|
104
104
|
});
|
|
@@ -111,7 +111,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
111
111
|
it("should get all datetime", async () => {
|
|
112
112
|
try {
|
|
113
113
|
const result = await client
|
|
114
|
-
.path("/
|
|
114
|
+
.path("/type/property/optional/datetime/all")
|
|
115
115
|
.get();
|
|
116
116
|
assert.strictEqual(result.status, "200");
|
|
117
117
|
assert.strictEqual(result.body.property, "2022-08-26T18:38:00Z");
|
|
@@ -123,7 +123,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
123
123
|
it("should get default datetime", async () => {
|
|
124
124
|
try {
|
|
125
125
|
const result = await client
|
|
126
|
-
.path("/
|
|
126
|
+
.path("/type/property/optional/datetime/default")
|
|
127
127
|
.get();
|
|
128
128
|
assert.strictEqual(result.status, "200");
|
|
129
129
|
} catch (err) {
|
|
@@ -134,7 +134,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
134
134
|
it("should put all datetime", async () => {
|
|
135
135
|
try {
|
|
136
136
|
const result = await client
|
|
137
|
-
.path("/
|
|
137
|
+
.path("/type/property/optional/datetime/all")
|
|
138
138
|
.put({
|
|
139
139
|
body: { property: "2022-08-26T18:38:00Z" }
|
|
140
140
|
});
|
|
@@ -147,7 +147,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
147
147
|
it("should put default datetime", async () => {
|
|
148
148
|
try {
|
|
149
149
|
const result = await client
|
|
150
|
-
.path("/
|
|
150
|
+
.path("/type/property/optional/datetime/default")
|
|
151
151
|
.put({
|
|
152
152
|
body: {}
|
|
153
153
|
});
|
|
@@ -160,7 +160,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
160
160
|
it("should get all duration", async () => {
|
|
161
161
|
try {
|
|
162
162
|
const result = await client
|
|
163
|
-
.path("/
|
|
163
|
+
.path("/type/property/optional/duration/all")
|
|
164
164
|
.get();
|
|
165
165
|
assert.strictEqual(result.status, "200");
|
|
166
166
|
assert.strictEqual(result.body.property, "P123DT22H14M12.011S");
|
|
@@ -172,7 +172,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
172
172
|
it("should get default duration", async () => {
|
|
173
173
|
try {
|
|
174
174
|
const result = await client
|
|
175
|
-
.path("/
|
|
175
|
+
.path("/type/property/optional/duration/default")
|
|
176
176
|
.get();
|
|
177
177
|
assert.strictEqual(result.status, "200");
|
|
178
178
|
} catch (err) {
|
|
@@ -183,7 +183,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
183
183
|
it("should put all duration", async () => {
|
|
184
184
|
try {
|
|
185
185
|
const result = await client
|
|
186
|
-
.path("/
|
|
186
|
+
.path("/type/property/optional/duration/all")
|
|
187
187
|
.put({
|
|
188
188
|
body: { property: "P123DT22H14M12.011S" }
|
|
189
189
|
});
|
|
@@ -196,7 +196,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
196
196
|
it("should put default duration", async () => {
|
|
197
197
|
try {
|
|
198
198
|
const result = await client
|
|
199
|
-
.path("/
|
|
199
|
+
.path("/type/property/optional/duration/default")
|
|
200
200
|
.put({
|
|
201
201
|
body: {}
|
|
202
202
|
});
|
|
@@ -209,7 +209,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
209
209
|
it("should get all collections bytes", async () => {
|
|
210
210
|
try {
|
|
211
211
|
const result = await client
|
|
212
|
-
.path("/
|
|
212
|
+
.path("/type/property/optional/collections/bytes/all")
|
|
213
213
|
.get();
|
|
214
214
|
assert.strictEqual(result.status, "200");
|
|
215
215
|
assert.strictEqual(result.body.property?.length, 2);
|
|
@@ -221,7 +221,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
221
221
|
it("should get default collections bytes", async () => {
|
|
222
222
|
try {
|
|
223
223
|
const result = await client
|
|
224
|
-
.path("/
|
|
224
|
+
.path("/type/property/optional/collections/bytes/default")
|
|
225
225
|
.get();
|
|
226
226
|
assert.strictEqual(result.status, "200");
|
|
227
227
|
} catch (err) {
|
|
@@ -232,7 +232,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
232
232
|
it("should put all collections bytes", async () => {
|
|
233
233
|
try {
|
|
234
234
|
const result = await client
|
|
235
|
-
.path("/
|
|
235
|
+
.path("/type/property/optional/collections/bytes/all")
|
|
236
236
|
.put({
|
|
237
237
|
body: { property: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="] }
|
|
238
238
|
});
|
|
@@ -245,7 +245,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
245
245
|
it("should put default collections bytes", async () => {
|
|
246
246
|
try {
|
|
247
247
|
const result = await client
|
|
248
|
-
.path("/
|
|
248
|
+
.path("/type/property/optional/collections/bytes/default")
|
|
249
249
|
.put({
|
|
250
250
|
body: {}
|
|
251
251
|
});
|
|
@@ -258,7 +258,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
258
258
|
it("should get all collections model", async () => {
|
|
259
259
|
try {
|
|
260
260
|
const result = await client
|
|
261
|
-
.path("/
|
|
261
|
+
.path("/type/property/optional/collections/model/all")
|
|
262
262
|
.get();
|
|
263
263
|
assert.strictEqual(result.status, "200");
|
|
264
264
|
assert.strictEqual(result.body.property?.length, 2);
|
|
@@ -270,7 +270,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
270
270
|
it("should get default collections model", async () => {
|
|
271
271
|
try {
|
|
272
272
|
const result = await client
|
|
273
|
-
.path("/
|
|
273
|
+
.path("/type/property/optional/collections/model/default")
|
|
274
274
|
.get();
|
|
275
275
|
assert.strictEqual(result.status, "200");
|
|
276
276
|
} catch (err) {
|
|
@@ -281,7 +281,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
281
281
|
it("should put all collections model", async () => {
|
|
282
282
|
try {
|
|
283
283
|
const result = await client
|
|
284
|
-
.path("/
|
|
284
|
+
.path("/type/property/optional/collections/model/all")
|
|
285
285
|
.put({
|
|
286
286
|
body: { property: [{ property: "hello" }, { property: "world" }] }
|
|
287
287
|
});
|
|
@@ -294,7 +294,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
294
294
|
it("should put default collections model", async () => {
|
|
295
295
|
try {
|
|
296
296
|
const result = await client
|
|
297
|
-
.path("/
|
|
297
|
+
.path("/type/property/optional/collections/model/default")
|
|
298
298
|
.put({
|
|
299
299
|
body: {}
|
|
300
300
|
});
|
|
@@ -307,7 +307,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
307
307
|
it("should get models that will return all properties in the model", async () => {
|
|
308
308
|
try {
|
|
309
309
|
const result = await client
|
|
310
|
-
.path("/
|
|
310
|
+
.path("/type/property/optional/requiredAndOptional/all")
|
|
311
311
|
.get();
|
|
312
312
|
assert.strictEqual(result.status, "200");
|
|
313
313
|
assert.strictEqual(result.body.optionalProperty, "hello");
|
|
@@ -320,7 +320,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
320
320
|
it("should get models that will return only the required properties", async () => {
|
|
321
321
|
try {
|
|
322
322
|
const result = await client
|
|
323
|
-
.path("/
|
|
323
|
+
.path("/type/property/optional/requiredAndOptional/requiredOnly")
|
|
324
324
|
.get();
|
|
325
325
|
assert.strictEqual(result.status, "200");
|
|
326
326
|
assert.strictEqual(result.body.requiredProperty, 42);
|
|
@@ -332,7 +332,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
332
332
|
it("should put a body with all properties present", async () => {
|
|
333
333
|
try {
|
|
334
334
|
const result = await client
|
|
335
|
-
.path("/
|
|
335
|
+
.path("/type/property/optional/requiredAndOptional/all")
|
|
336
336
|
.put({
|
|
337
337
|
body: {
|
|
338
338
|
requiredProperty: 42,
|
|
@@ -348,7 +348,7 @@ describe("ModelsPropertyOptional Rest Client", () => {
|
|
|
348
348
|
it("should put a body with only required properties", async () => {
|
|
349
349
|
try {
|
|
350
350
|
const result = await client
|
|
351
|
-
.path("/
|
|
351
|
+
.path("/type/property/optional/requiredAndOptional/requiredOnly")
|
|
352
352
|
.put({
|
|
353
353
|
body: {
|
|
354
354
|
requiredProperty: 42
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import TypePropertyValueTypesClientFactory, {
|
|
2
|
+
TypePropertyValueTypesClient
|
|
3
3
|
} from "./generated/models/propertyTypes/src/index.js";
|
|
4
4
|
import { assert } from "chai";
|
|
5
5
|
import { matrix } from "../util/matrix.js";
|
|
@@ -74,10 +74,10 @@ const testedTypes: TypeDetail[] = [
|
|
|
74
74
|
}
|
|
75
75
|
];
|
|
76
76
|
describe("ModelsPropertyTypesClient Rest Client", () => {
|
|
77
|
-
let client:
|
|
77
|
+
let client: TypePropertyValueTypesClient;
|
|
78
78
|
|
|
79
79
|
beforeEach(() => {
|
|
80
|
-
client =
|
|
80
|
+
client = TypePropertyValueTypesClientFactory({
|
|
81
81
|
allowInsecureConnection: true
|
|
82
82
|
});
|
|
83
83
|
});
|
|
@@ -86,7 +86,7 @@ describe("ModelsPropertyTypesClient Rest Client", () => {
|
|
|
86
86
|
it(`should get a ${params.type} value`, async () => {
|
|
87
87
|
try {
|
|
88
88
|
const result = await client
|
|
89
|
-
.path(`/
|
|
89
|
+
.path(`/type/property/value-types/${params.type}` as any)
|
|
90
90
|
.get();
|
|
91
91
|
assert.strictEqual(result.status, "200");
|
|
92
92
|
assert.deepEqual(result.body.property, params.defaultValue);
|
|
@@ -104,7 +104,7 @@ describe("ModelsPropertyTypesClient Rest Client", () => {
|
|
|
104
104
|
property = params.defaultValue;
|
|
105
105
|
}
|
|
106
106
|
const result = await client
|
|
107
|
-
.path(`/
|
|
107
|
+
.path(`/type/property/value-types/${params.type}` as any)
|
|
108
108
|
.put({
|
|
109
109
|
body: {
|
|
110
110
|
property
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import TypeModelUsageClientFactory, {
|
|
2
|
+
TypeModelUsageClient
|
|
3
3
|
} from "./generated/models/usage/src/index.js";
|
|
4
4
|
import { assert } from "chai";
|
|
5
5
|
describe("ModelsUsageClient Rest Client", () => {
|
|
6
|
-
let client:
|
|
6
|
+
let client: TypeModelUsageClient;
|
|
7
7
|
const body = {
|
|
8
8
|
requiredProp: "example-value"
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
beforeEach(() => {
|
|
12
|
-
client =
|
|
12
|
+
client = TypeModelUsageClientFactory({ allowInsecureConnection: true });
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it("should post input model correctly", async () => {
|
|
16
16
|
try {
|
|
17
|
-
const result = await client.path("/
|
|
17
|
+
const result = await client.path("/type/model/usage/input").post({
|
|
18
18
|
body
|
|
19
19
|
});
|
|
20
20
|
assert.strictEqual(result.status, "204");
|
|
@@ -25,7 +25,7 @@ describe("ModelsUsageClient Rest Client", () => {
|
|
|
25
25
|
|
|
26
26
|
it("should get output model correctly", async () => {
|
|
27
27
|
try {
|
|
28
|
-
const result = await client.path("/
|
|
28
|
+
const result = await client.path("/type/model/usage/output").get();
|
|
29
29
|
assert.strictEqual(result.status, "200");
|
|
30
30
|
assert.deepEqual(result.body, body);
|
|
31
31
|
} catch (err) {
|
|
@@ -36,7 +36,7 @@ describe("ModelsUsageClient Rest Client", () => {
|
|
|
36
36
|
it("should get output model correctly", async () => {
|
|
37
37
|
try {
|
|
38
38
|
const result = await client
|
|
39
|
-
.path("/
|
|
39
|
+
.path("/type/model/usage/input-output")
|
|
40
40
|
.post({ body });
|
|
41
41
|
assert.strictEqual(result.status, "200");
|
|
42
42
|
assert.deepEqual(result.body, body);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import ProjectionClientFactory, {
|
|
3
|
+
ProjectionClient
|
|
4
|
+
} from "./generated/projection/src/index.js";
|
|
5
|
+
describe("Projected Name Rest Client", () => {
|
|
6
|
+
let client: ProjectionClient;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
client = ProjectionClientFactory({
|
|
10
|
+
allowInsecureConnection: true,
|
|
11
|
+
retryOptions: {
|
|
12
|
+
maxRetries: 0
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should respect json projection", async () => {
|
|
18
|
+
try {
|
|
19
|
+
const result = await client
|
|
20
|
+
.path("/projection/projected-name/property/json")
|
|
21
|
+
.post({
|
|
22
|
+
body: {
|
|
23
|
+
wireName: true
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
assert.strictEqual(result.status, "204");
|
|
27
|
+
} catch (err) {
|
|
28
|
+
assert.fail(err as string);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should not respect client projection", async () => {
|
|
33
|
+
try {
|
|
34
|
+
const result = await client
|
|
35
|
+
.path("/projection/projected-name/property/client")
|
|
36
|
+
.post({
|
|
37
|
+
body: {
|
|
38
|
+
defaultName: true
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
assert.strictEqual(result.status, "204");
|
|
42
|
+
} catch (err) {
|
|
43
|
+
assert.fail(err as string);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should not respect language projection", async () => {
|
|
48
|
+
try {
|
|
49
|
+
const result = await client
|
|
50
|
+
.path("/projection/projected-name/property/language")
|
|
51
|
+
.post({
|
|
52
|
+
body: {
|
|
53
|
+
defaultName: true
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
assert.strictEqual(result.status, "204");
|
|
57
|
+
} catch (err) {
|
|
58
|
+
assert.fail(err as string);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("should not respect language projection", async () => {
|
|
63
|
+
try {
|
|
64
|
+
const result = await client
|
|
65
|
+
.path("/projection/projected-name/property/json-and-client")
|
|
66
|
+
.post({
|
|
67
|
+
body: {
|
|
68
|
+
wireName: true
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
assert.strictEqual(result.status, "204");
|
|
72
|
+
} catch (err) {
|
|
73
|
+
assert.fail(err as string);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("should not respect operation projection", async () => {
|
|
78
|
+
try {
|
|
79
|
+
const result = await client
|
|
80
|
+
.path("/projection/projected-name/operation")
|
|
81
|
+
.post();
|
|
82
|
+
assert.strictEqual(result.status, "204");
|
|
83
|
+
} catch (err) {
|
|
84
|
+
assert.fail(err as string);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("should not respect operation projection", async () => {
|
|
89
|
+
try {
|
|
90
|
+
const result = await client
|
|
91
|
+
.path("/projection/projected-name/parameter")
|
|
92
|
+
.post({
|
|
93
|
+
queryParameters: {
|
|
94
|
+
"default-name": "true"
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
assert.strictEqual(result.status, "204");
|
|
98
|
+
} catch (err) {
|
|
99
|
+
assert.fail(err as string);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -1,52 +1,86 @@
|
|
|
1
1
|
import { assert } from "chai";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
} from "./generated/resiliency/
|
|
2
|
+
import ServiceDrivenOldClientFactory, {
|
|
3
|
+
ServiceDrivenOldClient
|
|
4
|
+
} from "./generated/resiliency/srvDriven1/src/index.js";
|
|
5
|
+
import ServiceDrivenNewClientFactory, {
|
|
6
|
+
ServiceDrivenNewClient
|
|
7
|
+
} from "./generated/resiliency/srvDriven2/src/index.js";
|
|
5
8
|
describe("ResiliencyDevDrivenClient Rest Client", () => {
|
|
6
|
-
let
|
|
9
|
+
let client1: ServiceDrivenOldClient;
|
|
7
10
|
|
|
8
11
|
beforeEach(() => {
|
|
9
|
-
|
|
12
|
+
client1 = ServiceDrivenOldClientFactory("v1", {
|
|
10
13
|
allowInsecureConnection: true
|
|
11
14
|
});
|
|
12
15
|
});
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
// comment out these test cases because the server is not ready
|
|
16
|
-
// https://github.com/Azure/autorest.typescript/issues/1535
|
|
17
|
-
xit("should get model", async () => {
|
|
18
|
-
const result = await client
|
|
19
|
-
.path("/resiliency/devdriven/customization/model/{mode}", "raw")
|
|
20
|
-
.get();
|
|
21
|
-
console.log(result);
|
|
22
|
-
assert.equal(result.status, "200");
|
|
23
|
-
assert.equal(result.body.received, "raw");
|
|
24
|
-
});
|
|
17
|
+
let client2: ServiceDrivenNewClient;
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.post({ body: { hello: "world!" } });
|
|
30
|
-
assert.equal(result.status, "200");
|
|
31
|
-
assert.equal(result.body.received, "raw");
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
client2 = ServiceDrivenNewClientFactory("v2", {
|
|
21
|
+
allowInsecureConnection: true
|
|
32
22
|
});
|
|
33
23
|
});
|
|
34
24
|
|
|
35
|
-
describe("
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
.path("/
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
assert.equal(
|
|
25
|
+
describe("resiliency with service driven", () => {
|
|
26
|
+
it("should work with none parameter", async () => {
|
|
27
|
+
const result1 = await client1
|
|
28
|
+
.path("/add-optional-param/from-none")
|
|
29
|
+
.head();
|
|
30
|
+
|
|
31
|
+
assert.equal(result1.status, "204");
|
|
32
|
+
const result2 = await client2.path("/add-optional-param/from-none").head({
|
|
33
|
+
queryParameters: {
|
|
34
|
+
"new-parameter": "new"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
assert.equal(result2.status, "204");
|
|
42
39
|
});
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
.path("/
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
it("should work with one optional parameter", async () => {
|
|
42
|
+
const result1 = await client1
|
|
43
|
+
.path("/add-optional-param/from-one-optional")
|
|
44
|
+
.get({
|
|
45
|
+
queryParameters: {
|
|
46
|
+
parameter: "optional"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
assert.equal(result1.status, "204");
|
|
50
|
+
const result2 = await client2
|
|
51
|
+
.path("/add-optional-param/from-one-optional")
|
|
52
|
+
.get({
|
|
53
|
+
queryParameters: {
|
|
54
|
+
parameter: "optional",
|
|
55
|
+
"new-parameter": "new"
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
assert.equal(result2.status, "204");
|
|
50
59
|
});
|
|
60
|
+
|
|
61
|
+
it("should work with one required parameter", async () => {
|
|
62
|
+
const result1 = await client1
|
|
63
|
+
.path("/add-optional-param/from-one-required")
|
|
64
|
+
.get({
|
|
65
|
+
queryParameters: {
|
|
66
|
+
parameter: "required"
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
assert.equal(result1.status, "204");
|
|
70
|
+
const result2 = await client2
|
|
71
|
+
.path("/add-optional-param/from-one-required")
|
|
72
|
+
.get({
|
|
73
|
+
queryParameters: {
|
|
74
|
+
parameter: "required",
|
|
75
|
+
"new-parameter": "new"
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
assert.equal(result2.status, "204");
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should work with add operation", async () => {
|
|
83
|
+
const result2 = await client2.path("/add-operation").delete()
|
|
84
|
+
assert.equal(result2.status, "204");
|
|
51
85
|
});
|
|
52
86
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import SingleParamInServerPathClientFactory, {
|
|
3
|
+
SingleParamInServerPathClient
|
|
4
|
+
} from "./generated/server/path/single/src/index.js";
|
|
5
|
+
import MultipleParamInServerPathClientFactory, {
|
|
6
|
+
MultipleParamInServerPathClient
|
|
7
|
+
} from "./generated/server/path/multiple/src/index.js";
|
|
8
|
+
describe("SingleParamInServerPath Rest Client", () => {
|
|
9
|
+
let client: SingleParamInServerPathClient;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
client = SingleParamInServerPathClientFactory("http://localhost:3000", {
|
|
13
|
+
allowInsecureConnection: true,
|
|
14
|
+
retryOptions: {
|
|
15
|
+
maxRetries: 0
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should work with no param", async () => {
|
|
21
|
+
try {
|
|
22
|
+
const result = await client.path("/server/path/single/myOp").head();
|
|
23
|
+
assert.strictEqual(result.status, "200");
|
|
24
|
+
} catch (err) {
|
|
25
|
+
assert.fail(err as string);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("MultipleParamInServerPath Rest Client", () => {
|
|
31
|
+
let client: MultipleParamInServerPathClient;
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
client = MultipleParamInServerPathClientFactory("http://localhost:3000", {
|
|
35
|
+
allowInsecureConnection: true,
|
|
36
|
+
retryOptions: {
|
|
37
|
+
maxRetries: 0
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should work with no param", async () => {
|
|
43
|
+
try {
|
|
44
|
+
const result = await client.path("/").get();
|
|
45
|
+
assert.strictEqual(result.status, "204");
|
|
46
|
+
} catch (err) {
|
|
47
|
+
assert.fail(err as string);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should work with param", async () => {
|
|
52
|
+
try {
|
|
53
|
+
const result = await client.path("/{keyword}", "test").get();
|
|
54
|
+
assert.strictEqual(result.status, "204");
|
|
55
|
+
} catch (err) {
|
|
56
|
+
assert.fail(err as string);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|