@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,12 +1,13 @@
|
|
|
1
1
|
export interface CadlRanchConfig {
|
|
2
2
|
outputPath: string;
|
|
3
3
|
inputPath: string;
|
|
4
|
+
debug?: boolean;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
export const cadls: CadlRanchConfig[] = [
|
|
7
8
|
{
|
|
8
9
|
outputPath: "arrays/itemTypes",
|
|
9
|
-
inputPath: "
|
|
10
|
+
inputPath: "type/array"
|
|
10
11
|
},
|
|
11
12
|
{
|
|
12
13
|
outputPath: "authentication/apiKey",
|
|
@@ -22,55 +23,55 @@ export const cadls: CadlRanchConfig[] = [
|
|
|
22
23
|
},
|
|
23
24
|
{
|
|
24
25
|
outputPath: "dictionary",
|
|
25
|
-
inputPath: "dictionary"
|
|
26
|
+
inputPath: "type/dictionary"
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
outputPath: "enums/extensible",
|
|
29
|
-
inputPath: "
|
|
30
|
+
inputPath: "type/enum/extensible"
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
33
|
outputPath: "enums/fixed",
|
|
33
|
-
inputPath: "
|
|
34
|
+
inputPath: "type/enum/fixed"
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
|
-
outputPath: "
|
|
37
|
-
inputPath: "
|
|
37
|
+
outputPath: "lro/lroCore",
|
|
38
|
+
inputPath: "azure/core/lro/standard"
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
|
-
outputPath: "lro/
|
|
41
|
-
inputPath: "lro/
|
|
41
|
+
outputPath: "lro/lroRPC",
|
|
42
|
+
inputPath: "azure/core/lro/rpc"
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
45
|
outputPath: "models/inheritance",
|
|
45
|
-
inputPath: "
|
|
46
|
+
inputPath: "type/model/inheritance"
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
outputPath: "models/propertyOptional",
|
|
49
|
-
inputPath: "
|
|
50
|
+
inputPath: "type/property/optional"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
outputPath: "models/propertyNullable",
|
|
54
|
+
inputPath: "type/property/nullable"
|
|
50
55
|
},
|
|
51
56
|
{
|
|
52
57
|
outputPath: "models/propertyTypes",
|
|
53
|
-
inputPath: "
|
|
58
|
+
inputPath: "type/property/value-types"
|
|
54
59
|
},
|
|
55
60
|
{
|
|
56
61
|
outputPath: "models/visibility",
|
|
57
|
-
inputPath: "
|
|
62
|
+
inputPath: "type/model/visibility"
|
|
58
63
|
},
|
|
59
64
|
{
|
|
60
65
|
outputPath: "models/usage",
|
|
61
|
-
inputPath: "
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
outputPath: "resiliency/devDriven",
|
|
65
|
-
inputPath: "resiliency/dev-driven"
|
|
66
|
+
inputPath: "type/model/usage"
|
|
66
67
|
},
|
|
67
68
|
{
|
|
68
69
|
outputPath: "resiliency/srvDriven1",
|
|
69
|
-
inputPath: "resiliency/srv-driven
|
|
70
|
+
inputPath: "resiliency/srv-driven/old.tsp"
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
outputPath: "resiliency/srvDriven2",
|
|
73
|
-
inputPath: "resiliency/srv-driven
|
|
74
|
+
inputPath: "resiliency/srv-driven/main.tsp"
|
|
74
75
|
},
|
|
75
76
|
{
|
|
76
77
|
outputPath: "specialWords",
|
|
@@ -78,6 +79,38 @@ export const cadls: CadlRanchConfig[] = [
|
|
|
78
79
|
},
|
|
79
80
|
{
|
|
80
81
|
outputPath: "unions",
|
|
81
|
-
inputPath: "
|
|
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"
|
|
82
115
|
}
|
|
83
116
|
];
|
|
@@ -4,15 +4,19 @@ import pkg from "chalk";
|
|
|
4
4
|
const { bold } = pkg;
|
|
5
5
|
const logError = (str: string) => console.error(bold.red(str));
|
|
6
6
|
|
|
7
|
-
async function generateCadls() {
|
|
7
|
+
async function generateCadls(isDebugging = false) {
|
|
8
8
|
const list = cadls;
|
|
9
9
|
for (const cadl of list) {
|
|
10
|
+
if (isDebugging === true && cadl.debug !== true) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
10
13
|
await runTypespec(cadl);
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
async function main() {
|
|
15
|
-
|
|
18
|
+
const isDebugging = process.argv.indexOf("--debug") !== -1;
|
|
19
|
+
await generateCadls(isDebugging);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
main().catch((error) => {
|
package/test/commands/run.ts
CHANGED
|
@@ -14,25 +14,15 @@ export async function runTypespec(config: CadlRanchConfig) {
|
|
|
14
14
|
`${__dirname}`,
|
|
15
15
|
"..",
|
|
16
16
|
"..",
|
|
17
|
-
`./
|
|
17
|
+
`./temp/http/${sourceTypespec}`
|
|
18
18
|
);
|
|
19
|
-
// const emitterPath = joinPath(
|
|
20
|
-
// `${__dirname}`,
|
|
21
|
-
// "..",
|
|
22
|
-
// "..",
|
|
23
|
-
// "./dist/src/index.js"
|
|
24
|
-
// );
|
|
25
19
|
const outputPath = joinPath(
|
|
26
20
|
`${__dirname}`,
|
|
27
21
|
"..",
|
|
28
22
|
`./integration/generated/${targetFolder}`
|
|
29
23
|
);
|
|
30
|
-
const typespecCommand = `cd ${outputPath} && tsp`;
|
|
31
|
-
const commandArguments: string[] = [
|
|
32
|
-
"compile",
|
|
33
|
-
`${typespecPath}`,
|
|
34
|
-
`--output-path=.`
|
|
35
|
-
];
|
|
24
|
+
const typespecCommand = `cd ${outputPath} && npx tsp`;
|
|
25
|
+
const commandArguments: string[] = ["compile", `${typespecPath}`];
|
|
36
26
|
const command = `${typespecCommand} ${commandArguments.join(" ")}`;
|
|
37
27
|
console.log(command);
|
|
38
28
|
const result = execSync(command);
|
|
@@ -46,6 +46,10 @@ const testedTypes: TypeDetail[] = [
|
|
|
46
46
|
{
|
|
47
47
|
type: "model",
|
|
48
48
|
defaultValue: [{ property: "hello" }, { property: "world" }]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "nullable-float",
|
|
52
|
+
defaultValue: [1.2, null, 3.0]
|
|
49
53
|
}
|
|
50
54
|
];
|
|
51
55
|
describe("Array Item-Types Client", () => {
|
|
@@ -61,10 +65,9 @@ describe("Array Item-Types Client", () => {
|
|
|
61
65
|
it(`should get a ${params.type} value`, async () => {
|
|
62
66
|
try {
|
|
63
67
|
const result = await client
|
|
64
|
-
.path(`/
|
|
68
|
+
.path(`/type/array/${params.type}` as any)
|
|
65
69
|
.get();
|
|
66
70
|
assert.strictEqual(result.status, "200");
|
|
67
|
-
console.log("debug", result.body, params.defaultValue);
|
|
68
71
|
assert.deepEqual(result.body, params.defaultValue);
|
|
69
72
|
} catch (err) {
|
|
70
73
|
assert.fail(err as string);
|
|
@@ -80,7 +83,7 @@ describe("Array Item-Types Client", () => {
|
|
|
80
83
|
property = params.defaultValue;
|
|
81
84
|
}
|
|
82
85
|
const result = await client
|
|
83
|
-
.path(`/
|
|
86
|
+
.path(`/type/array/${params.type}` as any)
|
|
84
87
|
.put({
|
|
85
88
|
body: property
|
|
86
89
|
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import AzureCoreClientFactory, {
|
|
3
|
+
AzureCoreClient, buildMultiCollection
|
|
4
|
+
} from "./generated/azure/core/src/index.js";
|
|
5
|
+
import AzureCoreTraitsClientFactory, {
|
|
6
|
+
AzureCoreTraitsClient
|
|
7
|
+
} from "./generated/azure/core-traits/src/index.js";
|
|
8
|
+
describe("Azure Core Rest Client", () => {
|
|
9
|
+
let client: AzureCoreClient;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
client = AzureCoreClientFactory({
|
|
13
|
+
allowInsecureConnection: true,
|
|
14
|
+
retryOptions: {
|
|
15
|
+
maxRetries: 0
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should put user", async () => {
|
|
21
|
+
try {
|
|
22
|
+
const result = await client.path("/azure/core/basic/users/{id}", 1).put({
|
|
23
|
+
body: {
|
|
24
|
+
name: "Madge"
|
|
25
|
+
},
|
|
26
|
+
contentType: "application/json"
|
|
27
|
+
});
|
|
28
|
+
assert.strictEqual(result.status, "200");
|
|
29
|
+
} catch (err) {
|
|
30
|
+
assert.fail(err as string);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
it("should patch user", async () => {
|
|
34
|
+
try {
|
|
35
|
+
const result = await client.path("/azure/core/basic/users/{id}", 1).patch({
|
|
36
|
+
contentType: "application/merge-patch+json",
|
|
37
|
+
body: {
|
|
38
|
+
name: "Madge"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
assert.strictEqual(result.status, "200");
|
|
42
|
+
} catch (err) {
|
|
43
|
+
assert.fail(err as string);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should get user", async () => {
|
|
48
|
+
try {
|
|
49
|
+
const result = await client.path("/azure/core/basic/users/{id}", 1).get();
|
|
50
|
+
assert.strictEqual(result.status, "200");
|
|
51
|
+
} catch (err) {
|
|
52
|
+
assert.fail(err as string);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should delete user", async () => {
|
|
57
|
+
try {
|
|
58
|
+
const result = await client.path("/azure/core/basic/users/{id}", 1).delete();
|
|
59
|
+
assert.strictEqual(result.status, "204");
|
|
60
|
+
} catch (err) {
|
|
61
|
+
assert.fail(err as string);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("should list users", async () => {
|
|
66
|
+
try {
|
|
67
|
+
const result = await client.path("/azure/core/basic/users").get({
|
|
68
|
+
queryParameters: {
|
|
69
|
+
top: 5,
|
|
70
|
+
skip: 10,
|
|
71
|
+
orderby: "id",
|
|
72
|
+
filter: "id lt 10",
|
|
73
|
+
select: buildMultiCollection(["id", "orders", "etag"], "select"),
|
|
74
|
+
expand: "orders"
|
|
75
|
+
},
|
|
76
|
+
skipUrlEncoding: true
|
|
77
|
+
});
|
|
78
|
+
assert.strictEqual(result.status, "200");
|
|
79
|
+
} catch (err) {
|
|
80
|
+
assert.fail(err as string);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("should list with pages", async () => {
|
|
85
|
+
try {
|
|
86
|
+
const result = await client.path("/azure/core/basic/page").get();
|
|
87
|
+
assert.strictEqual(result.status, "200");
|
|
88
|
+
} catch (err) {
|
|
89
|
+
assert.fail(err as string);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("Azure Core Traits Rest Client", () => {
|
|
95
|
+
let client: AzureCoreTraitsClient;
|
|
96
|
+
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
client = AzureCoreTraitsClientFactory({
|
|
99
|
+
allowInsecureConnection: true,
|
|
100
|
+
retryOptions: {
|
|
101
|
+
maxRetries: 0
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("should get user traits", async () => {
|
|
107
|
+
try {
|
|
108
|
+
const result = await client.path("/azure/core/traits/user/{id}", 1).get({
|
|
109
|
+
headers: {
|
|
110
|
+
foo: "123",
|
|
111
|
+
"If-Match": "valid",
|
|
112
|
+
"If-None-Match": "invalid",
|
|
113
|
+
"If-Modified-Since": "Thu, 26 Aug 2021 14:38:00 GMT",
|
|
114
|
+
"If-Unmodified-Since": "Fri, 26 Aug 2022 14:38:00 GMT"
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
assert.strictEqual(result.status, "200");
|
|
118
|
+
} catch (err) {
|
|
119
|
+
assert.fail(err as string);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// it("should delete user traits", async () => {
|
|
123
|
+
// try {
|
|
124
|
+
// const result = await client.path("/azure/traits/api/{apiVersion}/user/{id}", "2022-12-01-preview", 1).delete();
|
|
125
|
+
// assert.strictEqual(result.status, "204");
|
|
126
|
+
// } catch (err) {
|
|
127
|
+
// assert.fail(err as string);
|
|
128
|
+
// }
|
|
129
|
+
// });
|
|
130
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import CollectionFormatClientFactory, {
|
|
3
|
+
buildMultiCollection,
|
|
4
|
+
buildPipeCollection,
|
|
5
|
+
buildSsvCollection,
|
|
6
|
+
buildTsvCollection,
|
|
7
|
+
CollectionFormatClient
|
|
8
|
+
} from "./generated/parameters/collection-format/src/index.js";
|
|
9
|
+
describe("Collection Format Rest Client", () => {
|
|
10
|
+
let client: CollectionFormatClient;
|
|
11
|
+
const colors = ["blue", "red", "green"];
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
client = CollectionFormatClientFactory({
|
|
15
|
+
allowInsecureConnection: true,
|
|
16
|
+
retryOptions: {
|
|
17
|
+
maxRetries: 0
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should serialize multi format query array parameter", async () => {
|
|
23
|
+
try {
|
|
24
|
+
const result = await client.path("/parameters/collection-format/query/multi").get({
|
|
25
|
+
queryParameters: {
|
|
26
|
+
colors: buildMultiCollection(colors, "colors")
|
|
27
|
+
},
|
|
28
|
+
skipUrlEncoding: true
|
|
29
|
+
});
|
|
30
|
+
assert.strictEqual(result.status, "204");
|
|
31
|
+
} catch (err) {
|
|
32
|
+
assert.fail(err as string);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should serialize csv format query array parameter", async () => {
|
|
37
|
+
try {
|
|
38
|
+
const result = await client.path("/parameters/collection-format/query/csv").get({
|
|
39
|
+
queryParameters: {
|
|
40
|
+
colors: colors
|
|
41
|
+
},
|
|
42
|
+
skipUrlEncoding: true
|
|
43
|
+
});
|
|
44
|
+
assert.strictEqual(result.status, "204");
|
|
45
|
+
} catch (err) {
|
|
46
|
+
assert.fail(err as string);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("should serialize ssv format query array parameter", async () => {
|
|
51
|
+
try {
|
|
52
|
+
const result = await client.path("/parameters/collection-format/query/ssv").get({
|
|
53
|
+
queryParameters: {
|
|
54
|
+
colors: buildSsvCollection(colors)
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
assert.strictEqual(result.status, "204");
|
|
58
|
+
} catch (err) {
|
|
59
|
+
assert.fail(err as string);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should serialize tsv format query array parameter", async () => {
|
|
64
|
+
try {
|
|
65
|
+
const result = await client.path("/parameters/collection-format/query/tsv").get({
|
|
66
|
+
queryParameters: {
|
|
67
|
+
colors: buildTsvCollection(colors)
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
assert.strictEqual(result.status, "204");
|
|
71
|
+
} catch (err) {
|
|
72
|
+
assert.fail(err as string);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
it("should serialize pipes format query array parameter", async () => {
|
|
78
|
+
try {
|
|
79
|
+
const result = await client.path("/parameters/collection-format/query/pipes").get({
|
|
80
|
+
queryParameters: {
|
|
81
|
+
colors: buildPipeCollection(colors)
|
|
82
|
+
},
|
|
83
|
+
skipUrlEncoding: true
|
|
84
|
+
});
|
|
85
|
+
assert.strictEqual(result.status, "204");
|
|
86
|
+
} catch (err) {
|
|
87
|
+
assert.fail(err as string);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("should serialize csv format header array parameter", async () => {
|
|
92
|
+
try {
|
|
93
|
+
const result = await client.path("/parameters/collection-format/header/csv").get({
|
|
94
|
+
headers: {
|
|
95
|
+
colors: colors as any
|
|
96
|
+
},
|
|
97
|
+
skipUrlEncoding: true
|
|
98
|
+
});
|
|
99
|
+
assert.strictEqual(result.status, "204");
|
|
100
|
+
} catch (err) {
|
|
101
|
+
assert.fail(err as string);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// it.skip("should serialize default format query array parameter", async () => {
|
|
106
|
+
// try {
|
|
107
|
+
// const result = await client.path("/collectionFormat/default").get({
|
|
108
|
+
// queryParameters: {
|
|
109
|
+
// colors: buildMultiCollection(colors, 'colors')
|
|
110
|
+
// },
|
|
111
|
+
// skipUrlEncoding: true
|
|
112
|
+
// });
|
|
113
|
+
// assert.strictEqual(result.status, "200");
|
|
114
|
+
// } catch (err) {
|
|
115
|
+
// assert.fail(err as string);
|
|
116
|
+
// }
|
|
117
|
+
// });
|
|
118
|
+
});
|
|
@@ -56,6 +56,10 @@ const testedTypes: TypeDetail[] = [
|
|
|
56
56
|
children: { "k2.1": { property: "inner world" } }
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "nullable-float",
|
|
62
|
+
defaultValue: { k1: 1.2, k2: 0.5, k3: null }
|
|
59
63
|
}
|
|
60
64
|
];
|
|
61
65
|
describe("Dictionary Client", () => {
|
|
@@ -71,7 +75,7 @@ describe("Dictionary Client", () => {
|
|
|
71
75
|
it(`should get a ${params.type} value`, async () => {
|
|
72
76
|
try {
|
|
73
77
|
const result = await client
|
|
74
|
-
.path(`/dictionary/${params.type}` as any)
|
|
78
|
+
.path(`/type/dictionary/${params.type}` as any)
|
|
75
79
|
.get();
|
|
76
80
|
assert.strictEqual(result.status, "200");
|
|
77
81
|
assert.deepEqual(result.body, params.defaultValue);
|
|
@@ -89,7 +93,7 @@ describe("Dictionary Client", () => {
|
|
|
89
93
|
property = params.defaultValue;
|
|
90
94
|
}
|
|
91
95
|
const result = await client
|
|
92
|
-
.path(`/dictionary/${params.type}` as any)
|
|
96
|
+
.path(`/type/dictionary/${params.type}` as any)
|
|
93
97
|
.put({
|
|
94
98
|
body: property
|
|
95
99
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import TypeEnumExtensibleClientFactory, {
|
|
2
|
+
TypeEnumExtensibleClient
|
|
3
3
|
} from "./generated/enums/extensible/src/index.js";
|
|
4
4
|
import { assert } from "chai";
|
|
5
5
|
describe("ExtensibleEnums Rest Client", () => {
|
|
6
|
-
let client:
|
|
6
|
+
let client: TypeEnumExtensibleClient;
|
|
7
7
|
|
|
8
8
|
beforeEach(() => {
|
|
9
|
-
client =
|
|
9
|
+
client = TypeEnumExtensibleClientFactory({ allowInsecureConnection: true });
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
it("should get known value", async () => {
|
|
13
13
|
try {
|
|
14
14
|
const result = await client
|
|
15
|
-
.path("/
|
|
15
|
+
.path("/type/enum/extensible/string/known-value")
|
|
16
16
|
.get();
|
|
17
17
|
assert.strictEqual(result.status, "200");
|
|
18
18
|
assert.strictEqual(result.body, "Monday");
|
|
@@ -24,7 +24,7 @@ describe("ExtensibleEnums Rest Client", () => {
|
|
|
24
24
|
it("should put known value", async () => {
|
|
25
25
|
try {
|
|
26
26
|
const result = await client
|
|
27
|
-
.path("/
|
|
27
|
+
.path("/type/enum/extensible/string/known-value")
|
|
28
28
|
.put({
|
|
29
29
|
body: JSON.stringify("Monday")
|
|
30
30
|
});
|
|
@@ -37,7 +37,7 @@ describe("ExtensibleEnums Rest Client", () => {
|
|
|
37
37
|
it("should get unknown value", async () => {
|
|
38
38
|
try {
|
|
39
39
|
const result = await client
|
|
40
|
-
.path("/
|
|
40
|
+
.path("/type/enum/extensible/string/unknown-value")
|
|
41
41
|
.get();
|
|
42
42
|
assert.strictEqual(result.status, "200");
|
|
43
43
|
assert.strictEqual(result.body, "Weekend");
|
|
@@ -49,7 +49,7 @@ describe("ExtensibleEnums Rest Client", () => {
|
|
|
49
49
|
it("should put unknown value", async () => {
|
|
50
50
|
try {
|
|
51
51
|
const result = await client
|
|
52
|
-
.path("/
|
|
52
|
+
.path("/type/enum/extensible/string/unknown-value")
|
|
53
53
|
.put({
|
|
54
54
|
body: JSON.stringify("Weekend")
|
|
55
55
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { assert } from "chai";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import TypeEnumFixedClientFactory, {
|
|
3
|
+
TypeEnumFixedClient
|
|
4
4
|
} from "./generated/enums/fixed/src/index.js";
|
|
5
5
|
describe("FixedEnums Rest Client", () => {
|
|
6
|
-
let client:
|
|
6
|
+
let client: TypeEnumFixedClient;
|
|
7
7
|
|
|
8
8
|
beforeEach(() => {
|
|
9
|
-
client =
|
|
9
|
+
client = TypeEnumFixedClientFactory({
|
|
10
10
|
allowInsecureConnection: true,
|
|
11
11
|
retryOptions: {
|
|
12
12
|
maxRetries: 0
|
|
@@ -16,7 +16,7 @@ describe("FixedEnums Rest Client", () => {
|
|
|
16
16
|
|
|
17
17
|
it("should get known value", async () => {
|
|
18
18
|
try {
|
|
19
|
-
const result = await client.path("/
|
|
19
|
+
const result = await client.path("/type/enum/fixed/string/known-value").get();
|
|
20
20
|
assert.strictEqual(result.status, "200");
|
|
21
21
|
assert.strictEqual(result.body, "Monday");
|
|
22
22
|
} catch (err) {
|
|
@@ -26,7 +26,7 @@ describe("FixedEnums Rest Client", () => {
|
|
|
26
26
|
|
|
27
27
|
it("should put known value", async () => {
|
|
28
28
|
try {
|
|
29
|
-
const result = await client.path("/
|
|
29
|
+
const result = await client.path("/type/enum/fixed/string/known-value").put({
|
|
30
30
|
body: "Monday",
|
|
31
31
|
contentType: "application/json"
|
|
32
32
|
});
|
|
@@ -39,7 +39,7 @@ describe("FixedEnums Rest Client", () => {
|
|
|
39
39
|
it("should put unknown value and receives 500", async () => {
|
|
40
40
|
try {
|
|
41
41
|
const result = await client
|
|
42
|
-
.path("/
|
|
42
|
+
.path("/type/enum/fixed/string/unknown-value")
|
|
43
43
|
.put({
|
|
44
44
|
body: "Weekend" as any,
|
|
45
45
|
contentType: "application/json"
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
UnknownValuePutParameters,
|
|
21
21
|
ModelValueGetParameters,
|
|
22
22
|
ModelValuePutParameters,
|
|
23
|
+
NullableFloatValueGetParameters,
|
|
24
|
+
NullableFloatValuePutParameters,
|
|
23
25
|
} from "./parameters";
|
|
24
26
|
import {
|
|
25
27
|
Int32ValueGet200Response,
|
|
@@ -40,6 +42,8 @@ import {
|
|
|
40
42
|
UnknownValuePut204Response,
|
|
41
43
|
ModelValueGet200Response,
|
|
42
44
|
ModelValuePut204Response,
|
|
45
|
+
NullableFloatValueGet200Response,
|
|
46
|
+
NullableFloatValuePut204Response,
|
|
43
47
|
} from "./responses";
|
|
44
48
|
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
45
49
|
|
|
@@ -124,25 +128,36 @@ export interface ModelValueGet {
|
|
|
124
128
|
): StreamableMethod<ModelValuePut204Response>;
|
|
125
129
|
}
|
|
126
130
|
|
|
131
|
+
export interface NullableFloatValueGet {
|
|
132
|
+
get(
|
|
133
|
+
options?: NullableFloatValueGetParameters
|
|
134
|
+
): StreamableMethod<NullableFloatValueGet200Response>;
|
|
135
|
+
put(
|
|
136
|
+
options: NullableFloatValuePutParameters
|
|
137
|
+
): StreamableMethod<NullableFloatValuePut204Response>;
|
|
138
|
+
}
|
|
139
|
+
|
|
127
140
|
export interface Routes {
|
|
128
|
-
/** Resource for '/
|
|
129
|
-
(path: "/
|
|
130
|
-
/** Resource for '/
|
|
131
|
-
(path: "/
|
|
132
|
-
/** Resource for '/
|
|
133
|
-
(path: "/
|
|
134
|
-
/** Resource for '/
|
|
135
|
-
(path: "/
|
|
136
|
-
/** Resource for '/
|
|
137
|
-
(path: "/
|
|
138
|
-
/** Resource for '/
|
|
139
|
-
(path: "/
|
|
140
|
-
/** Resource for '/
|
|
141
|
-
(path: "/
|
|
142
|
-
/** Resource for '/
|
|
143
|
-
(path: "/
|
|
144
|
-
/** Resource for '/
|
|
145
|
-
(path: "/
|
|
141
|
+
/** Resource for '/type/array/int32' has methods for the following verbs: get, put */
|
|
142
|
+
(path: "/type/array/int32"): Int32ValueGet;
|
|
143
|
+
/** Resource for '/type/array/int64' has methods for the following verbs: get, put */
|
|
144
|
+
(path: "/type/array/int64"): Int64ValueGet;
|
|
145
|
+
/** Resource for '/type/array/boolean' has methods for the following verbs: get, put */
|
|
146
|
+
(path: "/type/array/boolean"): BooleanValueGet;
|
|
147
|
+
/** Resource for '/type/array/string' has methods for the following verbs: get, put */
|
|
148
|
+
(path: "/type/array/string"): StringValueGet;
|
|
149
|
+
/** Resource for '/type/array/float32' has methods for the following verbs: get, put */
|
|
150
|
+
(path: "/type/array/float32"): Float32ValueGet;
|
|
151
|
+
/** Resource for '/type/array/datetime' has methods for the following verbs: get, put */
|
|
152
|
+
(path: "/type/array/datetime"): DatetimeValueGet;
|
|
153
|
+
/** Resource for '/type/array/duration' has methods for the following verbs: get, put */
|
|
154
|
+
(path: "/type/array/duration"): DurationValueGet;
|
|
155
|
+
/** Resource for '/type/array/unknown' has methods for the following verbs: get, put */
|
|
156
|
+
(path: "/type/array/unknown"): UnknownValueGet;
|
|
157
|
+
/** Resource for '/type/array/model' has methods for the following verbs: get, put */
|
|
158
|
+
(path: "/type/array/model"): ModelValueGet;
|
|
159
|
+
/** Resource for '/type/array/nullable-float' has methods for the following verbs: get, put */
|
|
160
|
+
(path: "/type/array/nullable-float"): NullableFloatValueGet;
|
|
146
161
|
}
|
|
147
162
|
|
|
148
163
|
export type ArrayItemTypesClient = Client & {
|
|
@@ -76,3 +76,11 @@ export interface ModelValuePutBodyParam {
|
|
|
76
76
|
|
|
77
77
|
export type ModelValuePutParameters = ModelValuePutBodyParam &
|
|
78
78
|
RequestParameters;
|
|
79
|
+
export type NullableFloatValueGetParameters = RequestParameters;
|
|
80
|
+
|
|
81
|
+
export interface NullableFloatValuePutBodyParam {
|
|
82
|
+
body: (number | null)[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type NullableFloatValuePutParameters = NullableFloatValuePutBodyParam &
|
|
86
|
+
RequestParameters;
|