@azure-tools/typespec-ts 0.11.0
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/.eslintrc.json +23 -0
- package/.prettierignore +1 -0
- package/.prettierrc +7 -0
- package/.rush/temp/package-deps_build.json +303 -0
- package/.rush/temp/shrinkwrap-deps.json +469 -0
- package/CHANGELOG.md +65 -0
- package/CONTRIBUTING.md +134 -0
- package/README.md +150 -0
- package/dist/src/emitUtil.d.ts +6 -0
- package/dist/src/emitUtil.d.ts.map +1 -0
- package/dist/src/emitUtil.js +45 -0
- package/dist/src/emitUtil.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +59 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +159 -0
- package/dist/src/lib.d.ts.map +1 -0
- package/dist/src/lib.js +189 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/modelUtils.d.ts +12 -0
- package/dist/src/modelUtils.d.ts.map +1 -0
- package/dist/src/modelUtils.js +812 -0
- package/dist/src/modelUtils.js.map +1 -0
- package/dist/src/operationUtil.d.ts +16 -0
- package/dist/src/operationUtil.d.ts.map +1 -0
- package/dist/src/operationUtil.js +142 -0
- package/dist/src/operationUtil.js.map +1 -0
- package/dist/src/transform/transform.d.ts +8 -0
- package/dist/src/transform/transform.d.ts.map +1 -0
- package/dist/src/transform/transform.js +131 -0
- package/dist/src/transform/transform.js.map +1 -0
- package/dist/src/transform/transformAnnotationDetails.d.ts +6 -0
- package/dist/src/transform/transformAnnotationDetails.d.ts.map +1 -0
- package/dist/src/transform/transformAnnotationDetails.js +188 -0
- package/dist/src/transform/transformAnnotationDetails.js.map +1 -0
- package/dist/src/transform/transformApiVersionParam.d.ts +5 -0
- package/dist/src/transform/transformApiVersionParam.d.ts.map +1 -0
- package/dist/src/transform/transformApiVersionParam.js +76 -0
- package/dist/src/transform/transformApiVersionParam.js.map +1 -0
- package/dist/src/transform/transformParameters.d.ts +14 -0
- package/dist/src/transform/transformParameters.d.ts.map +1 -0
- package/dist/src/transform/transformParameters.js +315 -0
- package/dist/src/transform/transformParameters.js.map +1 -0
- package/dist/src/transform/transformPaths.d.ts +10 -0
- package/dist/src/transform/transformPaths.d.ts.map +1 -0
- package/dist/src/transform/transformPaths.js +124 -0
- package/dist/src/transform/transformPaths.js.map +1 -0
- package/dist/src/transform/transformResponses.d.ts +5 -0
- package/dist/src/transform/transformResponses.d.ts.map +1 -0
- package/dist/src/transform/transformResponses.js +136 -0
- package/dist/src/transform/transformResponses.js.map +1 -0
- package/dist/src/transform/transformSchemas.d.ts +4 -0
- package/dist/src/transform/transformSchemas.d.ts.map +1 -0
- package/dist/src/transform/transformSchemas.js +175 -0
- package/dist/src/transform/transformSchemas.js.map +1 -0
- package/dist/src/transform/transfromRLCOptions.d.ts +10 -0
- package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -0
- package/dist/src/transform/transfromRLCOptions.js +156 -0
- package/dist/src/transform/transfromRLCOptions.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +73 -0
- package/src/emitUtil.ts +63 -0
- package/src/index.ts +106 -0
- package/src/lib.ts +207 -0
- package/src/modelUtils.ts +961 -0
- package/src/operationUtil.ts +203 -0
- package/src/transform/transform.ts +224 -0
- package/src/transform/transformAnnotationDetails.ts +231 -0
- package/src/transform/transformApiVersionParam.ts +104 -0
- package/src/transform/transformParameters.ts +480 -0
- package/src/transform/transformPaths.ts +187 -0
- package/src/transform/transformResponses.ts +190 -0
- package/src/transform/transformSchemas.ts +209 -0
- package/src/transform/transfromRLCOptions.ts +202 -0
- package/test/commands/cadl-ranch-list.ts +83 -0
- package/test/commands/check-clean-tree.ts +55 -0
- package/test/commands/childProcessOnExit.ts +16 -0
- package/test/commands/gen-cadl-ranch.ts +21 -0
- package/test/commands/run.ts +41 -0
- package/test/integration/arrayItemTypes.spec.ts +93 -0
- package/test/integration/authApiKey.spec.ts +38 -0
- package/test/integration/authOauth2.spec.ts +65 -0
- package/test/integration/authUnion.spec.ts +72 -0
- package/test/integration/dictionary.spec.ts +102 -0
- package/test/integration/extensibleEnums.spec.ts +61 -0
- package/test/integration/fixedEnums.spec.ts +52 -0
- package/test/integration/generated/arrays/itemTypes/src/arrayItemTypesClient.ts +31 -0
- package/test/integration/generated/arrays/itemTypes/src/clientDefinitions.ts +150 -0
- package/test/integration/generated/arrays/itemTypes/src/index.ts +13 -0
- package/test/integration/generated/arrays/itemTypes/src/models.ts +9 -0
- package/test/integration/generated/arrays/itemTypes/src/outputModels.ts +9 -0
- package/test/integration/generated/arrays/itemTypes/src/parameters.ts +78 -0
- package/test/integration/generated/arrays/itemTypes/src/responses.ts +104 -0
- package/test/integration/generated/arrays/itemTypes/tspconfig.yaml +12 -0
- package/test/integration/generated/authentication/apiKey/.eslintrc.json +11 -0
- package/test/integration/generated/authentication/apiKey/README.md +56 -0
- package/test/integration/generated/authentication/apiKey/api-extractor.json +18 -0
- package/test/integration/generated/authentication/apiKey/karma.conf.js +133 -0
- package/test/integration/generated/authentication/apiKey/package.json +103 -0
- package/test/integration/generated/authentication/apiKey/rollup.config.js +118 -0
- package/test/integration/generated/authentication/apiKey/src/authApiKeyClient.ts +41 -0
- package/test/integration/generated/authentication/apiKey/src/clientDefinitions.ts +33 -0
- package/test/integration/generated/authentication/apiKey/src/index.ts +12 -0
- package/test/integration/generated/authentication/apiKey/src/outputModels.ts +6 -0
- package/test/integration/generated/authentication/apiKey/src/parameters.ts +7 -0
- package/test/integration/generated/authentication/apiKey/src/responses.ts +21 -0
- package/test/integration/generated/authentication/apiKey/test/public/sampleTest.spec.ts +23 -0
- package/test/integration/generated/authentication/apiKey/test/public/utils/env.browser.ts +2 -0
- package/test/integration/generated/authentication/apiKey/test/public/utils/env.ts +6 -0
- package/test/integration/generated/authentication/apiKey/test/public/utils/recordedClient.ts +29 -0
- package/test/integration/generated/authentication/apiKey/tsconfig.json +25 -0
- package/test/integration/generated/authentication/apiKey/tspconfig.yaml +10 -0
- package/test/integration/generated/authentication/oauth2/karma.conf.js +133 -0
- package/test/integration/generated/authentication/oauth2/src/authOauth2Client.ts +41 -0
- package/test/integration/generated/authentication/oauth2/src/clientDefinitions.ts +33 -0
- package/test/integration/generated/authentication/oauth2/src/index.ts +12 -0
- package/test/integration/generated/authentication/oauth2/src/outputModels.ts +6 -0
- package/test/integration/generated/authentication/oauth2/src/parameters.ts +7 -0
- package/test/integration/generated/authentication/oauth2/src/responses.ts +21 -0
- package/test/integration/generated/authentication/oauth2/test/public/sampleTest.spec.ts +23 -0
- package/test/integration/generated/authentication/oauth2/test/public/utils/env.browser.ts +2 -0
- package/test/integration/generated/authentication/oauth2/test/public/utils/env.ts +6 -0
- package/test/integration/generated/authentication/oauth2/test/public/utils/recordedClient.ts +29 -0
- package/test/integration/generated/authentication/oauth2/tspconfig.yaml +12 -0
- package/test/integration/generated/authentication/union/karma.conf.js +133 -0
- package/test/integration/generated/authentication/union/src/authUnionClient.ts +42 -0
- package/test/integration/generated/authentication/union/src/clientDefinitions.ts +27 -0
- package/test/integration/generated/authentication/union/src/index.ts +11 -0
- package/test/integration/generated/authentication/union/src/parameters.ts +7 -0
- package/test/integration/generated/authentication/union/src/responses.ts +14 -0
- package/test/integration/generated/authentication/union/test/public/sampleTest.spec.ts +23 -0
- package/test/integration/generated/authentication/union/test/public/utils/env.browser.ts +2 -0
- package/test/integration/generated/authentication/union/test/public/utils/env.ts +6 -0
- package/test/integration/generated/authentication/union/test/public/utils/recordedClient.ts +29 -0
- package/test/integration/generated/authentication/union/tspconfig.yaml +12 -0
- package/test/integration/generated/dictionary/.eslintrc.json +11 -0
- package/test/integration/generated/dictionary/README.md +56 -0
- package/test/integration/generated/dictionary/api-extractor.json +18 -0
- package/test/integration/generated/dictionary/package.json +80 -0
- package/test/integration/generated/dictionary/rollup.config.js +118 -0
- package/test/integration/generated/dictionary/src/clientDefinitions.ts +165 -0
- package/test/integration/generated/dictionary/src/dictClient.ts +29 -0
- package/test/integration/generated/dictionary/src/index.ts +13 -0
- package/test/integration/generated/dictionary/src/models.ts +9 -0
- package/test/integration/generated/dictionary/src/outputModels.ts +9 -0
- package/test/integration/generated/dictionary/src/parameters.ts +86 -0
- package/test/integration/generated/dictionary/src/responses.ts +115 -0
- package/test/integration/generated/dictionary/tsconfig.json +25 -0
- package/test/integration/generated/dictionary/tspconfig.yaml +12 -0
- package/test/integration/generated/enums/extensible/.eslintrc.json +11 -0
- package/test/integration/generated/enums/extensible/README.md +56 -0
- package/test/integration/generated/enums/extensible/api-extractor.json +18 -0
- package/test/integration/generated/enums/extensible/package.json +80 -0
- package/test/integration/generated/enums/extensible/rollup.config.js +118 -0
- package/test/integration/generated/enums/extensible/src/clientDefinitions.ts +45 -0
- package/test/integration/generated/enums/extensible/src/enumsExtensible.ts +31 -0
- package/test/integration/generated/enums/extensible/src/index.ts +11 -0
- package/test/integration/generated/enums/extensible/src/parameters.ts +23 -0
- package/test/integration/generated/enums/extensible/src/responses.ts +26 -0
- package/test/integration/generated/enums/extensible/tsconfig.json +25 -0
- package/test/integration/generated/enums/extensible/tspconfig.yaml +11 -0
- package/test/integration/generated/enums/fixed/.eslintrc.json +11 -0
- package/test/integration/generated/enums/fixed/README.md +56 -0
- package/test/integration/generated/enums/fixed/api-extractor.json +18 -0
- package/test/integration/generated/enums/fixed/package.json +80 -0
- package/test/integration/generated/enums/fixed/rollup.config.js +118 -0
- package/test/integration/generated/enums/fixed/src/clientDefinitions.ts +43 -0
- package/test/integration/generated/enums/fixed/src/enumsFixed.ts +31 -0
- package/test/integration/generated/enums/fixed/src/index.ts +11 -0
- package/test/integration/generated/enums/fixed/src/parameters.ts +36 -0
- package/test/integration/generated/enums/fixed/src/responses.ts +27 -0
- package/test/integration/generated/enums/fixed/tsconfig.json +25 -0
- package/test/integration/generated/enums/fixed/tspconfig.yaml +11 -0
- package/test/integration/generated/hello/.eslintrc.json +11 -0
- package/test/integration/generated/hello/README.md +56 -0
- package/test/integration/generated/hello/api-extractor.json +18 -0
- package/test/integration/generated/hello/package.json +80 -0
- package/test/integration/generated/hello/rollup.config.js +118 -0
- package/test/integration/generated/hello/src/clientDefinitions.ts +19 -0
- package/test/integration/generated/hello/src/hello.ts +29 -0
- package/test/integration/generated/hello/src/index.ts +11 -0
- package/test/integration/generated/hello/src/parameters.ts +6 -0
- package/test/integration/generated/hello/src/responses.ts +10 -0
- package/test/integration/generated/hello/tsconfig.json +25 -0
- package/test/integration/generated/hello/tspconfig.yaml +11 -0
- package/test/integration/generated/lro/lroBasic/.eslintrc.json +11 -0
- package/test/integration/generated/lro/lroBasic/README.md +56 -0
- package/test/integration/generated/lro/lroBasic/api-extractor.json +18 -0
- package/test/integration/generated/lro/lroBasic/package.json +82 -0
- package/test/integration/generated/lro/lroBasic/rollup.config.js +118 -0
- package/test/integration/generated/lro/lroBasic/src/azureLro.ts +31 -0
- package/test/integration/generated/lro/lroBasic/src/clientDefinitions.ts +37 -0
- package/test/integration/generated/lro/lroBasic/src/index.ts +12 -0
- package/test/integration/generated/lro/lroBasic/src/parameters.ts +8 -0
- package/test/integration/generated/lro/lroBasic/src/pollingHelper.ts +75 -0
- package/test/integration/generated/lro/lroBasic/src/responses.ts +22 -0
- package/test/integration/generated/lro/lroBasic/tsconfig.json +25 -0
- package/test/integration/generated/lro/lroBasic/tspconfig.yaml +11 -0
- package/test/integration/generated/models/inheritance/.eslintrc.json +11 -0
- package/test/integration/generated/models/inheritance/README.md +56 -0
- package/test/integration/generated/models/inheritance/api-extractor.json +18 -0
- package/test/integration/generated/models/inheritance/package.json +80 -0
- package/test/integration/generated/models/inheritance/rollup.config.js +118 -0
- package/test/integration/generated/models/inheritance/src/clientDefinitions.ts +79 -0
- package/test/integration/generated/models/inheritance/src/index.ts +13 -0
- package/test/integration/generated/models/inheritance/src/models.ts +52 -0
- package/test/integration/generated/models/inheritance/src/modelsInheritance.ts +31 -0
- package/test/integration/generated/models/inheritance/src/outputModels.ts +52 -0
- package/test/integration/generated/models/inheritance/src/parameters.ts +35 -0
- package/test/integration/generated/models/inheritance/src/responses.ts +56 -0
- package/test/integration/generated/models/inheritance/tsconfig.json +25 -0
- package/test/integration/generated/models/inheritance/tspconfig.yaml +11 -0
- package/test/integration/generated/models/propertyOptional/.eslintrc.json +11 -0
- package/test/integration/generated/models/propertyOptional/README.md +56 -0
- package/test/integration/generated/models/propertyOptional/api-extractor.json +18 -0
- package/test/integration/generated/models/propertyOptional/package.json +80 -0
- package/test/integration/generated/models/propertyOptional/rollup.config.js +118 -0
- package/test/integration/generated/models/propertyOptional/src/clientDefinitions.ts +263 -0
- package/test/integration/generated/models/propertyOptional/src/index.ts +13 -0
- package/test/integration/generated/models/propertyOptional/src/models.ts +46 -0
- package/test/integration/generated/models/propertyOptional/src/modelsPropertyOptional.ts +31 -0
- package/test/integration/generated/models/propertyOptional/src/outputModels.ts +46 -0
- package/test/integration/generated/models/propertyOptional/src/parameters.ts +124 -0
- package/test/integration/generated/models/propertyOptional/src/responses.ts +169 -0
- package/test/integration/generated/models/propertyOptional/tsconfig.json +25 -0
- package/test/integration/generated/models/propertyOptional/tspconfig.yaml +11 -0
- package/test/integration/generated/models/propertyTypes/.eslintrc.json +11 -0
- package/test/integration/generated/models/propertyTypes/README.md +56 -0
- package/test/integration/generated/models/propertyTypes/api-extractor.json +18 -0
- package/test/integration/generated/models/propertyTypes/package.json +80 -0
- package/test/integration/generated/models/propertyTypes/rollup.config.js +118 -0
- package/test/integration/generated/models/propertyTypes/src/clientDefinitions.ts +234 -0
- package/test/integration/generated/models/propertyTypes/src/index.ts +13 -0
- package/test/integration/generated/models/propertyTypes/src/models.ts +99 -0
- package/test/integration/generated/models/propertyTypes/src/modelsPropertyTypes.ts +31 -0
- package/test/integration/generated/models/propertyTypes/src/outputModels.ts +99 -0
- package/test/integration/generated/models/propertyTypes/src/parameters.ts +147 -0
- package/test/integration/generated/models/propertyTypes/src/responses.ts +186 -0
- package/test/integration/generated/models/propertyTypes/tsconfig.json +25 -0
- package/test/integration/generated/models/propertyTypes/tspconfig.yaml +11 -0
- package/test/integration/generated/models/usage/.eslintrc.json +11 -0
- package/test/integration/generated/models/usage/README.md +56 -0
- package/test/integration/generated/models/usage/api-extractor.json +18 -0
- package/test/integration/generated/models/usage/package.json +80 -0
- package/test/integration/generated/models/usage/rollup.config.js +118 -0
- package/test/integration/generated/models/usage/src/clientDefinitions.ts +41 -0
- package/test/integration/generated/models/usage/src/index.ts +13 -0
- package/test/integration/generated/models/usage/src/models.ts +12 -0
- package/test/integration/generated/models/usage/src/modelsUsage.ts +31 -0
- package/test/integration/generated/models/usage/src/outputModels.ts +12 -0
- package/test/integration/generated/models/usage/src/parameters.ts +19 -0
- package/test/integration/generated/models/usage/src/responses.ts +22 -0
- package/test/integration/generated/models/usage/tsconfig.json +25 -0
- package/test/integration/generated/models/usage/tspconfig.yaml +11 -0
- package/test/integration/generated/models/visibility/.eslintrc.json +11 -0
- package/test/integration/generated/models/visibility/README.md +56 -0
- package/test/integration/generated/models/visibility/api-extractor.json +18 -0
- package/test/integration/generated/models/visibility/package.json +80 -0
- package/test/integration/generated/models/visibility/rollup.config.js +118 -0
- package/test/integration/generated/models/visibility/src/clientDefinitions.ts +40 -0
- package/test/integration/generated/models/visibility/src/index.ts +13 -0
- package/test/integration/generated/models/visibility/src/models.ts +14 -0
- package/test/integration/generated/models/visibility/src/modelsVisibilityAutomatic.ts +31 -0
- package/test/integration/generated/models/visibility/src/outputModels.ts +16 -0
- package/test/integration/generated/models/visibility/src/parameters.ts +41 -0
- package/test/integration/generated/models/visibility/src/responses.ts +36 -0
- package/test/integration/generated/models/visibility/tsconfig.json +25 -0
- package/test/integration/generated/models/visibility/tspconfig.yaml +11 -0
- package/test/integration/generated/resiliency/devDriven/.eslintrc.json +11 -0
- package/test/integration/generated/resiliency/devDriven/README.md +56 -0
- package/test/integration/generated/resiliency/devDriven/api-extractor.json +18 -0
- package/test/integration/generated/resiliency/devDriven/package.json +81 -0
- package/test/integration/generated/resiliency/devDriven/rollup.config.js +118 -0
- package/test/integration/generated/resiliency/devDriven/src/clientDefinitions.ts +75 -0
- package/test/integration/generated/resiliency/devDriven/src/index.ts +15 -0
- package/test/integration/generated/resiliency/devDriven/src/isUnexpected.ts +117 -0
- package/test/integration/generated/resiliency/devDriven/src/models.ts +8 -0
- package/test/integration/generated/resiliency/devDriven/src/outputModels.ts +25 -0
- package/test/integration/generated/resiliency/devDriven/src/paginateHelper.ts +154 -0
- package/test/integration/generated/resiliency/devDriven/src/parameters.ts +17 -0
- package/test/integration/generated/resiliency/devDriven/src/resiliencyDevDriven.ts +31 -0
- package/test/integration/generated/resiliency/devDriven/src/responses.ts +62 -0
- package/test/integration/generated/resiliency/devDriven/tsconfig.json +25 -0
- package/test/integration/generated/resiliency/devDriven/tspconfig.yaml +11 -0
- package/test/integration/generated/resiliency/srvDriven1/.eslintrc.json +11 -0
- package/test/integration/generated/resiliency/srvDriven1/README.md +56 -0
- package/test/integration/generated/resiliency/srvDriven1/api-extractor.json +18 -0
- package/test/integration/generated/resiliency/srvDriven1/package.json +80 -0
- package/test/integration/generated/resiliency/srvDriven1/rollup.config.js +118 -0
- package/test/integration/generated/resiliency/srvDriven1/src/clientDefinitions.ts +70 -0
- package/test/integration/generated/resiliency/srvDriven1/src/index.ts +13 -0
- package/test/integration/generated/resiliency/srvDriven1/src/models.ts +6 -0
- package/test/integration/generated/resiliency/srvDriven1/src/outputModels.ts +6 -0
- package/test/integration/generated/resiliency/srvDriven1/src/parameters.ts +51 -0
- package/test/integration/generated/resiliency/srvDriven1/src/resiliencyServiceDriven1.ts +31 -0
- package/test/integration/generated/resiliency/srvDriven1/src/responses.ts +34 -0
- package/test/integration/generated/resiliency/srvDriven1/tsconfig.json +25 -0
- package/test/integration/generated/resiliency/srvDriven1/tspconfig.yaml +11 -0
- package/test/integration/generated/resiliency/srvDriven2/.eslintrc.json +11 -0
- package/test/integration/generated/resiliency/srvDriven2/README.md +56 -0
- package/test/integration/generated/resiliency/srvDriven2/api-extractor.json +18 -0
- package/test/integration/generated/resiliency/srvDriven2/package.json +80 -0
- package/test/integration/generated/resiliency/srvDriven2/rollup.config.js +118 -0
- package/test/integration/generated/resiliency/srvDriven2/src/clientDefinitions.ts +93 -0
- package/test/integration/generated/resiliency/srvDriven2/src/index.ts +13 -0
- package/test/integration/generated/resiliency/srvDriven2/src/models.ts +6 -0
- package/test/integration/generated/resiliency/srvDriven2/src/outputModels.ts +6 -0
- package/test/integration/generated/resiliency/srvDriven2/src/parameters.ts +68 -0
- package/test/integration/generated/resiliency/srvDriven2/src/resiliencyServiceDriven2.ts +31 -0
- package/test/integration/generated/resiliency/srvDriven2/src/responses.ts +45 -0
- package/test/integration/generated/resiliency/srvDriven2/tsconfig.json +25 -0
- package/test/integration/generated/resiliency/srvDriven2/tspconfig.yaml +11 -0
- package/test/integration/generated/specialWords/src/clientDefinitions.ts +61 -0
- package/test/integration/generated/specialWords/src/index.ts +13 -0
- package/test/integration/generated/specialWords/src/models.ts +17 -0
- package/test/integration/generated/specialWords/src/outputModels.ts +17 -0
- package/test/integration/generated/specialWords/src/parameters.ts +37 -0
- package/test/integration/generated/specialWords/src/responses.ts +31 -0
- package/test/integration/generated/specialWords/src/specialWordsClient.ts +31 -0
- package/test/integration/generated/specialWords/tspconfig.yaml +11 -0
- package/test/integration/generated/unions/src/clientDefinitions.ts +53 -0
- package/test/integration/generated/unions/src/index.ts +12 -0
- package/test/integration/generated/unions/src/models.ts +27 -0
- package/test/integration/generated/unions/src/parameters.ts +34 -0
- package/test/integration/generated/unions/src/responses.ts +24 -0
- package/test/integration/generated/unions/src/unionsClient.ts +31 -0
- package/test/integration/generated/unions/tspconfig.yaml +11 -0
- package/test/integration/helloWorld.spec.ts +20 -0
- package/test/integration/lroBasic.spec.ts +25 -0
- package/test/integration/modelInheritance.spec.ts +192 -0
- package/test/integration/modelPropertyOptional.spec.ts +362 -0
- package/test/integration/modelPropertyType.spec.ts +119 -0
- package/test/integration/modelUsage.spec.ts +47 -0
- package/test/integration/resiliencyDpgCustomization.spec.ts +52 -0
- package/test/integration/specialWords.spec.ts +73 -0
- package/test/integration/unions.spec.ts +69 -0
- package/test/tsconfig.json +4 -0
- package/test/unit/azureCoreOperationsGenerator.spec.ts +71 -0
- package/test/unit/clientDefinitionGenerator.spec.ts +73 -0
- package/test/unit/clientFactoryGenerator.spec.ts +507 -0
- package/test/unit/docsGenerator.spec.ts +201 -0
- package/test/unit/modelsGenerator.spec.ts +1319 -0
- package/test/unit/parametersGenerator.spec.ts +561 -0
- package/test/unit/responsesGenerator.spec.ts +462 -0
- package/test/unit/spreadAndAlias.spec.ts +200 -0
- package/test/unit/util/emitUtil.ts +156 -0
- package/test/unit/util/testUtil.ts +83 -0
- package/test/util/customBearerTokenTestingPolicy.ts +78 -0
- package/test/util/matrix.ts +48 -0
- package/tsconfig.json +36 -0
- package/tsconfig.test.json +7 -0
- package/typespec-ts.build.log +2 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import ResiliencyDevDrivenClientFactory, {
|
|
3
|
+
ResiliencyDevDrivenClient
|
|
4
|
+
} from "./generated/resiliency/devDriven/src/index.js";
|
|
5
|
+
describe("ResiliencyDevDrivenClient Rest Client", () => {
|
|
6
|
+
let client: ResiliencyDevDrivenClient;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
client = ResiliencyDevDrivenClientFactory({
|
|
10
|
+
allowInsecureConnection: true
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("dpg customization with raw model", () => {
|
|
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
|
+
});
|
|
25
|
+
|
|
26
|
+
xit("should post model", async () => {
|
|
27
|
+
const result = await client
|
|
28
|
+
.path("/resiliency/devdriven/customization/model/{mode}", "raw")
|
|
29
|
+
.post({ body: { hello: "world!" } });
|
|
30
|
+
assert.equal(result.status, "200");
|
|
31
|
+
assert.equal(result.body.received, "raw");
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("dpg customization with model model", () => {
|
|
36
|
+
xit("should get model", async () => {
|
|
37
|
+
const result = await client
|
|
38
|
+
.path("/resiliency/devdriven/customization/model/{mode}", "model")
|
|
39
|
+
.get();
|
|
40
|
+
assert.equal(result.status, "200");
|
|
41
|
+
assert.equal(result.body.received, "model");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
xit("should post model", async () => {
|
|
45
|
+
const result = await client
|
|
46
|
+
.path("/resiliency/devdriven/customization/model/{mode}", "model")
|
|
47
|
+
.post({ body: { hello: "world!" } });
|
|
48
|
+
assert.equal(result.status, "200");
|
|
49
|
+
assert.equal(result.body.received, "model");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import SpecialWordsClientFactory, {
|
|
2
|
+
DerivedModel,
|
|
3
|
+
SpecialWordsClient
|
|
4
|
+
} from "./generated/specialWords/src/index.js";
|
|
5
|
+
import { assert } from "chai";
|
|
6
|
+
describe("HelloClient Rest Client", () => {
|
|
7
|
+
let client: SpecialWordsClient;
|
|
8
|
+
const modelValue: DerivedModel = {
|
|
9
|
+
"model.kind": "derived",
|
|
10
|
+
"derived.name": "my.name",
|
|
11
|
+
for: "value"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
client = SpecialWordsClientFactory({ allowInsecureConnection: true });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should get special words for operation `for`", async () => {
|
|
19
|
+
try {
|
|
20
|
+
const result = await client.path("/special-words/operation/for").get();
|
|
21
|
+
assert.strictEqual(result.status, "204");
|
|
22
|
+
} catch (err) {
|
|
23
|
+
assert.fail(err as string);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should get special words for parameter `if`", async () => {
|
|
28
|
+
try {
|
|
29
|
+
const result = await client.path("/special-words/parameter/if").get({
|
|
30
|
+
headers: {
|
|
31
|
+
if: "weekend"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
assert.strictEqual(result.status, "204");
|
|
35
|
+
} catch (err) {
|
|
36
|
+
assert.fail(err as string);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should get special words for parameter `filter`", async () => {
|
|
41
|
+
try {
|
|
42
|
+
const result = await client.path("/special-words/parameter/filter").get({
|
|
43
|
+
queryParameters: {
|
|
44
|
+
filter: "abc*."
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
assert.strictEqual(result.status, "204");
|
|
48
|
+
} catch (err) {
|
|
49
|
+
assert.fail(err as string);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("should get special words for model", async () => {
|
|
54
|
+
try {
|
|
55
|
+
const result = await client.path("/special-words/model/get").get();
|
|
56
|
+
assert.strictEqual(result.status, "200");
|
|
57
|
+
assert.deepEqual(result.body, modelValue);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
assert.fail(err as string);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should put special words for model", async () => {
|
|
64
|
+
try {
|
|
65
|
+
const result = await client.path("/special-words/model/put").put({
|
|
66
|
+
body: modelValue
|
|
67
|
+
});
|
|
68
|
+
assert.strictEqual(result.status, "204");
|
|
69
|
+
} catch (err) {
|
|
70
|
+
assert.fail(err as string);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import UnionsClientFactory, {
|
|
2
|
+
UnionsClient
|
|
3
|
+
} from "./generated/unions/src/index.js";
|
|
4
|
+
import { assert } from "chai";
|
|
5
|
+
describe("UnionsClient Rest Client", () => {
|
|
6
|
+
let client: UnionsClient;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
client = UnionsClientFactory({ allowInsecureConnection: true });
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should post input simple number union", async () => {
|
|
13
|
+
try {
|
|
14
|
+
const result = await client.path("/unions/int").post({
|
|
15
|
+
body: {
|
|
16
|
+
simpleUnion: 1
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
assert.strictEqual(result.status, "200");
|
|
20
|
+
} catch (err) {
|
|
21
|
+
assert.fail(err as string);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should post simple number array union", async () => {
|
|
26
|
+
try {
|
|
27
|
+
const result = await client.path("/unions/int-array").post({
|
|
28
|
+
body: {
|
|
29
|
+
simpleUnion: [1, 2]
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
assert.strictEqual(result.status, "200");
|
|
33
|
+
} catch (err) {
|
|
34
|
+
assert.fail(err as string);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should post named union model1", async () => {
|
|
39
|
+
try {
|
|
40
|
+
const result = await client.path("/unions/model1").post({
|
|
41
|
+
body: {
|
|
42
|
+
namedUnion: {
|
|
43
|
+
name: "model1",
|
|
44
|
+
prop1: 1
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
assert.strictEqual(result.status, "200");
|
|
49
|
+
} catch (err) {
|
|
50
|
+
assert.fail(err as string);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("should post named union model2", async () => {
|
|
55
|
+
try {
|
|
56
|
+
const result = await client.path("/unions/model2").post({
|
|
57
|
+
body: {
|
|
58
|
+
namedUnion: {
|
|
59
|
+
name: "model2",
|
|
60
|
+
prop2: 2
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
assert.strictEqual(result.status, "200");
|
|
65
|
+
} catch (err) {
|
|
66
|
+
assert.fail(err as string);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import {
|
|
3
|
+
emitParameterFromCadl,
|
|
4
|
+
emitResponsesFromCadl
|
|
5
|
+
} from "./util/emitUtil.js";
|
|
6
|
+
|
|
7
|
+
describe("typespec-azure-core: operation templates", () => {
|
|
8
|
+
it("ResourceCreateWithServiceProvidedName", async () => {
|
|
9
|
+
const { parameters, responses } = await compileResourceOperation(
|
|
10
|
+
`@test op create is Azure.Core.ResourceCreateWithServiceProvidedName<TestModel, Customizations>;`
|
|
11
|
+
);
|
|
12
|
+
assert.ok(parameters);
|
|
13
|
+
assert.ok(responses);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
async function compileResourceOperation(code: string) {
|
|
18
|
+
const content = `
|
|
19
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
20
|
+
model TestModel {
|
|
21
|
+
@key
|
|
22
|
+
@visibility("read")
|
|
23
|
+
@segment("test")
|
|
24
|
+
name: string;
|
|
25
|
+
value: int32;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
29
|
+
model CustomParameters {
|
|
30
|
+
#suppress "@azure-tools/typespec-azure-core/casing-style" "for test"
|
|
31
|
+
@header
|
|
32
|
+
"x-ms-foobar": string;
|
|
33
|
+
|
|
34
|
+
@query
|
|
35
|
+
nameHint: string;
|
|
36
|
+
|
|
37
|
+
customBodyParam: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
41
|
+
model CustomResponseProperties {
|
|
42
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
43
|
+
#suppress "@azure-tools/typespec-azure-core/casing-style" "for test"
|
|
44
|
+
@header
|
|
45
|
+
"x-ms-response-id": int32;
|
|
46
|
+
#suppress "@azure-tools/typespec-azure-core/casing-style" "for test"
|
|
47
|
+
@doc("A timestamp when this job or item was created (in unix epochs).")
|
|
48
|
+
@visibility("read")
|
|
49
|
+
created_at?: int32;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
53
|
+
model Customizations {
|
|
54
|
+
parameters: CustomParameters;
|
|
55
|
+
response: CustomResponseProperties;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
59
|
+
model CustomizationsNoBody {
|
|
60
|
+
parameters: OmitProperties<CustomParameters, "customBodyParam">;
|
|
61
|
+
response: CustomResponseProperties;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "for test"
|
|
65
|
+
${code}
|
|
66
|
+
`;
|
|
67
|
+
const parameters = await emitParameterFromCadl(content, true);
|
|
68
|
+
const responses = await emitResponsesFromCadl(content, true);
|
|
69
|
+
|
|
70
|
+
return { parameters, responses };
|
|
71
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { assert } from "chai";
|
|
2
|
+
import { emitClientDefinitionFromCadl } from "./util/emitUtil.js";
|
|
3
|
+
import { assertEqualContent } from "./util/testUtil.js";
|
|
4
|
+
|
|
5
|
+
describe("Client definition generation", () => {
|
|
6
|
+
it("should generate method-level parameter", async () => {
|
|
7
|
+
const clientDef = await emitClientDefinitionFromCadl(
|
|
8
|
+
`
|
|
9
|
+
@route("/{id}")
|
|
10
|
+
@doc("This is the longer description")
|
|
11
|
+
op read(@path id: string): {};
|
|
12
|
+
`
|
|
13
|
+
);
|
|
14
|
+
assert.ok(clientDef);
|
|
15
|
+
// console.log(clientDef);
|
|
16
|
+
assertEqualContent(
|
|
17
|
+
clientDef?.content!,
|
|
18
|
+
`
|
|
19
|
+
import { ReadParameters } from "./parameters";
|
|
20
|
+
import { Read200Response } from "./responses";
|
|
21
|
+
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
22
|
+
|
|
23
|
+
export interface Read {
|
|
24
|
+
/** This is the longer description */
|
|
25
|
+
get(options?: ReadParameters): StreamableMethod<Read200Response>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Routes {
|
|
29
|
+
/** Resource for '/\\{id\\}' has methods for the following verbs: get */
|
|
30
|
+
(path: "/{id}", id: string): Read;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type testClient = Client & {
|
|
34
|
+
path: Routes;
|
|
35
|
+
};
|
|
36
|
+
`
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should normalize method-level parameter", async () => {
|
|
41
|
+
const clientDef = await emitClientDefinitionFromCadl(
|
|
42
|
+
`
|
|
43
|
+
@route("/{TransactionID}")
|
|
44
|
+
@doc("This is the longer description")
|
|
45
|
+
op read(@path TransactionID: string): {};
|
|
46
|
+
`
|
|
47
|
+
);
|
|
48
|
+
assert.ok(clientDef);
|
|
49
|
+
// console.log(clientDef);
|
|
50
|
+
assertEqualContent(
|
|
51
|
+
clientDef?.content!,
|
|
52
|
+
`
|
|
53
|
+
import { ReadParameters } from "./parameters";
|
|
54
|
+
import { Read200Response } from "./responses";
|
|
55
|
+
import { Client, StreamableMethod } from "@azure-rest/core-client";
|
|
56
|
+
|
|
57
|
+
export interface Read {
|
|
58
|
+
/** This is the longer description */
|
|
59
|
+
get(options?: ReadParameters): StreamableMethod<Read200Response>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface Routes {
|
|
63
|
+
/** Resource for '/\\{TransactionID\\}' has methods for the following verbs: get */
|
|
64
|
+
(path: "/{TransactionID}", transactionID: string): Read;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type testClient = Client & {
|
|
68
|
+
path: Routes;
|
|
69
|
+
};
|
|
70
|
+
`
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
});
|