From 5caa50623e3cb752dd47f52db252f2b4aff3e90b Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:51:09 +0800 Subject: [PATCH] Migration-cadl-ranch (#2936) * migration-cadl-ranch * update * update script * update ci job * fix ci * update * update ci * fix ci * remove check voverage for Mac OS * remove check voverage for Mac OS * remove check coverage for Mac OS * remove check coverage for Mac OS * update version * update case * update * fix ci * update * update * update sub * update coverage file * update * update ci * update ci * add debug * update ci * update * update * sync up azure model case * update script for ci * update job name * check file * update script * remove test step * migration cadl ranch * misspelling * add test case * update * remove .env * update * remove case * update test case * regen code * update tsp config * add test case * update * update --- .scripts/ci.yml | 101 +- common/config/rush/pnpm-lock.yaml | 462 ++--- packages/typespec-ts/package.json | 49 +- .../azureIntegration/arrayItemTypes.spec.ts | 104 + .../test/azureIntegration/authApiKey.spec.ts | 36 + .../azureIntegration/authCustomHttp.spec.ts | 40 + .../test/azureIntegration/authOauth2.spec.ts | 56 + .../test/azureIntegration/authUnion.spec.ts | 62 + .../azureArmManagedIdentity.spec.ts | 0 .../azureArmResources.spec.ts | 0 .../azureClientGeneratorCoreAccess.spec.ts | 0 .../azureClientGeneratorCoreUsage.spec.ts | 0 .../azureCoreModel.spec.ts | 0 .../azureCorePage.spec.ts | 0 .../azureExampleBasic.spec.ts | 37 + .../azurePayloadPageable.spec.ts | 77 + .../azurecore.spec.ts | 0 .../azurecorescalar.spec.ts | 0 .../azurecoretraits.spec.ts | 0 .../azureIntegration/basicParameters.spec.ts | 33 + .../azureIntegration/bodyParameters.spec.ts | 51 + .../clientNaming.spec.ts | 0 .../clientRequestIdHeader.spec.ts | 0 .../clientStructure.spec.ts | 0 .../azureIntegration/collectionFormat.spec.ts | 125 ++ .../test/azureIntegration/dictionary.spec.ts | 98 + .../test/azureIntegration/emptyModel.spec.ts | 37 + .../test/azureIntegration/encodeBytes.spec.ts | 248 +++ .../azureIntegration/encodeDatetime.spec.ts | 228 +++ .../azureIntegration/encodeDuration.spec.ts | 224 +++ .../azureIntegration/encodeNumeric.spec.ts | 47 + .../azureIntegration/extensibleEnums.spec.ts | 51 + .../test/azureIntegration/fixedEnums.spec.ts | 44 + .../authentication/api-key}/.gitignore | 0 .../authentication/api-key/src/index.d.ts | 52 + .../authentication/api-key/tspconfig.yaml | 13 + .../authentication/http/custom}/.gitignore | 0 .../authentication/http/custom/src/index.d.ts | 52 + .../authentication/http/custom/tspconfig.yaml | 13 + .../authentication/oauth2}/.gitignore | 0 .../authentication/oauth2/src/index.d.ts | 52 + .../authentication/oauth2/tspconfig.yaml | 15 + .../authentication/union}/.gitignore | 0 .../authentication/union/src/index.d.ts | 44 + .../authentication/union/tspconfig.yaml | 15 + .../client-generator-core/access}/.gitignore | 0 .../access/src/index.d.ts | 0 .../access/tspconfig.yaml | 1 + .../flatten-property}/.gitignore | 0 .../flatten-property/src/index.d.ts | 0 .../flatten-property/tspconfig.yaml | 1 + .../client-generator-core/usage}/.gitignore | 0 .../usage/src/index.d.ts | 0 .../usage/tspconfig.yaml | 1 + .../generated/azure/core/basic}/.gitignore | 0 .../generated/azure/core/basic/src/index.d.ts | 0 .../generated/azure/core/basic/tspconfig.yaml | 1 + .../generated/azure/core/lro/rpc}/.gitignore | 0 .../azure/core/lro/rpc/src/index.d.ts | 0 .../azure/core/lro/rpc/tspconfig.yaml | 1 + .../azure/core/lro/standard}/.gitignore | 0 .../azure/core/lro/standard/src/index.d.ts | 0 .../azure/core/lro/standard/tspconfig.yaml | 1 + .../generated/azure/core/model}/.gitignore | 0 .../generated/azure/core/model/src/index.d.ts | 0 .../generated/azure/core/model/tspconfig.yaml | 1 + .../generated/azure/core/page}/.gitignore | 0 .../generated/azure/core/page/src/index.d.ts | 0 .../generated/azure/core/page/tspconfig.yaml | 1 + .../generated/azure/core/scalar}/.gitignore | 0 .../azure/core/scalar/src/index.d.ts | 0 .../azure/core/scalar/tspconfig.yaml | 1 + .../generated/azure/core/traits}/.gitignore | 0 .../azure/core/traits/src/index.d.ts | 0 .../azure/core/traits/tspconfig.yaml | 1 + .../generated/azure/example/basic}/.gitignore | 0 .../azure/example/basic/src/index.d.ts | 84 + .../azure/example/basic/tspconfig.yaml | 15 + .../azure/payload/pageable}/.gitignore | 0 .../azure}/payload/pageable/src/index.d.ts | 2 +- .../azure/payload/pageable/tspconfig.yaml | 15 + .../common-properties}/.gitignore | 0 .../common-properties/src/index.d.ts | 0 .../common-properties/tspconfig.yaml | 1 + .../resource-manager/resources}/.gitignore | 0 .../resource-manager/resources/src/index.d.ts | 0 .../resource-manager/resources/tspconfig.yaml | 1 + .../client-request-id}/.gitignore | 0 .../client-request-id/src/index.d.ts | 0 .../client-request-id/tspconfig.yaml | 1 + .../generated/client/naming}/.gitignore | 0 .../generated/client/naming/src/index.d.ts | 0 .../generated/client/naming/tspconfig.yaml | 1 + .../client-operation-group}/.gitignore | 0 .../client-operation-group/src/index.d.ts | 0 .../client-operation-group/tspconfig.yaml | 1 + .../client/structure/default}/.gitignore | 0 .../client/structure/default/src/index.d.ts | 0 .../client/structure/default/tspconfig.yaml | 1 + .../client/structure/multi-client}/.gitignore | 0 .../structure/multi-client/src/index.d.ts | 0 .../structure/multi-client/tspconfig.yaml | 1 + .../structure/renamed-operation}/.gitignore | 0 .../renamed-operation/src/index.d.ts | 0 .../renamed-operation/tspconfig.yaml | 1 + .../structure/two-operation-group}/.gitignore | 0 .../two-operation-group/src/index.d.ts | 0 .../two-operation-group/tspconfig.yaml | 1 + .../generated/encode/bytes}/.gitignore | 0 .../generated/encode/bytes/src/index.d.ts | 431 +++++ .../generated/encode/bytes/tspconfig.yaml | 14 + .../generated/encode/datetime}/.gitignore | 0 .../generated/encode/datetime/src/index.d.ts | 404 ++++ .../generated/encode/datetime/tspconfig.yaml | 14 + .../generated/encode/duration}/.gitignore | 0 .../generated/encode/duration/src/index.d.ts | 401 ++++ .../generated/encode/duration/tspconfig.yaml | 13 + .../generated/encode/numeric}/.gitignore | 0 .../generated/encode/numeric/src/index.d.ts | 92 + .../generated/encode/numeric/tspconfig.yaml | 13 + .../generated/media-types}/.gitignore | 0 .../generated/media-types/src/index.d.ts | 0 .../generated/media-types/tspconfig.yaml | 1 + .../generated/overload}/.gitignore | 0 .../generated/overload/src/index.d.ts | 0 .../generated/overload/tspconfig.yaml | 1 + .../generated/parameters/basic}/.gitignore | 0 .../generated/parameters/basic/src/index.d.ts | 56 + .../generated/parameters/basic/tspconfig.yaml | 14 + .../parameters/body-optionality}/.gitignore | 0 .../body-optionality/src/index.d.ts | 85 + .../body-optionality/tspconfig.yaml | 14 + .../parameters/collection-format}/.gitignore | 0 .../collection-format/src/index.d.ts | 163 ++ .../collection-format/tspconfig.yaml | 17 + .../generated/parameters/spread}/.gitignore | 0 .../parameters/spread/src/index.d.ts | 247 +++ .../parameters/spread/tspconfig.yaml | 14 + .../payload/content-negotiation}/.gitignore | 0 .../content-negotiation/src/index.d.ts | 118 ++ .../content-negotiation/tspconfig.yaml | 14 + .../generated/payload/media-type}/.gitignore | 0 .../payload/media-type/src/index.d.ts | 93 + .../payload/media-type/tspconfig.yaml | 14 + .../generated/payload/multipart}/.gitignore | 0 .../payload/multipart/src/index.d.ts | 395 ++++ .../payload/multipart/tspconfig.yaml | 14 + .../generated/payload/pageable}/.gitignore | 0 .../generated/payload/pageable/src/index.d.ts | 45 + .../generated/payload/pageable/tspconfig.yaml | 1 + .../resiliency/srv-driven-main}/.gitignore | 0 .../resiliency/srv-driven-main/src/index.d.ts | 0 .../resiliency/srv-driven-main/tspconfig.yaml | 1 + .../resiliency/srv-driven-old}/.gitignore | 0 .../resiliency/srv-driven-old/src/index.d.ts | 0 .../resiliency/srv-driven-old/tspconfig.yaml | 1 + .../generated/routes}/.gitignore | 0 .../generated/routes/src/index.d.ts | 704 +++++++ .../generated/routes/tspconfig.yaml | 14 + .../encoded-name/json}/.gitignore | 0 .../encoded-name/json/src/index.d.ts | 51 + .../encoded-name/json/tspconfig.yaml | 16 + .../server/endpoint/not-defined}/.gitignore | 0 .../endpoint/not-defined/src/index.d.ts | 31 + .../endpoint/not-defined/tspconfig.yaml | 15 + .../server/path/multiple}/.gitignore | 0 .../server/path/multiple/src/index.d.ts | 45 + .../server/path/multiple/tspconfig.yaml | 15 + .../generated/server/path/single}/.gitignore | 0 .../server/path/single/src/index.d.ts | 31 + .../server/path/single/tspconfig.yaml | 15 + .../server/versions/not-versioned}/.gitignore | 0 .../versions/not-versioned/src/index.d.ts | 61 + .../versions/not-versioned/tspconfig.yaml | 15 + .../server/versions/versioned}/.gitignore | 0 .../server/versions/versioned/src/index.d.ts | 80 + .../server/versions/versioned/tspconfig.yaml | 15 + .../generated/shared-route}/.gitignore | 0 .../generated/shared-route/src/index.d.ts | 222 +++ .../generated/shared-route/tspconfig.yaml | 12 + .../special-headers/repeatability}/.gitignore | 0 .../repeatability/src/index.d.ts | 47 + .../repeatability/tspconfig.yaml | 13 + .../generated/special-words}/.gitignore | 0 .../generated/special-words/src/index.d.ts | 1675 +++++++++++++++++ .../generated/special-words/tspconfig.yaml | 16 + .../generated/type/array}/.gitignore | 0 .../generated/type/array/src/index.d.ts | 352 ++++ .../generated/type/array/tspconfig.yaml | 18 + .../generated/type/dictionary/.gitignore | 6 + .../generated/type/dictionary/src/index.d.ts | 283 +++ .../generated/type/dictionary/tspconfig.yaml | 18 + .../generated/type/enum/extensible/.gitignore | 6 + .../type/enum/extensible/src/index.d.ts | 70 + .../type/enum/extensible/tspconfig.yaml | 15 + .../generated/type/enum/fixed/.gitignore | 6 + .../generated/type/enum/fixed/src/index.d.ts | 62 + .../generated/type/enum/fixed/tspconfig.yaml | 15 + .../generated/type/model/empty/.gitignore | 6 + .../generated/type/model/empty/src/index.d.ts | 71 + .../generated/type/model/empty/tspconfig.yaml | 14 + .../inheritance/enum-discriminator/.gitignore | 6 + .../enum-discriminator/src/index.d.ts | 166 ++ .../enum-discriminator/tspconfig.yaml | 15 + .../nested-discriminator/.gitignore | 6 + .../nested-discriminator/src/index.d.ts | 148 ++ .../nested-discriminator/tspconfig.yaml | 15 + .../inheritance/not-discriminated/.gitignore | 6 + .../not-discriminated/src/index.d.ts | 79 + .../not-discriminated/tspconfig.yaml | 15 + .../model/inheritance/recursive/.gitignore | 6 + .../inheritance/recursive/src/index.d.ts | 60 + .../inheritance/recursive/tspconfig.yaml | 14 + .../single-discriminator/.gitignore | 6 + .../single-discriminator/src/index.d.ts | 165 ++ .../single-discriminator/tspconfig.yaml | 15 + .../generated/type/model/usage/.gitignore | 6 + .../type/model}/usage/src/index.d.ts | 10 +- .../type/model}/usage/tspconfig.yaml | 1 - .../type/model/visibility/.gitignore | 6 + .../type/model/visibility/src/index.d.ts | 130 ++ .../type/model/visibility/tspconfig.yaml | 15 + .../property/additional-properties/.gitignore | 6 + .../additional-properties/src/index.d.ts | 0 .../additional-properties/tspconfig.yaml | 1 + .../type/property/nullable/.gitignore | 6 + .../type/property/nullable/src/index.d.ts | 490 +++++ .../type/property/nullable/tspconfig.yaml | 16 + .../type/property/optionality/.gitignore | 6 + .../type/property/optionality/src/index.d.ts | 886 +++++++++ .../type/property/optionality/tspconfig.yaml | 16 + .../type/property/value-types/.gitignore | 6 + .../type/property/value-types/src/index.d.ts | 933 +++++++++ .../type/property/value-types/tspconfig.yaml | 16 + .../generated/type/scalar/.gitignore | 6 + .../generated/type/scalar/src/index.d.ts | 235 +++ .../generated/type/scalar/tspconfig.yaml | 14 + .../generated/type/union/.gitignore | 6 + .../generated/type/union/src/index.d.ts | 368 ++++ .../generated/type/union/tspconfig.yaml | 16 + .../generated/union-body/.gitignore | 6 + .../generated/union-body/src/index.d.ts | 76 + .../generated/union-body/tspconfig.yaml | 15 + .../generated/versioning/added/.gitignore | 6 + .../generated/versioning/added/src/index.d.ts | 119 ++ .../generated/versioning/added/tspconfig.yaml | 15 + .../versioning/madeOptional/.gitignore | 6 + .../versioning/madeOptional/src/index.d.ts | 56 + .../versioning/madeOptional/tspconfig.yaml | 15 + .../generated/versioning/removed/.gitignore | 6 + .../versioning/removed/src/index.d.ts | 0 .../versioning/removed/tspconfig.yaml | 1 + .../versioning/renamedFrom/.gitignore | 6 + .../versioning/renamedFrom/src/index.d.ts | 82 + .../versioning/renamedFrom/tspconfig.yaml | 15 + .../returnTypeChangedFrom/.gitignore | 6 + .../returnTypeChangedFrom/src/index.d.ts | 38 + .../returnTypeChangedFrom/tspconfig.yaml | 15 + .../versioning/typeChangedFrom/.gitignore | 6 + .../versioning/typeChangedFrom/src/index.d.ts | 56 + .../versioning/typeChangedFrom/tspconfig.yaml | 15 + .../lroCore.spec.ts | 0 .../lroRpc.spec.ts | 0 .../mediaTypes.spec.ts | 0 .../modelFlatten.spec.ts | 0 .../azureIntegration/modelInheritance.spec.ts | 146 ++ .../modelInheritanceEnumDiscriminator.spec.ts | 94 + .../modelInheritanceNotDiscriminated.spec.ts | 39 + .../modelInheritanceRecursive.spec.ts | 45 + ...odelInheritanceSingleDiscriminator.spec.ts | 96 + .../modelPropertyAdditional.spec.ts | 0 .../modelPropertyNullable.spec.ts | 103 + .../modelPropertyOptional.spec.ts | 563 ++++++ .../modelPropertyType.spec.ts | 167 ++ .../test/azureIntegration/modelUsage.spec.ts | 35 + .../test/azureIntegration/multipart.spec.ts | 179 ++ .../overload.spec.ts | 0 .../payloadContentNegotiation.spec.ts | 93 + .../azureIntegration/payloadMediaType.spec.ts | 48 + .../azureIntegration/payloadPageable.spec.ts | 29 + .../repeatableHeaders.spec.ts | 29 + .../resiliencyDpgCustomization.spec.ts | 0 .../test/azureIntegration/routes.spec.ts | 238 +++ .../test/azureIntegration/scalar.spec.ts | 131 ++ .../serializationEncodeNameJson.spec.ts | 33 + .../test/azureIntegration/server.spec.ts | 141 ++ .../serverEndpointNotDefined.spec.ts | 23 + .../azureIntegration/sharedRoutes.spec.ts | 20 + .../azureIntegration/specialWords.spec.ts | 784 ++++++++ .../azureIntegration/spreadParameters.spec.ts | 133 ++ .../typespec/media-types/client.tsp | 63 + .../typespec/media-types/main.tsp | 18 + .../typespec/media-types/routes.tsp | 94 + .../typespec/overload/client.tsp | 63 + .../typespec/overload/main.tsp | 18 + .../typespec/overload/routes.tsp | 40 + .../typespec/shared-route/main.tsp | 18 + .../typespec/shared-route/routes.tsp | 80 + .../typespec/union-body/main.tsp | 36 + .../test/azureIntegration/unionBody.spec.ts | 27 + .../test/azureIntegration/unions.spec.ts | 212 +++ .../azureIntegration/versioningAdded.spec.ts | 58 + .../versioningMadeOptional.spec.ts | 27 + .../versioningRemoved.spec.ts | 27 + .../versioningRenamedFrom.spec.ts | 44 + .../versioningReturnTypeChangedFrom.spec.ts | 26 + .../versioningTypeChangedFrom.spec.ts | 27 + .../arrayItemTypes.spec.ts | 184 ++ .../authApiKey.spec.ts | 42 + .../authHttpCustom.spec.ts | 42 + .../authOauth2.spec.ts | 60 + .../azureModularIntegration/authUnion.spec.ts | 123 ++ .../azureArmManagedIdentity.spec.ts | 0 .../azureArmResources.spec.ts | 0 .../azureClientGeneratorCoreAccess.spec.ts | 0 .../azureClientGeneratorCoreUsage.spec.ts | 0 .../azureCore.spec.ts | 0 .../azureCoreModel.spec.ts | 0 .../azureCorePage.spec.ts | 0 .../azureCoreTraits.spec.ts | 0 .../azureExampleClient.spec.ts | 0 .../azurePayloadPageable.spec.ts | 88 + .../azurecorescalar.spec.ts | 0 .../basicParameters.spec.ts | 22 + .../bodyOptionality.spec.ts | 35 + .../clientNaming.spec.ts | 0 .../clientStructureDefault.spec.ts | 0 .../clientStructureMultiClient.spec.ts | 0 .../clientStructureOperationGroup.spec.ts | 0 .../clientStructureRenamed.spec.ts | 0 .../clientStructureTwoGroup.spec.ts | 0 .../collectionFormat.spec.ts | 47 + .../customClientRequestId.spec.ts | 0 .../dictionaryTypes.spec.ts | 155 ++ .../encodeBytes.spec.ts | 213 +++ .../encodeDatetime.spec.ts | 177 ++ .../encodeDuration.spec.ts | 113 ++ .../encodeNumeric.spec.ts | 36 + .../extensibleEnums.spec.ts | 36 + .../fixedEnums.spec.ts | 35 + .../authentication/api-key/.gitignore | 6 + .../authentication/api-key/src/index.d.ts | 23 + .../authentication/api-key/tspconfig.yaml | 15 + .../authentication/http/custom/.gitignore | 6 + .../authentication/http/custom/src/index.d.ts | 23 + .../authentication/http/custom/tspconfig.yaml | 15 + .../authentication/oauth2/.gitignore | 6 + .../authentication/oauth2/src/index.d.ts | 23 + .../authentication/oauth2/tspconfig.yaml | 15 + .../generated/authentication/union/.gitignore | 6 + .../authentication/union/src/index.d.ts | 24 + .../authentication/union/tspconfig.yaml | 15 + .../client-generator-core/access/.gitignore | 6 + .../access/src/index.d.ts | 0 .../access/tspconfig.yaml | 1 + .../flatten-property/.gitignore | 6 + .../flatten-property/src/index.d.ts | 0 .../flatten-property/tspconfig.yaml | 1 + .../client-generator-core/usage/.gitignore | 6 + .../usage/src/index.d.ts | 0 .../usage/tspconfig.yaml | 1 + .../generated/azure/core/basic/.gitignore | 6 + .../generated/azure/core/basic/src/index.d.ts | 0 .../generated/azure/core/basic/tspconfig.yaml | 1 + .../generated/azure/core/lro/rpc/.gitignore | 6 + .../azure/core/lro/rpc/src/index.d.ts | 0 .../azure/core/lro/rpc/tspconfig.yaml | 1 + .../azure/core/lro/standard/.gitignore | 6 + .../azure/core/lro/standard/src/index.d.ts | 0 .../azure/core/lro/standard/tspconfig.yaml | 1 + .../generated/azure/core/model/.gitignore | 6 + .../generated/azure/core/model/src/index.d.ts | 0 .../generated/azure/core/model/tspconfig.yaml | 1 + .../generated/azure/core/page/.gitignore | 6 + .../generated/azure/core/page/src/index.d.ts | 0 .../generated/azure/core/page/tspconfig.yaml | 1 + .../generated/azure/core/scalar/.gitignore | 6 + .../azure/core/scalar/src/index.d.ts | 0 .../azure/core/scalar/tspconfig.yaml | 1 + .../generated/azure/core/traits/.gitignore | 6 + .../azure/core/traits/src/index.d.ts | 0 .../azure/core/traits/tspconfig.yaml | 1 + .../generated/azure/example/basic/.gitignore | 6 + .../azure/example/basic/src/index.d.ts | 0 .../azure/example/basic/tspconfig.yaml | 1 + .../azure/payload/pageable/.gitignore | 6 + .../azure}/payload/pageable/src/index.d.ts | 0 .../azure/payload/pageable/tspconfig.yaml | 15 + .../common-properties/.gitignore | 6 + .../common-properties/src/index.d.ts | 0 .../common-properties/tspconfig.yaml | 1 + .../resource-manager/resources/.gitignore | 6 + .../resource-manager/resources/src/index.d.ts | 0 .../resource-manager/resources/tspconfig.yaml | 1 + .../client-request-id/.gitignore | 6 + .../client-request-id/src/index.d.ts | 0 .../client-request-id/tspconfig.yaml | 1 + .../generated/client/naming/.gitignore | 6 + .../generated/client/naming/src/index.d.ts | 0 .../generated/client/naming/tspconfig.yaml | 1 + .../client-operation-group/.gitignore | 6 + .../client-operation-group/src/index.d.ts | 0 .../client-operation-group/tspconfig.yaml | 1 + .../client/structure/default/.gitignore | 6 + .../client/structure/default/src/index.d.ts | 0 .../client/structure/default/tspconfig.yaml | 1 + .../client/structure/multi-client/.gitignore | 6 + .../structure/multi-client/src/index.d.ts | 0 .../structure/multi-client/tspconfig.yaml | 1 + .../structure/renamed-operation/.gitignore | 6 + .../renamed-operation/src/index.d.ts | 0 .../renamed-operation/tspconfig.yaml | 1 + .../structure/two-operation-group/.gitignore | 6 + .../two-operation-group/src/index.d.ts | 0 .../two-operation-group/tspconfig.yaml | 1 + .../generated/encode/bytes/.gitignore | 6 + .../generated/encode/bytes/src/index.d.ts | 138 ++ .../generated/encode/bytes/tspconfig.yaml | 16 + .../generated/encode/datetime/.gitignore | 6 + .../generated/encode/datetime/src/index.d.ts | 126 ++ .../generated/encode/datetime/tspconfig.yaml | 16 + .../generated/encode/duration/.gitignore | 6 + .../generated/encode/duration/src/index.d.ts | 122 ++ .../generated/encode/duration/tspconfig.yaml | 16 + .../generated/encode/numeric/.gitignore | 6 + .../generated/encode/numeric/src/index.d.ts | 42 + .../generated/encode/numeric/tspconfig.yaml | 16 + .../generated/parameters/basic/.gitignore | 6 + .../generated/parameters/basic/src/index.d.ts | 34 + .../generated/parameters/basic/tspconfig.yaml | 16 + .../parameters/body-optionality/.gitignore | 6 + .../body-optionality/src/index.d.ts | 40 + .../body-optionality/tspconfig.yaml | 15 + .../parameters/collection-format/.gitignore | 6 + .../collection-format/src/index.d.ts | 46 + .../collection-format/tspconfig.yaml | 16 + .../generated/parameters/spread/.gitignore | 6 + .../parameters/spread/src/index.d.ts | 68 + .../parameters/spread/tspconfig.yaml | 16 + .../payload/content-negotiation/.gitignore | 6 + .../content-negotiation/src/index.d.ts | 42 + .../content-negotiation/tspconfig.yaml | 15 + .../generated/payload/media-type/.gitignore | 6 + .../payload/media-type/src/index.d.ts | 34 + .../payload/media-type/tspconfig.yaml | 15 + .../generated/payload/pageable/.gitignore | 6 + .../generated/payload/pageable/src/index.d.ts | 35 + .../generated/payload/pageable/tspconfig.yaml | 1 + .../resiliency/srv-driven-main/.gitignore | 6 + .../resiliency/srv-driven-main/src/index.d.ts | 0 .../resiliency/srv-driven-main/tspconfig.yaml | 1 + .../resiliency/srv-driven-old/.gitignore | 6 + .../resiliency/srv-driven-old/src/index.d.ts | 0 .../resiliency/srv-driven-old/tspconfig.yaml | 1 + .../encoded-name/json/.gitignore | 6 + .../encoded-name/json/src/index.d.ts | 26 + .../encoded-name/json/tspconfig.yaml | 17 + .../server/endpoint/not-defined/.gitignore | 6 + .../endpoint/not-defined/src/index.d.ts | 18 + .../endpoint/not-defined/tspconfig.yaml | 17 + .../generated/server/path/multiple/.gitignore | 6 + .../server/path/multiple/src/index.d.ts | 25 + .../server/path/multiple/tspconfig.yaml | 17 + .../generated/server/path/single/.gitignore | 6 + .../server/path/single/src/index.d.ts | 18 + .../server/path/single/tspconfig.yaml | 17 + .../server/versions/not-versioned/.gitignore | 6 + .../versions/not-versioned/src/index.d.ts | 26 + .../versions/not-versioned/tspconfig.yaml | 17 + .../server/versions/versioned/.gitignore | 6 + .../server/versions/versioned/src/index.d.ts | 36 + .../server/versions/versioned/tspconfig.yaml | 17 + .../special-headers/repeatability/.gitignore | 6 + .../repeatability/src/index.d.ts | 18 + .../repeatability/tspconfig.yaml | 13 + .../generated/special-words/.gitignore | 6 + .../generated/special-words/src/index.d.ts | 570 ++++++ .../generated/special-words/tspconfig.yaml | 17 + .../generated/type/array/.gitignore | 6 + .../generated/type/array/src/index.d.ts | 187 ++ .../generated/type/array/tspconfig.yaml | 14 + .../generated/type/dictionary/.gitignore | 6 + .../generated/type/dictionary/src/index.d.ts | 151 ++ .../generated/type/dictionary/tspconfig.yaml | 19 + .../generated/type/enum/extensible/.gitignore | 6 + .../type/enum/extensible/src/index.d.ts | 36 + .../type/enum/extensible/tspconfig.yaml | 16 + .../generated/type/enum/fixed/.gitignore | 6 + .../generated/type/enum/fixed/src/index.d.ts | 32 + .../generated/type/enum/fixed/tspconfig.yaml | 15 + .../generated/type/model/empty/.gitignore | 6 + .../generated/type/model/empty/src/index.d.ts | 35 + .../generated/type/model/empty/tspconfig.yaml | 13 + .../inheritance/enum-discriminator/.gitignore | 6 + .../enum-discriminator/src/index.d.ts | 72 + .../enum-discriminator/tspconfig.yaml | 16 + .../nested-discriminator/.gitignore | 6 + .../nested-discriminator/src/index.d.ts | 67 + .../nested-discriminator/tspconfig.yaml | 16 + .../inheritance/not-discriminated/.gitignore | 6 + .../not-discriminated/src/index.d.ts | 38 + .../not-discriminated/tspconfig.yaml | 16 + .../model/inheritance/recursive/.gitignore | 6 + .../inheritance/recursive/src/index.d.ts | 31 + .../inheritance/recursive/tspconfig.yaml | 13 + .../single-discriminator/.gitignore | 6 + .../single-discriminator/src/index.d.ts | 79 + .../single-discriminator/tspconfig.yaml | 16 + .../generated/type/model/usage/.gitignore | 6 + .../type/model}/usage/src/index.d.ts | 6 +- .../generated/type/model/usage/tspconfig.yaml | 13 + .../property/additional-properties/.gitignore | 6 + .../additional-properties/src/index.d.ts | 0 .../additional-properties/tspconfig.yaml | 1 + .../type/property/nullable/.gitignore | 6 + .../type/property/nullable/src/index.d.ts | 193 ++ .../type/property/nullable/tspconfig.yaml | 19 + .../type/property/optionality/.gitignore | 6 + .../type/property/optionality/src/index.d.ts | 399 ++++ .../type/property/optionality/tspconfig.yaml | 19 + .../type/property/value-types/.gitignore | 6 + .../type/property/value-types/src/index.d.ts | 487 +++++ .../type/property/value-types/tspconfig.yaml | 13 + .../generated/type/scalar/.gitignore | 6 + .../generated/type/scalar/src/index.d.ts | 106 ++ .../generated/type/scalar/tspconfig.yaml | 17 + .../generated/type/union/.gitignore | 6 + .../generated/type/union/src/index.d.ts | 194 ++ .../generated/type/union/tspconfig.yaml | 18 + .../generated/versioning/added/.gitignore | 6 + .../generated/versioning/added/src/index.d.ts | 48 + .../generated/versioning/added/tspconfig.yaml | 17 + .../versioning/madeOptional/.gitignore | 6 + .../versioning/madeOptional/src/index.d.ts | 26 + .../versioning/madeOptional/tspconfig.yaml | 17 + .../generated/versioning/removed/.gitignore | 6 + .../versioning/removed/src/index.d.ts | 41 + .../versioning/removed/tspconfig.yaml | 17 + .../versioning/renamedFrom/.gitignore | 6 + .../versioning/renamedFrom/src/index.d.ts | 34 + .../versioning/renamedFrom/tspconfig.yaml | 17 + .../returnTypeChangedFrom/.gitignore | 6 + .../returnTypeChangedFrom/src/index.d.ts | 20 + .../returnTypeChangedFrom/tspconfig.yaml | 17 + .../versioning/typeChangedFrom/.gitignore | 6 + .../versioning/typeChangedFrom/src/index.d.ts | 25 + .../versioning/typeChangedFrom/tspconfig.yaml | 17 + .../headersRepeatability.spec.ts | 22 + .../lroRpc.spec.ts | 0 .../lroStardard.spec.ts | 0 .../modelFlatten.spec.ts | 0 .../modelInheritanceEnumDiscriminator.spec.ts | 67 + ...odelInheritanceNestedDiscriminator.spec.ts | 123 ++ .../modelInheritanceNotDiscriminated.spec.ts | 32 + .../modelInheritanceRecursive.spec.ts | 42 + ...odelInheritanceSingleDiscriminator.spec.ts | 77 + .../modelPropertyAdditional.spec.ts | 0 .../modelPropertyType.spec.ts | 392 ++++ .../modelsEmpty.spec.ts | 31 + .../nullableProperties.spec.ts | 130 ++ .../optionalProperties.spec.ts | 197 ++ .../payloadContentNegotiation.spec.ts | 48 + .../payloadMediaType.spec.ts | 36 + .../payloadPageable.spec.ts | 25 + .../resiliencySrvDrivenMain.spec.ts | 0 .../resiliencySrvDrivenOld.spec.ts | 0 .../azureModularIntegration/scalar.spec.ts | 127 ++ .../serializationEncodeNameJson.spec.ts | 25 + .../azureModularIntegration/server.spec.ts | 132 ++ .../serverEndpointNotDefined.spec.ts | 17 + .../specialWords.spec.ts | 486 +++++ .../spreadParameters.spec.ts | 92 + .../azureModularIntegration/unions.spec.ts | 142 ++ .../azureModularIntegration/usage.spec.ts | 69 + .../versioningAdded.spec.ts | 45 + .../versioningMadeOptional.spec.ts | 17 + .../versioningRemoved.spec.ts | 57 + .../versioningRenamedFrom.spec.ts | 34 + .../versioningReturnTypeChangedFrom.spec.ts | 21 + .../versioningTypeChangedFrom.spec.ts | 21 + .../test/commands/cadl-ranch-list.js | 389 +++- .../test/commands/gen-cadl-ranch.js | 14 +- packages/typespec-ts/test/commands/run.ts | 12 +- .../test/integration/collectionFormat.spec.ts | 11 + .../authentication/api-key/src/index.d.ts | 12 +- .../authentication/api-key/tspconfig.yaml | 4 +- .../authentication/http/custom/src/index.d.ts | 12 +- .../authentication/http/custom/tspconfig.yaml | 4 +- .../authentication/oauth2/src/index.d.ts | 12 +- .../authentication/oauth2/tspconfig.yaml | 4 +- .../authentication/union/src/index.d.ts | 14 +- .../authentication/union/tspconfig.yaml | 4 +- .../generated/encode/bytes/src/index.d.ts | 14 +- .../generated/encode/bytes/tspconfig.yaml | 5 +- .../generated/encode/datetime/src/index.d.ts | 14 +- .../generated/encode/datetime/tspconfig.yaml | 5 +- .../generated/encode/duration/src/index.d.ts | 12 +- .../generated/encode/duration/tspconfig.yaml | 4 +- .../generated/encode/numeric/src/index.d.ts | 10 +- .../generated/encode/numeric/tspconfig.yaml | 4 +- .../generated/parameters/basic/src/index.d.ts | 10 +- .../generated/parameters/basic/tspconfig.yaml | 4 +- .../body-optionality/src/index.d.ts | 10 +- .../body-optionality/tspconfig.yaml | 4 +- .../collection-format/src/index.d.ts | 12 +- .../collection-format/tspconfig.yaml | 4 +- .../parameters/spread/src/index.d.ts | 12 +- .../parameters/spread/tspconfig.yaml | 4 +- .../content-negotiation/src/index.d.ts | 14 +- .../content-negotiation/tspconfig.yaml | 4 +- .../payload/media-type/src/index.d.ts | 12 +- .../payload/media-type/tspconfig.yaml | 4 +- .../payload/multipart/src/index.d.ts | 10 +- .../payload/multipart/tspconfig.yaml | 4 +- .../generated/routes/src/index.d.ts | 10 +- .../generated/routes/tspconfig.yaml | 4 +- .../encoded-name/json/src/index.d.ts | 10 +- .../encoded-name/json/tspconfig.yaml | 4 +- .../endpoint/not-defined/src/index.d.ts | 10 +- .../endpoint/not-defined/tspconfig.yaml | 4 +- .../server/path/multiple/src/index.d.ts | 10 +- .../server/path/multiple/tspconfig.yaml | 4 +- .../server/path/single/src/index.d.ts | 10 +- .../server/path/single/tspconfig.yaml | 4 +- .../versions/not-versioned/src/index.d.ts | 10 +- .../versions/not-versioned/tspconfig.yaml | 4 +- .../server/versions/versioned/src/index.d.ts | 10 +- .../server/versions/versioned/tspconfig.yaml | 4 +- .../generated/shared-route/src/index.d.ts | 12 +- .../generated/shared-route/tspconfig.yaml | 4 +- .../repeatability/src/index.d.ts | 14 +- .../repeatability/tspconfig.yaml | 4 +- .../generated/special-words/src/index.d.ts | 10 +- .../generated/special-words/tspconfig.yaml | 3 +- .../generated/type/array/src/index.d.ts | 10 +- .../generated/type/array/tspconfig.yaml | 4 +- .../generated/type/dictionary/src/index.d.ts | 10 +- .../generated/type/dictionary/tspconfig.yaml | 4 +- .../type/enum/extensible/src/index.d.ts | 10 +- .../type/enum/extensible/tspconfig.yaml | 4 +- .../generated/type/enum/fixed/src/index.d.ts | 10 +- .../generated/type/enum/fixed/tspconfig.yaml | 4 +- .../generated/type/model/empty/src/index.d.ts | 10 +- .../generated/type/model/empty/tspconfig.yaml | 4 +- .../enum-discriminator/src/index.d.ts | 10 +- .../enum-discriminator/tspconfig.yaml | 4 +- .../nested-discriminator/src/index.d.ts | 10 +- .../nested-discriminator/tspconfig.yaml | 4 +- .../not-discriminated/src/index.d.ts | 10 +- .../not-discriminated/tspconfig.yaml | 4 +- .../inheritance/recursive/src/index.d.ts | 10 +- .../inheritance/recursive/tspconfig.yaml | 4 +- .../single-discriminator/src/index.d.ts | 10 +- .../single-discriminator/tspconfig.yaml | 4 +- .../generated/type/model/usage/src/index.d.ts | 10 +- .../generated/type/model/usage/tspconfig.yaml | 4 +- .../type/model/visibility/src/index.d.ts | 10 +- .../type/model/visibility/tspconfig.yaml | 4 +- .../type/property/nullable/src/index.d.ts | 10 +- .../type/property/nullable/tspconfig.yaml | 4 +- .../type/property/optionality/src/index.d.ts | 10 +- .../type/property/optionality/tspconfig.yaml | 4 +- .../type/property/value-types/src/index.d.ts | 10 +- .../type/property/value-types/tspconfig.yaml | 3 +- .../generated/type/scalar/src/index.d.ts | 10 +- .../generated/type/scalar/tspconfig.yaml | 4 +- .../generated/type/union/src/index.d.ts | 10 +- .../generated/type/union/tspconfig.yaml | 4 +- .../generated/union-body/src/index.d.ts | 10 +- .../generated/union-body/tspconfig.yaml | 4 +- .../generated/versioning/added/src/index.d.ts | 12 +- .../generated/versioning/added/tspconfig.yaml | 4 +- .../versioning/madeOptional/src/index.d.ts | 10 +- .../versioning/madeOptional/tspconfig.yaml | 4 +- .../versioning/renamedFrom/src/index.d.ts | 10 +- .../versioning/renamedFrom/tspconfig.yaml | 4 +- .../returnTypeChangedFrom/src/index.d.ts | 10 +- .../returnTypeChangedFrom/tspconfig.yaml | 4 +- .../versioning/typeChangedFrom/src/index.d.ts | 10 +- .../versioning/typeChangedFrom/tspconfig.yaml | 4 +- .../test/integration/payloadPageable.spec.ts | 77 - .../authentication/api-key/src/index.d.ts | 8 +- .../authentication/api-key/tspconfig.yaml | 4 +- .../authentication/http/custom/src/index.d.ts | 8 +- .../authentication/http/custom/tspconfig.yaml | 4 +- .../authentication/oauth2/src/index.d.ts | 8 +- .../authentication/oauth2/tspconfig.yaml | 4 +- .../authentication/union/src/index.d.ts | 10 +- .../authentication/union/tspconfig.yaml | 5 +- .../generated/encode/bytes/src/index.d.ts | 6 +- .../generated/encode/bytes/tspconfig.yaml | 4 +- .../generated/encode/datetime/src/index.d.ts | 6 +- .../generated/encode/datetime/tspconfig.yaml | 4 +- .../generated/encode/duration/src/index.d.ts | 6 +- .../generated/encode/duration/tspconfig.yaml | 4 +- .../generated/encode/numeric/src/index.d.ts | 6 +- .../generated/encode/numeric/tspconfig.yaml | 4 +- .../generated/parameters/basic/src/index.d.ts | 6 +- .../generated/parameters/basic/tspconfig.yaml | 4 +- .../body-optionality/src/index.d.ts | 6 +- .../body-optionality/tspconfig.yaml | 4 +- .../collection-format/src/index.d.ts | 6 +- .../collection-format/tspconfig.yaml | 4 +- .../parameters/spread/src/index.d.ts | 6 +- .../parameters/spread/tspconfig.yaml | 4 +- .../content-negotiation/src/index.d.ts | 6 +- .../content-negotiation/tspconfig.yaml | 4 +- .../payload/media-type/src/index.d.ts | 6 +- .../payload/media-type/tspconfig.yaml | 4 +- .../encoded-name/json/src/index.d.ts | 6 +- .../encoded-name/json/tspconfig.yaml | 4 +- .../endpoint/not-defined/src/index.d.ts | 6 +- .../endpoint/not-defined/tspconfig.yaml | 4 +- .../server/path/multiple/src/index.d.ts | 6 +- .../server/path/multiple/tspconfig.yaml | 4 +- .../server/path/single/src/index.d.ts | 6 +- .../server/path/single/tspconfig.yaml | 4 +- .../versions/not-versioned/src/index.d.ts | 6 +- .../versions/not-versioned/tspconfig.yaml | 4 +- .../server/versions/versioned/src/index.d.ts | 6 +- .../server/versions/versioned/tspconfig.yaml | 4 +- .../repeatability/src/index.d.ts | 6 +- .../repeatability/tspconfig.yaml | 4 +- .../generated/special-words/src/index.d.ts | 6 +- .../generated/special-words/tspconfig.yaml | 4 +- .../generated/type/array/src/index.d.ts | 6 +- .../generated/type/array/tspconfig.yaml | 4 +- .../generated/type/dictionary/src/index.d.ts | 6 +- .../generated/type/dictionary/tspconfig.yaml | 4 +- .../type/enum/extensible/src/index.d.ts | 6 +- .../type/enum/extensible/tspconfig.yaml | 4 +- .../generated/type/enum/fixed/src/index.d.ts | 6 +- .../generated/type/enum/fixed/tspconfig.yaml | 4 +- .../generated/type/model/empty/src/index.d.ts | 6 +- .../generated/type/model/empty/tspconfig.yaml | 4 +- .../enum-discriminator/src/index.d.ts | 6 +- .../enum-discriminator/tspconfig.yaml | 4 +- .../nested-discriminator/src/index.d.ts | 6 +- .../nested-discriminator/tspconfig.yaml | 4 +- .../not-discriminated/src/index.d.ts | 6 +- .../not-discriminated/tspconfig.yaml | 4 +- .../inheritance/recursive/src/index.d.ts | 6 +- .../inheritance/recursive/tspconfig.yaml | 4 +- .../single-discriminator/src/index.d.ts | 6 +- .../single-discriminator/tspconfig.yaml | 4 +- .../generated/type/model/usage/src/index.d.ts | 6 +- .../generated/type/model/usage/tspconfig.yaml | 4 +- .../type/property/nullable/src/index.d.ts | 6 +- .../type/property/nullable/tspconfig.yaml | 4 +- .../type/property/optionality/src/index.d.ts | 6 +- .../type/property/optionality/tspconfig.yaml | 4 +- .../type/property/value-types/src/index.d.ts | 6 +- .../type/property/value-types/tspconfig.yaml | 4 +- .../generated/type/scalar/src/index.d.ts | 6 +- .../generated/type/scalar/tspconfig.yaml | 4 +- .../generated/type/union/src/index.d.ts | 6 +- .../generated/type/union/tspconfig.yaml | 4 +- .../generated/versioning/added/src/index.d.ts | 6 +- .../generated/versioning/added/tspconfig.yaml | 4 +- .../versioning/madeOptional/src/index.d.ts | 6 +- .../versioning/madeOptional/tspconfig.yaml | 4 +- .../versioning/removed/src/index.d.ts | 6 +- .../versioning/removed/tspconfig.yaml | 4 +- .../versioning/renamedFrom/src/index.d.ts | 6 +- .../versioning/renamedFrom/tspconfig.yaml | 4 +- .../returnTypeChangedFrom/src/index.d.ts | 6 +- .../returnTypeChangedFrom/tspconfig.yaml | 4 +- .../versioning/typeChangedFrom/src/index.d.ts | 6 +- .../versioning/typeChangedFrom/tspconfig.yaml | 4 +- .../payloadPageable.spec.ts | 88 - .../generated/models/usage/tspconfig.yaml | 14 - .../modular/usage.spec.ts | 93 - .../nonBrandedIntegration/rlc/usage.spec.ts | 50 - 773 files changed, 27382 insertions(+), 1313 deletions(-) create mode 100644 packages/typespec-ts/test/azureIntegration/arrayItemTypes.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/authApiKey.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/authCustomHttp.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/authOauth2.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/authUnion.spec.ts rename packages/typespec-ts/test/{integration => azureIntegration}/azureArmManagedIdentity.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azureArmResources.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azureClientGeneratorCoreAccess.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azureClientGeneratorCoreUsage.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azureCoreModel.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azureCorePage.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/azureExampleBasic.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/azurePayloadPageable.spec.ts rename packages/typespec-ts/test/{integration => azureIntegration}/azurecore.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azurecorescalar.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/azurecoretraits.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/basicParameters.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/bodyParameters.spec.ts rename packages/typespec-ts/test/{integration => azureIntegration}/clientNaming.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/clientRequestIdHeader.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/clientStructure.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/collectionFormat.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/dictionary.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/emptyModel.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/encodeBytes.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/encodeDatetime.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/encodeDuration.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/encodeNumeric.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/extensibleEnums.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/fixedEnums.spec.ts rename packages/typespec-ts/test/{integration/generated/azure/client-generator-core/access => azureIntegration/generated/authentication/api-key}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/tspconfig.yaml rename packages/typespec-ts/test/{integration/generated/azure/client-generator-core/flatten-property => azureIntegration/generated/authentication/http/custom}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/tspconfig.yaml rename packages/typespec-ts/test/{integration/generated/azure/client-generator-core/usage => azureIntegration/generated/authentication/oauth2}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/tspconfig.yaml rename packages/typespec-ts/test/{integration/generated/azure/core/basic => azureIntegration/generated/authentication/union}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/union/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/authentication/union/tspconfig.yaml rename packages/typespec-ts/test/{integration/generated/azure/core/lro/rpc => azureIntegration/generated/azure/client-generator-core/access}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/client-generator-core/access/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/client-generator-core/access/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/core/lro/standard => azureIntegration/generated/azure/client-generator-core/flatten-property}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/client-generator-core/flatten-property/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/client-generator-core/flatten-property/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/core/model => azureIntegration/generated/azure/client-generator-core/usage}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/client-generator-core/usage/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/client-generator-core/usage/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/core/page => azureIntegration/generated/azure/core/basic}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/basic/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/basic/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/core/scalar => azureIntegration/generated/azure/core/lro/rpc}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/lro/rpc/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/lro/rpc/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/core/traits => azureIntegration/generated/azure/core/lro/standard}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/lro/standard/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/lro/standard/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/resource-manager/common-properties => azureIntegration/generated/azure/core/model}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/model/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/model/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/resource-manager/resources => azureIntegration/generated/azure/core/page}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/page/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/page/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/azure/special-headers/client-request-id => azureIntegration/generated/azure/core/scalar}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/scalar/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/scalar/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/client/naming => azureIntegration/generated/azure/core/traits}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/traits/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/core/traits/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/client/structure/client-operation-group => azureIntegration/generated/azure/example/basic}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/tspconfig.yaml rename packages/typespec-ts/test/{integration/generated/client/structure/default => azureIntegration/generated/azure/payload/pageable}/.gitignore (100%) rename packages/typespec-ts/test/{integration/generated => azureIntegration/generated/azure}/payload/pageable/src/index.d.ts (98%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/tspconfig.yaml rename packages/typespec-ts/test/{integration/generated/client/structure/multi-client => azureIntegration/generated/azure/resource-manager/common-properties}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/resource-manager/common-properties/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/resource-manager/common-properties/tspconfig.yaml (96%) rename packages/typespec-ts/test/{integration/generated/client/structure/renamed-operation => azureIntegration/generated/azure/resource-manager/resources}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/resource-manager/resources/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/resource-manager/resources/tspconfig.yaml (96%) rename packages/typespec-ts/test/{integration/generated/client/structure/two-operation-group => azureIntegration/generated/azure/special-headers/client-request-id}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/special-headers/client-request-id/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/azure/special-headers/client-request-id/tspconfig.yaml (94%) rename packages/typespec-ts/test/{integration/generated/media-types => azureIntegration/generated/client/naming}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/naming/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/naming/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/overload => azureIntegration/generated/client/structure/client-operation-group}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/client-operation-group/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/client-operation-group/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/payload/pageable => azureIntegration/generated/client/structure/default}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/default/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/default/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/resiliency/srv-driven-main => azureIntegration/generated/client/structure/multi-client}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/multi-client/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/multi-client/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/resiliency/srv-driven-old => azureIntegration/generated/client/structure/renamed-operation}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/renamed-operation/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/renamed-operation/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/type/property/additional-properties => azureIntegration/generated/client/structure/two-operation-group}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/two-operation-group/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/client/structure/two-operation-group/tspconfig.yaml (95%) rename packages/typespec-ts/test/{integration/generated/versioning/removed => azureIntegration/generated/encode/bytes}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/bytes/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/bytes/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/client-generator-core/access => azureIntegration/generated/encode/datetime}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/datetime/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/datetime/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/client-generator-core/flatten-property => azureIntegration/generated/encode/duration}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/duration/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/duration/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/client-generator-core/usage => azureIntegration/generated/encode/numeric}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/numeric/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/encode/numeric/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/basic => azureIntegration/generated/media-types}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/media-types/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/media-types/tspconfig.yaml (94%) rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/lro/rpc => azureIntegration/generated/overload}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/overload/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/overload/tspconfig.yaml (93%) rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/lro/standard => azureIntegration/generated/parameters/basic}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/basic/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/basic/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/model => azureIntegration/generated/parameters/body-optionality}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/page => azureIntegration/generated/parameters/collection-format}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/scalar => azureIntegration/generated/parameters/spread}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/spread/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/parameters/spread/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/core/traits => azureIntegration/generated/payload/content-negotiation}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/example/basic => azureIntegration/generated/payload/media-type}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/media-type/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/media-type/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/resource-manager/common-properties => azureIntegration/generated/payload/multipart}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/multipart/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/multipart/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/azure/resource-manager/resources => azureIntegration/generated/payload/pageable}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/payload/pageable/src/index.d.ts rename packages/typespec-ts/test/{integration => azureIntegration}/generated/payload/pageable/tspconfig.yaml (94%) rename packages/typespec-ts/test/{modularIntegration/generated/azure/special-headers/client-request-id => azureIntegration/generated/resiliency/srv-driven-main}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/resiliency/srv-driven-main/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/resiliency/srv-driven-main/tspconfig.yaml (95%) rename packages/typespec-ts/test/{modularIntegration/generated/client/naming => azureIntegration/generated/resiliency/srv-driven-old}/.gitignore (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/resiliency/srv-driven-old/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/resiliency/srv-driven-old/tspconfig.yaml (95%) rename packages/typespec-ts/test/{modularIntegration/generated/client/structure/client-operation-group => azureIntegration/generated/routes}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/routes/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/routes/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/client/structure/default => azureIntegration/generated/serialization/encoded-name/json}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/client/structure/multi-client => azureIntegration/generated/server/endpoint/not-defined}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/client/structure/renamed-operation => azureIntegration/generated/server/path/multiple}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/client/structure/two-operation-group => azureIntegration/generated/server/path/single}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/path/single/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/path/single/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/payload/pageable => azureIntegration/generated/server/versions/not-versioned}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/resiliency/srv-driven-main => azureIntegration/generated/server/versions/versioned}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/resiliency/srv-driven-old => azureIntegration/generated/shared-route}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/shared-route/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/shared-route/tspconfig.yaml rename packages/typespec-ts/test/{modularIntegration/generated/type/property/additional-properties => azureIntegration/generated/special-headers/repeatability}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/tspconfig.yaml rename packages/typespec-ts/test/{nonBrandedIntegration/modular/generated/models/usage => azureIntegration/generated/special-words}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/special-words/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/special-words/tspconfig.yaml rename packages/typespec-ts/test/{nonBrandedIntegration/rlc/generated/models/usage => azureIntegration/generated/type/array}/.gitignore (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/array/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/array/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/dictionary/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/dictionary/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/dictionary/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/empty/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/empty/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/empty/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/usage/.gitignore rename packages/typespec-ts/test/{nonBrandedIntegration/rlc/generated/models => azureIntegration/generated/type/model}/usage/src/index.d.ts (85%) rename packages/typespec-ts/test/{nonBrandedIntegration/rlc/generated/models => azureIntegration/generated/type/model}/usage/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/.gitignore rename packages/typespec-ts/test/{integration => azureIntegration}/generated/type/property/additional-properties/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/type/property/additional-properties/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/scalar/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/scalar/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/scalar/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/union/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/union/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/type/union/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/union-body/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/union-body/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/union-body/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/added/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/added/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/added/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/removed/.gitignore rename packages/typespec-ts/test/{integration => azureIntegration}/generated/versioning/removed/src/index.d.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/generated/versioning/removed/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/.gitignore create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml rename packages/typespec-ts/test/{integration => azureIntegration}/lroCore.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/lroRpc.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/mediaTypes.spec.ts (100%) rename packages/typespec-ts/test/{integration => azureIntegration}/modelFlatten.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/modelInheritance.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelInheritanceEnumDiscriminator.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelInheritanceNotDiscriminated.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelInheritanceRecursive.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelInheritanceSingleDiscriminator.spec.ts rename packages/typespec-ts/test/{integration => azureIntegration}/modelPropertyAdditional.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/modelPropertyNullable.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelPropertyOptional.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelPropertyType.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/modelUsage.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/multipart.spec.ts rename packages/typespec-ts/test/{integration => azureIntegration}/overload.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/payloadContentNegotiation.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/payloadMediaType.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/payloadPageable.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/repeatableHeaders.spec.ts rename packages/typespec-ts/test/{integration => azureIntegration}/resiliencyDpgCustomization.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureIntegration/routes.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/scalar.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/serializationEncodeNameJson.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/server.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/serverEndpointNotDefined.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/sharedRoutes.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/specialWords.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/spreadParameters.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/media-types/client.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/media-types/main.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/media-types/routes.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/overload/client.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/overload/main.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/overload/routes.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/shared-route/main.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/shared-route/routes.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/typespec/union-body/main.tsp create mode 100644 packages/typespec-ts/test/azureIntegration/unionBody.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/unions.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/versioningAdded.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/versioningMadeOptional.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/versioningRemoved.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/versioningRenamedFrom.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/versioningReturnTypeChangedFrom.spec.ts create mode 100644 packages/typespec-ts/test/azureIntegration/versioningTypeChangedFrom.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/arrayItemTypes.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/authApiKey.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/authHttpCustom.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/authOauth2.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/authUnion.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureArmManagedIdentity.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureArmResources.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureClientGeneratorCoreAccess.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureClientGeneratorCoreUsage.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureCore.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureCoreModel.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureCorePage.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureCoreTraits.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azureExampleClient.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/azurePayloadPageable.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/azurecorescalar.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/basicParameters.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/bodyOptionality.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/clientNaming.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/clientStructureDefault.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/clientStructureMultiClient.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/clientStructureOperationGroup.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/clientStructureRenamed.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/clientStructureTwoGroup.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/collectionFormat.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/customClientRequestId.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/dictionaryTypes.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/encodeBytes.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/encodeDatetime.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/encodeDuration.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/encodeNumeric.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/extensibleEnums.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/fixedEnums.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/client-generator-core/access/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/client-generator-core/access/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/client-generator-core/flatten-property/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/client-generator-core/flatten-property/tspconfig.yaml (94%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/client-generator-core/usage/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/client-generator-core/usage/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/basic/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/basic/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/lro/rpc/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/lro/rpc/tspconfig.yaml (94%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/lro/standard/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/lro/standard/tspconfig.yaml (94%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/model/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/model/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/page/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/page/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/scalar/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/scalar/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/traits/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/core/traits/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/example/basic/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/example/basic/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/.gitignore rename packages/typespec-ts/test/{modularIntegration/generated => azureModularIntegration/generated/azure}/payload/pageable/src/index.d.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/resource-manager/common-properties/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/resource-manager/common-properties/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/resource-manager/resources/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/resource-manager/resources/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/special-headers/client-request-id/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/azure/special-headers/client-request-id/tspconfig.yaml (94%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/client/naming/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/naming/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/naming/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/client-operation-group/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/client-operation-group/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/default/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/default/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/multi-client/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/multi-client/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/renamed-operation/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/renamed-operation/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/two-operation-group/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/client/structure/two-operation-group/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/src/index.d.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/payload/pageable/tspconfig.yaml (95%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/resiliency/srv-driven-main/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/resiliency/srv-driven-main/tspconfig.yaml (94%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/resiliency/srv-driven-old/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/resiliency/srv-driven-old/tspconfig.yaml (94%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/special-words/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/special-words/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/special-words/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/array/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/array/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/array/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/.gitignore rename packages/typespec-ts/test/{nonBrandedIntegration/modular/generated/models => azureModularIntegration/generated/type/model}/usage/src/index.d.ts (84%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/.gitignore rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/type/property/additional-properties/src/index.d.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/generated/type/property/additional-properties/tspconfig.yaml (96%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/union/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/union/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/type/union/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/.gitignore create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml create mode 100644 packages/typespec-ts/test/azureModularIntegration/headersRepeatability.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/lroRpc.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/lroStardard.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/modelFlatten.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelInheritanceEnumDiscriminator.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelInheritanceNestedDiscriminator.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelInheritanceNotDiscriminated.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelInheritanceRecursive.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelInheritanceSingleDiscriminator.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/modelPropertyAdditional.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelPropertyType.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/modelsEmpty.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/nullableProperties.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/optionalProperties.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/payloadContentNegotiation.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/payloadMediaType.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/payloadPageable.spec.ts rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/resiliencySrvDrivenMain.spec.ts (100%) rename packages/typespec-ts/test/{modularIntegration => azureModularIntegration}/resiliencySrvDrivenOld.spec.ts (100%) create mode 100644 packages/typespec-ts/test/azureModularIntegration/scalar.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/serializationEncodeNameJson.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/server.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/serverEndpointNotDefined.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/specialWords.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/spreadParameters.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/unions.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/usage.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/versioningAdded.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/versioningMadeOptional.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/versioningRemoved.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/versioningRenamedFrom.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/versioningReturnTypeChangedFrom.spec.ts create mode 100644 packages/typespec-ts/test/azureModularIntegration/versioningTypeChangedFrom.spec.ts delete mode 100644 packages/typespec-ts/test/integration/payloadPageable.spec.ts delete mode 100644 packages/typespec-ts/test/modularIntegration/payloadPageable.spec.ts delete mode 100644 packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/tspconfig.yaml delete mode 100644 packages/typespec-ts/test/nonBrandedIntegration/modular/usage.spec.ts delete mode 100644 packages/typespec-ts/test/nonBrandedIntegration/rlc/usage.spec.ts diff --git a/.scripts/ci.yml b/.scripts/ci.yml index fb117f4d78..4eae381522 100644 --- a/.scripts/ci.yml +++ b/.scripts/ci.yml @@ -17,10 +17,10 @@ parameters: variables: AUTOREST_TESTSERVER_COVERAGE_DIRECTORY: "$(Build.SourcesDirectory)/packages/autorest.typescript/coverage/" - TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/cadl-ranch-coverage-typescript-rlc-azure.json" - TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/cadl-ranch-coverage-typescript-rlc-standard.json" - TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/cadl-ranch-coverage-typescript-modular-azure.json" - TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/cadl-ranch-coverage-typescript-modular-standard.json" + TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/spector-coverage-typescript-rlc-azure.json" + TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/spector-coverage-typescript-rlc-standard.json" + TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/spector-coverage-typescript-modular-azure.json" + TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT: "$(Build.SourcesDirectory)/packages/typespec-ts/coverage/spector-coverage-typescript-modular-standard.json" pool: vmImage: ubuntu-20.04 @@ -245,7 +245,7 @@ stages: workingDirectory: $(Build.SourcesDirectory)/packages/typespec-test displayName: "Generate Contoso Code From TypeSpec" - - job: Cadl_Ranch_Test + - job: Spector_Standard_Test dependsOn: Build variables: - template: globals.yml @@ -279,45 +279,96 @@ stages: - script: npm run check-format workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts displayName: "Format check for TypeSpec emitter" - - script: npm run test + - script: npm run test:standard workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts - displayName: "Generate RLC Test Clients from Cadl-ranch" + displayName: "Generate standard Test Clients from Spector" - script: npm run check:tree workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts displayName: "Check git Tree" - - script: npx cadl-ranch check-coverage ./node_modules/@azure-tools/cadl-ranch-specs/http --coverageFiles $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) --coverageFiles $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT) --coverageFiles $(TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT) --coverageFiles $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT) - displayName: "Check Coverage" + - script: npx tsp-spector check-coverage ./node_modules/@typespec/http-specs/specs --coverageFiles [$(TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT)] + displayName: "Check Coverage RLC Standard" workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + condition: eq(variables['Agent.OS'], 'Linux') continueOnError: true - - publish: $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) - artifact: RLCAzureCoverageReport - displayName: "Publish rlc azure coverage report" - condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq( variables['Agent.OS'], 'Linux')) - - publish: $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT) - artifact: ModularAzureCoverageReport - displayName: "Publish modular azure coverage report" + - script: npx tsp-spector check-coverage ./node_modules/@typespec/http-specs/specs --coverageFiles [$(TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT)] + displayName: "Check Coverage Modular Standard" + workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + condition: eq(variables['Agent.OS'], 'Linux') + continueOnError: true + - publish: $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT) + artifact: ModularStandardCoverageReport + displayName: "Publish modular standard coverage report" condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq( variables['Agent.OS'], 'Linux')) - publish: $(TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT) artifact: RLCStandardCoverageReport displayName: "Publish rlc standard coverage report" condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq( variables['Agent.OS'], 'Windows')) - - publish: $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT) - artifact: ModularStandardCoverageReport - displayName: "Publish modular standard coverage report" + - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: + - task: AzureCLI@2 + displayName: "Upload to TypeSpec Coverage Standard Report" + inputs: + azureSubscription: "TypeSpec Storage" + scriptType: "bash" + scriptLocation: "inlineScript" + workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + inlineScript: | + npx tsp-spector upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT) --generatorName @azure-tools/typespec-ts-modular --storageAccountName typespec --containerName=coverages --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode standard + npx tsp-spector upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT) --generatorName @azure-tools/typespec-ts-rlc --storageAccountName typespec --containerName=coverages --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode standard + + - job: Spector_Azure_Test + dependsOn: Build + variables: + - template: globals.yml + strategy: + matrix: + macOS_Node20: + Pool: + OSVmImage: "macOS-latest" + NodeTestVersion: "20.x" + Linux_Node20: + Pool: ${{ parameters.LinuxPool }} + OSVmImage: "ubuntu-20.04" + NodeTestVersion: "20.x" + pool: + name: $[coalesce(variables['Pool'], '')] + vmImage: $[coalesce(variables['OSVmImage'], '')] + steps: + - template: build.yml + - script: npm run test:azure + workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + displayName: "Generate Azure Test Clients from Spector" + - script: npm run check:tree + workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + displayName: "Check git Tree" + - script: npx tsp-spector check-coverage ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --coverageFiles [$(TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT)] + displayName: "Check Coverage Modular azure" + workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + condition: eq(variables['Agent.OS'], 'Linux') + continueOnError: true + - script: npx tsp-spector check-coverage ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --coverageFiles [$(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT)] + displayName: "Check Coverage RLC Azure" + workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts + condition: eq(variables['Agent.OS'], 'Linux') + continueOnError: true + - publish: $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT) + artifact: ModularAzureCoverageReport + displayName: "Publish modular azure coverage report" + condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq( variables['Agent.OS'], 'Linux')) + - publish: $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) + artifact: rlcAzureCoverageReport + displayName: "Publish RLC azure coverage report" condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq( variables['Agent.OS'], 'Windows')) - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: - task: AzureCLI@2 - displayName: "Upload to Cadl Ranch Coverage Report" + displayName: "Upload to TypeSpec Coverage Report" inputs: - azureSubscription: "Cadl Ranch Storage" + azureSubscription: "TypeSpec Storage" scriptType: "bash" scriptLocation: "inlineScript" workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts inlineScript: | - npx cadl-ranch upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) --generatorName typescript/rlc --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure - npx cadl-ranch upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT) --generatorName typescript/modular --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure - npx cadl-ranch upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_RLC_STANDARD_REPORT) --generatorName typescript/rlc --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode standard - npx cadl-ranch upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_STANDARD_REPORT) --generatorName typescript/modular --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode standard + npx tsp-spector upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_MODULAR_AZURE_REPORT) --generatorName @azure-tools/typespec-ts-modular --storageAccountName typespec --containerName=coverages --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure + npx tsp-spector upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) --generatorName @azure-tools/typespec-ts-rlc --storageAccountName typespec --containerName=coverages --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'), eq(parameters.IncludeRelease,true))}}: - template: release.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 5af4657e0b..8339588050 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -233,10 +233,7 @@ importers: ../../packages/typespec-ts: specifiers: '@azure-rest/core-client': ^2.3.1 - '@azure-tools/cadl-ranch': ^0.16.1 - '@azure-tools/cadl-ranch-api': ^0.5.0 - '@azure-tools/cadl-ranch-expect': ^0.15.6 - '@azure-tools/cadl-ranch-specs': ^0.39.5 + '@azure-tools/azure-http-specs': 0.1.0-alpha.4 '@azure-tools/rlc-common': workspace:^0.37.0 '@azure-tools/typespec-autorest': '>=0.49.0 <1.0.0' '@azure-tools/typespec-azure-core': '>=0.49.0 <1.0.0' @@ -259,8 +256,11 @@ importers: '@typescript-eslint/parser': ^6.8.0 '@typespec/compiler': '>=0.63.0 <1.0.0' '@typespec/http': '>=0.63.0 <1.0.0' + '@typespec/http-specs': 0.1.0-alpha.5 '@typespec/openapi': '>=0.63.0, <1.0.0' '@typespec/rest': '>=0.63.0 <1.0.0' + '@typespec/spec-api': 0.1.0-alpha.0 + '@typespec/spector': 0.1.0-alpha.5 '@typespec/ts-http-runtime': 0.1.0 '@typespec/versioning': '>=0.63.0 <1.0.0' '@vitest/coverage-istanbul': ~1.6.0 @@ -292,10 +292,7 @@ importers: tslib: 2.6.2 devDependencies: '@azure-rest/core-client': 2.3.1 - '@azure-tools/cadl-ranch': 0.16.1_amejmqxr72jemg4hjnersfbvzq - '@azure-tools/cadl-ranch-api': 0.5.0 - '@azure-tools/cadl-ranch-expect': 0.15.6_acxnxaaiojnhbczdiyl7gkwmxa - '@azure-tools/cadl-ranch-specs': 0.39.5_76usnhwbv6t5blpkcdwohji23a + '@azure-tools/azure-http-specs': 0.1.0-alpha.4_ldprqbayjzr22uuwm2eyga4jyy '@azure-tools/typespec-autorest': 0.49.0_uqxpqfozgqwkdzs7u74gtza3vu '@azure-tools/typespec-azure-core': 0.49.0_kj4jfkbw33dcu4jtzp54cnb2fm '@azure-tools/typespec-azure-resource-manager': 0.49.0_3qeo4wm44dy4dvllcauv7rlpye @@ -317,8 +314,11 @@ importers: '@typescript-eslint/parser': 6.8.0_wgnkk2eh2432jxos7omdkkhhte '@typespec/compiler': 0.63.0 '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 + '@typespec/http-specs': 0.1.0-alpha.5_yw7pnhxbudkc7q4tltxs2pwzqi '@typespec/openapi': 0.63.0_qz2z3dajrrgsjonwob7haqlhte '@typespec/rest': 0.63.0_qz2z3dajrrgsjonwob7haqlhte + '@typespec/spec-api': 0.1.0-alpha.0 + '@typespec/spector': 0.1.0-alpha.5 '@typespec/ts-http-runtime': 0.1.0 '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 '@vitest/coverage-istanbul': 1.6.0_vitest@1.6.0 @@ -413,130 +413,28 @@ packages: proper-lockfile: 2.0.1 dev: false - /@azure-tools/cadl-ranch-api/0.5.0: - resolution: {integrity: sha512-awgLMCWGy4VxIJ5n9SJuTH0WfZFsUv5kYffIYfvGPtV3NIkCwO1u39Polb4BBR8GLELWjRuHMxYsmhwpTzRBpw==} - engines: {node: '>=16.0.0'} - dependencies: - body-parser: 1.20.3 - deep-equal: 2.2.2 - express: 4.21.1 - express-promise-router: 4.1.1_express@4.21.1 - glob: 11.0.0 - morgan: 1.10.0 - multer: 1.4.5-lts.1 - picocolors: 1.1.0 - winston: 3.14.1 - xml-formatter: 3.6.3 - xml2js: 0.6.2 - yargs: 17.7.2 - transitivePeerDependencies: - - '@types/express' - dev: true - - /@azure-tools/cadl-ranch-coverage-sdk/0.9.0: - resolution: {integrity: sha512-u4WU5U6Ps6oct9E3FiBdORMsSiqpV1VBFeiqH4ZTXCV3A245n3GzznRexZ5bDuRlRY4ea2BVvKrVnemaYaLp+w==} - engines: {node: '>=16.0.0'} - dependencies: - '@azure/identity': 4.4.1 - '@azure/storage-blob': 12.24.0 - '@types/node': 22.2.0 - transitivePeerDependencies: - - supports-color - dev: true - - /@azure-tools/cadl-ranch-expect/0.15.6_acxnxaaiojnhbczdiyl7gkwmxa: - resolution: {integrity: sha512-t601oyRwiSy/Nbbro5A7OHZSKsVGxGRJMPnd4X80dYetTBinUHXS2+cVx+fVQlUmb/4Ru/qNOvG0jtTJY9/XHw==} - engines: {node: '>=16.0.0'} + /@azure-tools/azure-http-specs/0.1.0-alpha.4_ldprqbayjzr22uuwm2eyga4jyy: + resolution: {integrity: sha512-kXjUnGU0yW3RYU22D+KCliDcnUjhkfX0MSZT0Xi7OBfJqEtD1ONyfUVVtUt5QYpRQH/8oazL96SRZ0XAz6Zaew==} + engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.62.0 - '@typespec/http': ~0.62.0 - '@typespec/rest': ~0.62.0 - '@typespec/versioning': ~0.62.0 + '@azure-tools/typespec-azure-core': ~0.49.0 + '@typespec/compiler': ~0.63.0 + '@typespec/http': ~0.63.0 + '@typespec/rest': ~0.63.0 + '@typespec/versioning': ~0.63.0 + '@typespec/xml': ~0.63.0 dependencies: - '@typespec/compiler': 0.63.0 - '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 - '@typespec/rest': 0.63.0_qz2z3dajrrgsjonwob7haqlhte - '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 - dev: true - - /@azure-tools/cadl-ranch-expect/0.15.6_y2ehqb5acwlhqijbizhu3l6izi: - resolution: {integrity: sha512-t601oyRwiSy/Nbbro5A7OHZSKsVGxGRJMPnd4X80dYetTBinUHXS2+cVx+fVQlUmb/4Ru/qNOvG0jtTJY9/XHw==} - engines: {node: '>=16.0.0'} - peerDependencies: - '@typespec/compiler': ~0.62.0 - '@typespec/http': ~0.62.0 - '@typespec/rest': ~0.62.0 - '@typespec/versioning': ~0.62.0 - dependencies: - '@typespec/compiler': 0.62.0 - '@typespec/http': 0.62.0_@typespec+compiler@0.62.0 - '@typespec/rest': 0.62.0_ehpjn7t5lr2snllrxt4bmumehe - '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 - dev: true - - /@azure-tools/cadl-ranch-specs/0.39.5_76usnhwbv6t5blpkcdwohji23a: - resolution: {integrity: sha512-OZr9wNxl6gMCpIwrpdaSbxEDamNtiACTLOCjQBZwDLTfW+15wOF0eavjTW+WV/M5qoCHqsldURYKPyT6tnRe4g==} - engines: {node: '>=16.0.0'} - peerDependencies: - '@azure-tools/cadl-ranch-expect': ~0.15.6 - '@azure-tools/typespec-azure-core': ~0.48.0 - '@typespec/compiler': ~0.62.0 - '@typespec/http': ~0.62.0 - '@typespec/rest': ~0.62.0 - '@typespec/versioning': ~0.62.0 - '@typespec/xml': ~0.62.0 - dependencies: - '@azure-tools/cadl-ranch': 0.16.1_amejmqxr72jemg4hjnersfbvzq - '@azure-tools/cadl-ranch-api': 0.5.0 - '@azure-tools/cadl-ranch-expect': 0.15.6_acxnxaaiojnhbczdiyl7gkwmxa '@azure-tools/typespec-azure-core': 0.49.0_kj4jfkbw33dcu4jtzp54cnb2fm '@typespec/compiler': 0.63.0 '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 '@typespec/rest': 0.63.0_qz2z3dajrrgsjonwob7haqlhte + '@typespec/spec-api': 0.1.0-alpha.0 + '@typespec/spector': 0.1.0-alpha.5 '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 - '@typespec/xml': 0.62.0_@typespec+compiler@0.63.0 - transitivePeerDependencies: - - '@types/express' - - '@typespec/streams' - - debug - - supports-color - dev: true - - /@azure-tools/cadl-ranch/0.16.1_amejmqxr72jemg4hjnersfbvzq: - resolution: {integrity: sha512-4tyd+2GDsZjkcsiB14T2m5imkPCokJkFLKrPe0mINb5Z6DVVzk/2BkhId//zk9KinpYL0ThG9ewM1ZeJ0jnoeg==} - engines: {node: '>=16.0.0'} - hasBin: true - dependencies: - '@azure-tools/cadl-ranch-api': 0.5.0 - '@azure-tools/cadl-ranch-coverage-sdk': 0.9.0 - '@azure-tools/cadl-ranch-expect': 0.15.6_y2ehqb5acwlhqijbizhu3l6izi - '@azure/identity': 4.4.1 - '@types/js-yaml': 4.0.6 - '@typespec/compiler': 0.62.0 - '@typespec/http': 0.62.0_@typespec+compiler@0.62.0 - '@typespec/rest': 0.62.0_ehpjn7t5lr2snllrxt4bmumehe - ajv: 8.17.1 - axios: 1.7.7 - body-parser: 1.20.3 - deep-equal: 2.2.2 - express: 4.21.1 - express-promise-router: 4.1.1_express@4.21.1 - form-data: 3.0.2 - glob: 11.0.0 - jackspeak: 4.0.1 - js-yaml: 4.1.0 - morgan: 1.10.0 - multer: 1.4.5-lts.1 - node-fetch: 3.3.2 - picocolors: 1.1.0 - source-map-support: 0.5.21 - winston: 3.14.1 - xml2js: 0.6.2 - yargs: 17.7.2 + '@typespec/xml': 0.63.0_@typespec+compiler@0.63.0 transitivePeerDependencies: - '@types/express' - '@typespec/streams' - - '@typespec/versioning' - debug - supports-color dev: true @@ -831,6 +729,14 @@ packages: tslib: 2.6.2 dev: true + /@azure/core-xml/1.4.4: + resolution: {integrity: sha512-J4FYAqakGXcbfeZjwjMzjNcpcH4E+JtEBv+xcV1yL0Ydn/6wbQfeFKTCHh9wttAi0lmajHw7yBbHPRG+YHckZQ==} + engines: {node: '>=18.0.0'} + dependencies: + fast-xml-parser: 4.5.0 + tslib: 2.6.2 + dev: true + /@azure/identity/4.4.1: resolution: {integrity: sha512-DwnG4cKFEM7S3T+9u05NstXU/HN0dk45kPOinUyNKsn5VWwpXd9sbPKEg6kgJzGbm1lMuhx9o31PVbCtM5sfBA==} engines: {node: '>=18.0.0'} @@ -896,11 +802,11 @@ packages: - encoding dev: true - /@azure/storage-blob/12.24.0: - resolution: {integrity: sha512-l8cmWM4C7RoNCBOImoFMxhTXe1Lr+8uQ/IgnhRNMpfoA9bAFWoLG4XrWm6O5rKXortreVQuD+fc1hbzWklOZbw==} + /@azure/storage-blob/12.25.0: + resolution: {integrity: sha512-oodouhA3nCCIh843tMMbxty3WqfNT+Vgzj3Xo5jqR9UPnzq3d7mzLjlHAYz7lW+b4km3SIgz+NAgztvhm7Z6kQ==} engines: {node: '>=18.0.0'} dependencies: - '@azure/abort-controller': 1.1.0 + '@azure/abort-controller': 2.1.2 '@azure/core-auth': 1.6.0 '@azure/core-client': 1.9.2 '@azure/core-http-compat': 2.1.2 @@ -909,7 +815,7 @@ packages: '@azure/core-rest-pipeline': 1.14.0 '@azure/core-tracing': 1.1.2 '@azure/core-util': 1.9.0 - '@azure/core-xml': 1.3.4 + '@azure/core-xml': 1.4.4 '@azure/logger': 1.0.4 events: 3.3.0 tslib: 2.6.2 @@ -2238,10 +2144,10 @@ packages: /@types/node/18.18.0: resolution: {integrity: sha512-3xA4X31gHT1F1l38ATDIL9GpRLdwVhnEFC8Uikv5ZLlXATwrCYyPq7ZWHxzxc3J/30SUiwiYT+bQe0/XvKlWbw==} - /@types/node/22.2.0: - resolution: {integrity: sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==} + /@types/node/22.7.9: + resolution: {integrity: sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==} dependencies: - undici-types: 6.13.0 + undici-types: 6.19.8 dev: true /@types/semver/7.5.3: @@ -2420,27 +2326,6 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typespec/compiler/0.62.0: - resolution: {integrity: sha512-RfKJ/rF2Wjxu7dl74oJE8yEfSkeL7NopFlyJ4dW1JQXpRN2IOJYPxas12qZA6H9ZEIB8rBjyrHNxJSQbvn/UDQ==} - engines: {node: '>=18.0.0'} - hasBin: true - dependencies: - '@babel/code-frame': 7.25.9 - ajv: 8.17.1 - change-case: 5.4.4 - globby: 14.0.2 - mustache: 4.2.0 - picocolors: 1.1.0 - prettier: 3.3.3 - prompts: 2.4.2 - semver: 7.6.3 - temporal-polyfill: 0.2.5 - vscode-languageserver: 9.0.1 - vscode-languageserver-textdocument: 1.0.12 - yaml: 2.5.1 - yargs: 17.7.2 - dev: true - /@typespec/compiler/0.63.0: resolution: {integrity: sha512-cC3YniwbFghn1fASX3r1IgNjMrwaY4gmzznkHT4f/NxE+HK4XoXWn4EG7287QgVMCaHUykzJCIfW9k7kIleW5A==} engines: {node: '>=18.0.0'} @@ -2461,17 +2346,28 @@ packages: yaml: 2.5.1 yargs: 17.7.2 - /@typespec/http/0.62.0_@typespec+compiler@0.62.0: - resolution: {integrity: sha512-6H9y9e32lb2s76MMy29ITCwSZNG42sa/qWthiByUvfbTEXMpu5a1fQHNj7RXg+xmDKmVIHv3gAfjGPAWfXhkaQ==} - engines: {node: '>=18.0.0'} + /@typespec/http-specs/0.1.0-alpha.5_yw7pnhxbudkc7q4tltxs2pwzqi: + resolution: {integrity: sha512-2bOsxnzXPAW2S+gMiu6c/TAmimIBs5MPiFETSFNvsSRJZ+b9Smg+4nHW+6iZGVcVskjYAU97WHccGkNL3lwIVg==} + engines: {node: '>=16.0.0'} peerDependencies: - '@typespec/compiler': ~0.62.0 - '@typespec/streams': ~0.62.0 - peerDependenciesMeta: - '@typespec/streams': - optional: true + '@typespec/compiler': ~0.63.0 + '@typespec/http': ~0.63.0 + '@typespec/rest': ~0.63.0 + '@typespec/versioning': ~0.63.0 + '@typespec/xml': ~0.63.0 dependencies: - '@typespec/compiler': 0.62.0 + '@typespec/compiler': 0.63.0 + '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 + '@typespec/rest': 0.63.0_qz2z3dajrrgsjonwob7haqlhte + '@typespec/spec-api': 0.1.0-alpha.0 + '@typespec/spector': 0.1.0-alpha.5 + '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 + '@typespec/xml': 0.63.0_@typespec+compiler@0.63.0 + transitivePeerDependencies: + - '@types/express' + - '@typespec/streams' + - debug + - supports-color dev: true /@typespec/http/0.63.0_@typespec+compiler@0.63.0: @@ -2529,17 +2425,6 @@ packages: yaml: 2.5.1 dev: false - /@typespec/rest/0.62.0_ehpjn7t5lr2snllrxt4bmumehe: - resolution: {integrity: sha512-ci5UjelEKFwsPTdpgysoUoDCcw02EnbG4GBuYJdR5mRrFCBZMxrbro+OJLgSN3g/TORSsWlW7dEOWLfbyrmlZQ==} - engines: {node: '>=18.0.0'} - peerDependencies: - '@typespec/compiler': ~0.62.0 - '@typespec/http': ~0.62.0 - dependencies: - '@typespec/compiler': 0.62.0 - '@typespec/http': 0.62.0_@typespec+compiler@0.62.0 - dev: true - /@typespec/rest/0.63.0_qz2z3dajrrgsjonwob7haqlhte: resolution: {integrity: sha512-HftzMjSDHAYX+ILE9C6pFS4oAq7oBHMCtpA8QgSFPDF4V5a8l1k2K8c4x1B+7yl+GkREmIdtpc6S0xZm2G7hXg==} engines: {node: '>=18.0.0'} @@ -2550,6 +2435,74 @@ packages: '@typespec/compiler': 0.63.0 '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 + /@typespec/spec-api/0.1.0-alpha.0: + resolution: {integrity: sha512-SgWSt5mnl9bbc+C9toMzh4i8RESWcAfMg/Wyq+3oY+0EcKlmDYNWgDhQi/Eh8bA4zyMoymj48hcEzD97E1ERtQ==} + engines: {node: '>=18.0.0'} + dependencies: + body-parser: 1.20.3 + deep-equal: 2.2.2 + express: 4.21.1 + express-promise-router: 4.1.1_express@4.21.1 + morgan: 1.10.0 + multer: 1.4.5-lts.1 + picocolors: 1.1.0 + prettier: 3.3.3 + winston: 3.17.0 + xml2js: 0.6.2 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/express' + dev: true + + /@typespec/spec-coverage-sdk/0.1.0-alpha.2: + resolution: {integrity: sha512-bdU5K6jZ12+wEH4b7I7aiytIJu2M+tAigoxxc9Tz7UrucbA5PZqgO+uFoqMKRYcmNjwC4EmvEIVmyzNEKUzUmA==} + engines: {node: '>=16.0.0'} + dependencies: + '@azure/identity': 4.4.1 + '@azure/storage-blob': 12.25.0 + '@types/node': 22.7.9 + transitivePeerDependencies: + - supports-color + dev: true + + /@typespec/spector/0.1.0-alpha.5: + resolution: {integrity: sha512-HV6fZkQFy/0IrPiySyCzYraESlWsNhp04Azf9Ss6a63Bjkw6ZQoxz4YvzH4fLvlmo1zFPxOYFXul+JZZw81TtQ==} + engines: {node: '>=16.0.0'} + hasBin: true + dependencies: + '@azure/identity': 4.4.1 + '@types/js-yaml': 4.0.6 + '@typespec/compiler': 0.63.0 + '@typespec/http': 0.63.0_@typespec+compiler@0.63.0 + '@typespec/rest': 0.63.0_qz2z3dajrrgsjonwob7haqlhte + '@typespec/spec-api': 0.1.0-alpha.0 + '@typespec/spec-coverage-sdk': 0.1.0-alpha.2 + '@typespec/versioning': 0.63.0_@typespec+compiler@0.63.0 + ajv: 8.17.1 + axios: 1.7.7 + body-parser: 1.20.3 + deep-equal: 2.2.2 + express: 4.21.1 + express-promise-router: 4.1.1_express@4.21.1 + form-data: 4.0.1 + globby: 14.0.2 + jackspeak: 4.0.2 + js-yaml: 4.1.0 + morgan: 1.10.0 + multer: 1.4.5-lts.1 + node-fetch: 3.3.2 + picocolors: 1.1.1 + source-map-support: 0.5.21 + winston: 3.17.0 + xml2js: 0.6.2 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/express' + - '@typespec/streams' + - debug + - supports-color + dev: true + /@typespec/ts-http-runtime/0.1.0: resolution: {integrity: sha512-0NspintCRrSIIZBUtVfWjJ5TpOjpP0mNsJXZOqzuxdY/q2yCr0amyUCEw+WLhRykP39XMNMG0f1F9LbC2+c+Rw==} engines: {node: '>=18.0.0'} @@ -2569,11 +2522,11 @@ packages: dependencies: '@typespec/compiler': 0.63.0 - /@typespec/xml/0.62.0_@typespec+compiler@0.63.0: - resolution: {integrity: sha512-DexGTQHB75fncDcYfs5CIbNwO6NOhjwCaaNoHYAsVVzs4T8qwzw6WQdEEMzZRbgsxwnllFkxKwGhLtRMQdv/cQ==} + /@typespec/xml/0.63.0_@typespec+compiler@0.63.0: + resolution: {integrity: sha512-2aQxWWqc5f4OTmC2nNafHi+ppr8GqwwMXx/2DnNjeshZF/JD0FNCYH8gV4gFZe7mfRfB9bAxNkcKj2AF01ntqA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.62.0 + '@typespec/compiler': ~0.63.0 dependencies: '@typespec/compiler': 0.63.0 dev: true @@ -3015,7 +2968,7 @@ packages: /array-buffer-byte-length/1.0.0: resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 is-array-buffer: 3.0.2 dev: true @@ -3102,7 +3055,7 @@ packages: resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} dependencies: follow-redirects: 1.15.9 - form-data: 4.0.0 + form-data: 4.0.1 proxy-from-env: 1.1.0 transitivePeerDependencies: - debug @@ -3323,7 +3276,7 @@ packages: resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} dependencies: function-bind: 1.1.1 - get-intrinsic: 1.2.1 + get-intrinsic: 1.2.4 dev: true /call-bind/1.0.7: @@ -3800,15 +3753,6 @@ packages: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true - /define-data-property/1.1.0: - resolution: {integrity: sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.4 - gopd: 1.0.1 - has-property-descriptors: 1.0.0 - dev: true - /define-data-property/1.1.4: resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} @@ -3827,8 +3771,8 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} dependencies: - define-data-property: 1.1.0 - has-property-descriptors: 1.0.0 + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 object-keys: 1.1.1 dev: true @@ -4038,16 +3982,16 @@ packages: array-buffer-byte-length: 1.0.0 arraybuffer.prototype.slice: 1.0.2 available-typed-arrays: 1.0.5 - call-bind: 1.0.2 + call-bind: 1.0.7 es-set-tostringtag: 2.0.1 es-to-primitive: 1.2.1 function.prototype.name: 1.1.6 - get-intrinsic: 1.2.1 + get-intrinsic: 1.2.4 get-symbol-description: 1.0.0 globalthis: 1.0.3 gopd: 1.0.1 has: 1.0.3 - has-property-descriptors: 1.0.0 + has-property-descriptors: 1.0.2 has-proto: 1.0.1 has-symbols: 1.0.3 internal-slot: 1.0.5 @@ -4059,7 +4003,7 @@ packages: is-string: 1.0.7 is-typed-array: 1.1.12 is-weakref: 1.0.2 - object-inspect: 1.12.3 + object-inspect: 1.13.2 object-keys: 1.1.1 object.assign: 4.1.4 regexp.prototype.flags: 1.5.1 @@ -4091,8 +4035,8 @@ packages: /es-get-iterator/1.1.3: resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 has-symbols: 1.0.3 is-arguments: 1.1.1 is-map: 2.0.2 @@ -4540,6 +4484,13 @@ packages: strnum: 1.0.5 dev: true + /fast-xml-parser/4.5.0: + resolution: {integrity: sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==} + hasBin: true + dependencies: + strnum: 1.0.5 + dev: true + /fastest-levenshtein/1.0.16: resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} engines: {node: '>= 4.9.1'} @@ -4705,22 +4656,22 @@ packages: mime-types: 2.1.35 dev: true - /form-data/3.0.2: - resolution: {integrity: sha512-sJe+TQb2vIaIyO783qN6BlMYWMw3WBOHA1Ay2qxsnjuafEOQFJ2JakedOQirT6D5XPRxDvS7AHYyem9fTpb4LQ==} + /form-data/4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 - dev: true - /form-data/4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + /form-data/4.0.1: + resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} engines: {node: '>= 6'} dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + dev: true /formdata-polyfill/4.0.10: resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} @@ -4919,19 +4870,6 @@ packages: path-scurry: 1.10.1 dev: true - /glob/11.0.0: - resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==} - engines: {node: 20 || >=22} - hasBin: true - dependencies: - foreground-child: 3.1.1 - jackspeak: 4.0.1 - minimatch: 10.0.1 - minipass: 7.1.2 - package-json-from-dist: 1.0.0 - path-scurry: 2.0.0 - dev: true - /glob/7.2.0: resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} dependencies: @@ -5068,12 +5006,6 @@ packages: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - /has-property-descriptors/1.0.0: - resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} - dependencies: - get-intrinsic: 1.2.4 - dev: true - /has-property-descriptors/1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} dependencies: @@ -5101,7 +5033,7 @@ packages: resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} engines: {node: '>= 0.4.0'} dependencies: - function-bind: 1.1.1 + function-bind: 1.1.2 dev: true /hasown/2.0.2: @@ -5291,15 +5223,15 @@ packages: resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 has-tostringtag: 1.0.0 dev: true /is-array-buffer/3.0.2: resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 is-typed-array: 1.1.12 dev: true @@ -5415,7 +5347,7 @@ packages: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 has-tostringtag: 1.0.0 dev: true @@ -5426,7 +5358,7 @@ packages: /is-shared-array-buffer/1.0.2: resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 dev: true /is-stream/2.0.1: @@ -5578,13 +5510,11 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true - /jackspeak/4.0.1: - resolution: {integrity: sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==} + /jackspeak/4.0.2: + resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} engines: {node: 20 || >=22} dependencies: '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 dev: true /jest-worker/27.5.1: @@ -5964,8 +5894,8 @@ packages: triple-beam: 1.4.1 dev: true - /logform/2.6.1: - resolution: {integrity: sha512-CdaO738xRapbKIMVn2m4F6KTj4j7ooJ8POVnebSgKo3KBz5axNXRAL7ZdRjIV6NOr2Uf4vjtRkxrFETOioCqSA==} + /logform/2.7.0: + resolution: {integrity: sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==} engines: {node: '>= 12.0.0'} dependencies: '@colors/colors': 1.6.0 @@ -5994,11 +5924,6 @@ packages: engines: {node: 14 || >=16.14} dev: true - /lru-cache/11.0.0: - resolution: {integrity: sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==} - engines: {node: 20 || >=22} - dev: true - /lru-cache/5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} dependencies: @@ -6110,13 +6035,6 @@ packages: engines: {node: '>=12'} dev: true - /minimatch/10.0.1: - resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} - engines: {node: 20 || >=22} - dependencies: - brace-expansion: 2.0.1 - dev: true - /minimatch/3.0.8: resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==} dependencies: @@ -6463,7 +6381,7 @@ packages: resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 define-properties: 1.2.1 dev: true @@ -6476,7 +6394,7 @@ packages: resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 define-properties: 1.2.1 has-symbols: 1.0.3 object-keys: 1.1.1 @@ -6614,10 +6532,6 @@ packages: netmask: 2.0.2 dev: true - /package-json-from-dist/1.0.0: - resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} - dev: true - /parent-module/1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -6688,14 +6602,6 @@ packages: minipass: 7.1.2 dev: true - /path-scurry/2.0.0: - resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} - engines: {node: 20 || >=22} - dependencies: - lru-cache: 11.0.0 - minipass: 7.1.2 - dev: true - /path-to-regexp/0.1.10: resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==} dev: true @@ -6935,7 +6841,7 @@ packages: resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} engines: {node: '>=0.6'} dependencies: - side-channel: 1.0.4 + side-channel: 1.0.6 dev: true /qs/6.13.0: @@ -7044,7 +6950,7 @@ packages: resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 define-properties: 1.2.1 set-function-name: 2.0.1 dev: true @@ -7362,9 +7268,9 @@ packages: resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} engines: {node: '>= 0.4'} dependencies: - define-data-property: 1.1.0 + define-data-property: 1.1.4 functions-have-names: 1.2.3 - has-property-descriptors: 1.0.0 + has-property-descriptors: 1.0.2 dev: true /setprototypeof/1.2.0: @@ -7409,8 +7315,8 @@ packages: /side-channel/1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 object-inspect: 1.12.3 dev: true @@ -8136,8 +8042,8 @@ packages: resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==} dev: true - /undici-types/6.13.0: - resolution: {integrity: sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==} + /undici-types/6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} dev: true /unicorn-magic/0.1.0: @@ -8530,7 +8436,7 @@ packages: engines: {node: '>= 0.4'} dependencies: available-typed-arrays: 1.0.5 - call-bind: 1.0.2 + call-bind: 1.0.7 for-each: 0.3.3 gopd: 1.0.1 has-tostringtag: 1.0.0 @@ -8568,16 +8474,16 @@ packages: resolution: {integrity: sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==} engines: {node: '>= 6.4.0'} dependencies: - logform: 2.6.1 + logform: 2.7.0 readable-stream: 3.6.2 triple-beam: 1.4.1 dev: true - /winston-transport/4.7.1: - resolution: {integrity: sha512-wQCXXVgfv/wUPOfb2x0ruxzwkcZfxcktz6JIMUaPLmcNhO4bZTwA/WtDWK74xV3F2dKu8YadrFv0qhwYjVEwhA==} + /winston-transport/4.9.0: + resolution: {integrity: sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==} engines: {node: '>= 12.0.0'} dependencies: - logform: 2.6.1 + logform: 2.7.0 readable-stream: 3.6.2 triple-beam: 1.4.1 dev: true @@ -8599,21 +8505,21 @@ packages: winston-transport: 4.5.0 dev: true - /winston/3.14.1: - resolution: {integrity: sha512-CJi4Il/msz8HkdDfXOMu+r5Au/oyEjFiOZzbX2d23hRLY0narGjqfE5lFlrT5hfYJhPtM8b85/GNFsxIML/RVA==} + /winston/3.17.0: + resolution: {integrity: sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==} engines: {node: '>= 12.0.0'} dependencies: '@colors/colors': 1.6.0 '@dabh/diagnostics': 2.0.3 async: 3.2.4 is-stream: 2.0.1 - logform: 2.6.1 + logform: 2.7.0 one-time: 1.0.0 readable-stream: 3.6.2 safe-stable-stringify: 2.4.3 stack-trace: 0.0.10 triple-beam: 1.4.1 - winston-transport: 4.7.1 + winston-transport: 4.9.0 dev: true /wordwrap/1.0.0: @@ -8675,18 +8581,6 @@ packages: optional: true dev: true - /xml-formatter/3.6.3: - resolution: {integrity: sha512-++x1TlRO1FRlQ82AZ4WnoCSufaI/PT/sycn4K8nRl4gnrNC1uYY2VV/67aALZ2m0Q4Q/BLj/L69K360Itw9NNg==} - engines: {node: '>= 16'} - dependencies: - xml-parser-xo: 4.1.2 - dev: true - - /xml-parser-xo/4.1.2: - resolution: {integrity: sha512-Z/DRB0ZAKj5vAQg++XsfQQKfT73Vfj5n5lKIVXobBDQEva6NHWUTxOA6OohJmEcpoy8AEqBmSGkXXAnFwt5qAA==} - engines: {node: '>= 16'} - dev: true - /xml2js/0.5.0: resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==} engines: {node: '>=4.0.0'} diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index 08015682df..a0aeb0d09c 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -20,41 +20,42 @@ "clean": "rimraf ./dist ./typespec-output", "build": "tsc -p .", "test": "npm run test-next && npm run unit-test && npm run integration-test-ci", + "test:azure": "npm run test-next && npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular", + "test:standard": "npm run test-next && npm run copy:typespec && npm run unit-test&& npm run integration-test-ci:rlc && npm run integration-test-ci:modular", "lint": "eslint src --ext .ts --max-warnings=0", "lint:fix": "eslint src --fix --ext .ts", "format": "npm run -s prettier -- --write", "check-format": "npm run prettier -- --check", "prettier": "prettier --config ./.prettierrc \"src/**/*.ts\"", "check:tree": "node --loader ts-node/esm ./test/commands/check-clean-tree.ts", - "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:rlc integration-test-ci:modular integration-test-ci:non-branded-rlc integration-test-ci:non-branded-modular", + "integration-test-ci": "npm-run-all copy:typespec integration-test-ci:rlc integration-test-ci:azure-rlc integration-test-ci:modular integration-test-ci:azure-modular", "integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:modular && npm run integration-test-ci:modular", "integration-test-ci:rlc": "npm-run-all --silent -p start-test-server:rlc --race generate-and-run:rlc", + "integration-test-ci:azure-rlc": "npm-run-all --silent -p start-test-server:azure-rlc --race generate-and-run:azure-rlc", "integration-test-ci:modular": "npm-run-all --silent -p start-test-server:modular --race generate-and-run:modular", - "integration-test-ci:non-branded-rlc": "npm-run-all --silent -p start-test-server:non-branded-rlc --race generate-and-run:non-branded-rlc", - "integration-test-ci:non-branded-modular": "npm-run-all --silent -p start-test-server:non-branded-modular --race generate-and-run:non-branded-modular", - "start-test-server": "mkdirp -p coverage && npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --coverageFile ./coverage/cadl-ranch-coverage-typescript.json", - "start-test-server:rlc": "mkdirp -p coverage && npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --coverageFile ./coverage/cadl-ranch-coverage-typescript-rlc-azure.json", - "start-test-server:modular": "mkdirp -p coverage && npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --port 3002 --coverageFile ./coverage/cadl-ranch-coverage-typescript-modular-azure.json", - "start-test-server:non-branded-rlc": "mkdirp -p coverage && npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --port 3003 --coverageFile ./coverage/cadl-ranch-coverage-typescript-rlc-standard.json", - "start-test-server:non-branded-modular": "mkdirp -p coverage && npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --port 3004 --coverageFile ./coverage/cadl-ranch-coverage-typescript-modular-standard.json", - "copy:typespec": "rm -rf temp && mkdirp -p temp && cp -r ./node_modules/@azure-tools/cadl-ranch-specs/* ./temp && cp -r ./test/integration/typespec/* ./temp/http", + "integration-test-ci:azure-modular": "npm-run-all --silent -p start-test-server:azure-modular --race generate-and-run:azure-modular", + "start-test-server": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript.json", + "start-test-server:rlc": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript-rlc-standard.json", + "start-test-server:azure-rlc": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript-rlc-azure.json", + "start-test-server:modular": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-modular-standard.json", + "start-test-server:azure-modular": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-modular-azure.json", + "copy:typespec": "rm -rf temp && mkdirp -p temp && cp -r ./node_modules/@typespec/http-specs/* ./temp && cp -r ./node_modules/@azure-tools/azure-http-specs/specs/* ./temp/specs && cp -r ./test/integration/typespec/* ./temp/specs", "generate-and-run:rlc": "npm run generate-tsp-only:rlc && npm run integration-test:alone:rlc && npm run stop-test-server -- -p 3000", + "generate-and-run:azure-rlc": "npm run generate-tsp-only:azure-rlc && npm run integration-test:alone:azure-rlc && npm run stop-test-server -- -p 3000", "generate-and-run:modular": "npm run generate-tsp-only:modular && npm run integration-test:alone:modular && npm run stop-test-server -- -p 3002", - "generate-and-run:non-branded-rlc": "npm run generate-tsp-only:non-branded-rlc && npm run integration-test:alone:non-branded-rlc && npm run stop-test-server -- -p 3003", - "generate-and-run:non-branded-modular": "npm run generate-tsp-only:non-branded-modular && npm run integration-test:alone:non-branded-modular && npm run stop-test-server -- -p 3004", - "generate-tsp-only": "npm run generate-tsp-only:rlc && npm run generate-tsp-only:modular && npm run generate-tsp-only:non-branded-rlc && npm run generate-tsp-only:non-branded-modular", + "generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular && npm run integration-test:alone:azure-modular && npm run stop-test-server -- -p 3002", + "generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:rlc &&npm run generate-tsp-only:azure-modular && npm run generate-tsp-only:modular", "generate-tsp-only:rlc": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=rlc", + "generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=azure-rlc", "generate-tsp-only:modular": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=modular", - "generate-tsp-only:non-branded": "npm run generate-tsp-only:non-branded-rlc && npm run generate-tsp-only:non-branded-modular", - "generate-tsp-only:non-branded-rlc": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=non-branded-rlc", - "generate-tsp-only:non-branded-modular": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=non-branded-modular", - "regen-test-baselines": "npm run generate-tsp-only && npm run generate-tsp-only:non-branded", - "integration-test:alone": "npm run integration-test:alone:rlc && npm run integration-test:alone:modular", + "generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=azure-modular", + "regen-test-baselines": "npm run generate-tsp-only", + "integration-test:alone": "npm run integration-test:alone:rlc && npm run integration-test:alone:azure-rlc && npm run integration-test:alone:modular && npm run integration-test:alone:azure-modular", "integration-test:alone:rlc": "cross-env TS_NODE_PROJECT=tsconfig.integration.json mocha -r ts-node/register --experimental-specifier-resolution=node --timeout 36000 ./test/integration/*.spec.ts", + "integration-test:alone:azure-rlc": "cross-env TS_NODE_PROJECT=tsconfig.integration.json mocha -r ts-node/register --experimental-specifier-resolution=node --timeout 36000 ./test/azureIntegration/*.spec.ts", "integration-test:alone:modular": "cross-env TS_NODE_PROJECT=tsconfig.integration.json mocha -r ts-node/register --experimental-specifier-resolution=node --timeout 36000 ./test/modularIntegration/*.spec.ts", - "integration-test:alone:non-branded-rlc": "cross-env TS_NODE_PROJECT=tsconfig.integration.json mocha -r ts-node/register --experimental-specifier-resolution=node --timeout 36000 ./test/nonBrandedIntegration/rlc/*.spec.ts", - "integration-test:alone:non-branded-modular": "cross-env TS_NODE_PROJECT=tsconfig.integration.json mocha -r ts-node/register --experimental-specifier-resolution=node --timeout 36000 ./test/nonBrandedIntegration/modular/*.spec.ts", - "stop-test-server": "npx cadl-ranch server stop", + "integration-test:alone:azure-modular": "cross-env TS_NODE_PROJECT=tsconfig.integration.json mocha -r ts-node/register --experimental-specifier-resolution=node --timeout 36000 ./test/azureModularIntegration/*.spec.ts", + "stop-test-server": "npx tsp-spector server stop", "unit-test": "npm-run-all --parallel unit-test:rlc unit-test:modular", "unit-test:rlc": "cross-env TS_NODE_PROJECT=tsconfig.json mocha -r ts-node/register --experimental-specifier-resolution=node --experimental-modules=true --timeout 36000 './test/unit/**/*.spec.ts'", "unit-test:modular": "cross-env TS_NODE_PROJECT=tsconfig.json mocha -r ts-node/register --experimental-specifier-resolution=node --experimental-modules=true --no-timeout './test/modularUnit/**/*.spec.ts'" @@ -63,10 +64,10 @@ "license": "MIT", "devDependencies": { "@azure-rest/core-client": "^2.3.1", - "@azure-tools/cadl-ranch-expect": "^0.15.6", - "@azure-tools/cadl-ranch-specs": "^0.39.5", - "@azure-tools/cadl-ranch": "^0.16.1", - "@azure-tools/cadl-ranch-api": "^0.5.0", + "@typespec/http-specs": "0.1.0-alpha.5", + "@typespec/spector": "0.1.0-alpha.5", + "@typespec/spec-api": "0.1.0-alpha.0", + "@azure-tools/azure-http-specs": "0.1.0-alpha.4", "@azure-tools/typespec-autorest": ">=0.49.0 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.49.0 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.49.0 <1.0.0", diff --git a/packages/typespec-ts/test/azureIntegration/arrayItemTypes.spec.ts b/packages/typespec-ts/test/azureIntegration/arrayItemTypes.spec.ts new file mode 100644 index 0000000000..780418596e --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/arrayItemTypes.spec.ts @@ -0,0 +1,104 @@ +import ArrayItemTypesClientFactory, { + ArrayItemTypesClient +} from "./generated/type/array/src/index.js"; +import { assert } from "chai"; +import { matrix } from "../util/matrix.js"; + +interface TypeDetail { + type: string; + defaultValue: any; + convertedToFn?: (_: any) => any; +} + +const testedTypes: TypeDetail[] = [ + { + type: "int32", + defaultValue: [1, 2] + }, + { + type: "int64", + defaultValue: [Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER] + }, + { + type: "boolean", + defaultValue: [true, false] + }, + { + type: "string", + defaultValue: ["hello", ""] + }, + { + type: "float32", + defaultValue: [43.125] + }, + { + type: "datetime", + defaultValue: ["2022-08-26T18:38:00Z"] + }, + { + type: "duration", + defaultValue: ["P123DT22H14M12.011S"] + }, + { + type: "unknown", + defaultValue: [1, "hello", null] + }, + { + type: "model", + defaultValue: [{ property: "hello" }, { property: "world" }] + }, + { + type: "nullable-float", + defaultValue: [1.25, null, 3.0] + }, + { + type: "nullable-boolean", + defaultValue: [true, null, false] + }, + { + type: "nullable-int32", + defaultValue: [1, null, 3] + }, + { + type: "nullable-string", + defaultValue: ["hello", null, "world"] + }, + { + type: "nullable-model", + defaultValue: [{ property: "hello" }, null, { property: "world" }] + } +]; +describe("Array Item-Types Client", () => { + let client: ArrayItemTypesClient; + + beforeEach(() => { + client = ArrayItemTypesClientFactory({ + allowInsecureConnection: true + }); + }); + + matrix([testedTypes], async (params: TypeDetail) => { + it(`should get a ${params.type} value`, async () => { + const result = await client + .path(`/type/array/${params.type}` as any) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, params.defaultValue); + }); + + it(`should put a ${params.type} value`, async () => { + let property; + if (params.convertedToFn) { + property = params.convertedToFn(params.defaultValue); + } else { + property = params.defaultValue; + } + const result = await client + .path(`/type/array/${params.type}` as any) + .put({ + body: property + }); + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/authApiKey.spec.ts b/packages/typespec-ts/test/azureIntegration/authApiKey.spec.ts new file mode 100644 index 0000000000..2935664a15 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/authApiKey.spec.ts @@ -0,0 +1,36 @@ +import ApiKeyClientFactory, { + AuthApiKeyClient +} from "./generated/authentication/api-key/src/index.js"; +import { assert } from "chai"; +describe("AuthApiKeyClient Rest Client", () => { + let validKeyClient: AuthApiKeyClient; + let invalidKeyClient: AuthApiKeyClient; + + beforeEach(() => { + validKeyClient = ApiKeyClientFactory( + { + key: "valid-key" + }, + { allowInsecureConnection: true } + ); + invalidKeyClient = ApiKeyClientFactory( + { + key: "invalid-key" + }, + { allowInsecureConnection: true } + ); + }); + + it("should return 204 when the apiKey is valid", async () => { + const result = await validKeyClient.path("/authentication/api-key/valid").get(); + assert.strictEqual(result.status, "204"); + }); + + it("should return 403 when the apiKey is invalid", async () => { + const result = await invalidKeyClient.path("/authentication/api-key/invalid").get(); + assert.strictEqual(result.status, "403"); + if (result.status === "403") { + assert.strictEqual(result.body.error, "invalid-api-key"); + } + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/authCustomHttp.spec.ts b/packages/typespec-ts/test/azureIntegration/authCustomHttp.spec.ts new file mode 100644 index 0000000000..2ec1be69d1 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/authCustomHttp.spec.ts @@ -0,0 +1,40 @@ +import AuthHttpCustomClientFactory, { + AuthHttpCustomClient +} from "./generated/authentication/http/custom/src/index.js"; +import { assert } from "chai"; +describe("AuthHttpCustomClient Rest Client", () => { + let validKeyClient: AuthHttpCustomClient; + let invalidKeyClient: AuthHttpCustomClient; + + beforeEach(() => { + validKeyClient = AuthHttpCustomClientFactory( + { + key: "valid-key" + }, + { allowInsecureConnection: true } + ); + invalidKeyClient = AuthHttpCustomClientFactory( + { + key: "invalid-key" + }, + { allowInsecureConnection: true } + ); + }); + + it("should return 204 when the apiKey is valid", async () => { + const result = await validKeyClient + .path("/authentication/http/custom/valid") + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should return 403 when the apiKey is invalid", async () => { + const result = await invalidKeyClient + .path("/authentication/http/custom/invalid") + .get(); + assert.strictEqual(result.status, "403"); + if (result.status === "403") { + assert.strictEqual(result.body.error, "invalid-api-key"); + } + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/authOauth2.spec.ts b/packages/typespec-ts/test/azureIntegration/authOauth2.spec.ts new file mode 100644 index 0000000000..276d04ed66 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/authOauth2.spec.ts @@ -0,0 +1,56 @@ +import Outh2ClientFactory, { + AuthOauth2Client +} from "./generated/authentication/oauth2/src/index.js"; +import { assert } from "chai"; +import { + bearerTokenAuthenticationPolicyName, + PipelinePolicy +} from "@azure/core-rest-pipeline"; +import { customBearerTokenAuthenticationPolicy } from "../util/customBearerTokenTestingPolicy.js"; + +describe("AuthOauth2Client Rest Client", () => { + let client: AuthOauth2Client; + let policy: PipelinePolicy; + const defaultScope = "https://security.microsoft.com/.default"; + + beforeEach(() => { + client = Outh2ClientFactory( + { + getToken: async () => Promise.resolve(null) + }, + { allowInsecureConnection: true } + ); + policy = customBearerTokenAuthenticationPolicy({ + scopes: defaultScope, + credential: { + getToken: async () => { + return { + token: defaultScope, + expiresOnTimestamp: Date.now() + }; + } + } + }); + client.pipeline.removePolicy({ + name: bearerTokenAuthenticationPolicyName + }); + client.pipeline.addPolicy(policy); + }); + + it("should return 204 when the token is valid", async () => { + const result = await client.path("/authentication/oauth2/valid").get(); + assert.strictEqual(result.status, "204"); + + }); + + it("should return 403 when the token is invalid", async () => { + client.pipeline.removePolicy({ + name: bearerTokenAuthenticationPolicyName + }); + const result = await client.path("/authentication/oauth2/invalid").get(); + assert.strictEqual(result.status, "403"); + if (result.status === "403") { + assert.strictEqual(result.body.error, "invalid-grant"); + } + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/authUnion.spec.ts b/packages/typespec-ts/test/azureIntegration/authUnion.spec.ts new file mode 100644 index 0000000000..7e609ca854 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/authUnion.spec.ts @@ -0,0 +1,62 @@ +import { assert } from "chai"; +import { + bearerTokenAuthenticationPolicyName, + PipelinePolicy +} from "@azure/core-rest-pipeline"; +import { customBearerTokenAuthenticationPolicy } from "../util/customBearerTokenTestingPolicy.js"; +import AuthUnionClientFactory, { + AuthUnionClient +} from "./generated/authentication/union/src/index.js"; + +describe("AuthUnionClient Rest Client", () => { + let client: AuthUnionClient; + let policy: PipelinePolicy; + const defaultScope = "https://security.microsoft.com/.default"; + + function prepareToken() { + client = AuthUnionClientFactory( + { + getToken: async () => Promise.resolve(null) + }, + { allowInsecureConnection: true } + ); + policy = customBearerTokenAuthenticationPolicy({ + scopes: defaultScope, + credential: { + getToken: async () => { + return { + token: defaultScope, + expiresOnTimestamp: Date.now() + }; + } + } + }); + client.pipeline.removePolicy({ + name: bearerTokenAuthenticationPolicyName + }); + client.pipeline.addPolicy(policy); + } + + function prepareKey() { + client = AuthUnionClientFactory( + { + key: "valid-key" + }, + { allowInsecureConnection: true } + ); + } + + it("should return 204 when the token is valid", async () => { + prepareToken(); + const result = await client + .path("/authentication/union/validtoken") + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should return 204 when the key is valid", async () => { + prepareKey(); + const result = await client.path("/authentication/union/validkey").get(); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/integration/azureArmManagedIdentity.spec.ts b/packages/typespec-ts/test/azureIntegration/azureArmManagedIdentity.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azureArmManagedIdentity.spec.ts rename to packages/typespec-ts/test/azureIntegration/azureArmManagedIdentity.spec.ts diff --git a/packages/typespec-ts/test/integration/azureArmResources.spec.ts b/packages/typespec-ts/test/azureIntegration/azureArmResources.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azureArmResources.spec.ts rename to packages/typespec-ts/test/azureIntegration/azureArmResources.spec.ts diff --git a/packages/typespec-ts/test/integration/azureClientGeneratorCoreAccess.spec.ts b/packages/typespec-ts/test/azureIntegration/azureClientGeneratorCoreAccess.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azureClientGeneratorCoreAccess.spec.ts rename to packages/typespec-ts/test/azureIntegration/azureClientGeneratorCoreAccess.spec.ts diff --git a/packages/typespec-ts/test/integration/azureClientGeneratorCoreUsage.spec.ts b/packages/typespec-ts/test/azureIntegration/azureClientGeneratorCoreUsage.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azureClientGeneratorCoreUsage.spec.ts rename to packages/typespec-ts/test/azureIntegration/azureClientGeneratorCoreUsage.spec.ts diff --git a/packages/typespec-ts/test/integration/azureCoreModel.spec.ts b/packages/typespec-ts/test/azureIntegration/azureCoreModel.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azureCoreModel.spec.ts rename to packages/typespec-ts/test/azureIntegration/azureCoreModel.spec.ts diff --git a/packages/typespec-ts/test/integration/azureCorePage.spec.ts b/packages/typespec-ts/test/azureIntegration/azureCorePage.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azureCorePage.spec.ts rename to packages/typespec-ts/test/azureIntegration/azureCorePage.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/azureExampleBasic.spec.ts b/packages/typespec-ts/test/azureIntegration/azureExampleBasic.spec.ts new file mode 100644 index 0000000000..8c6b831727 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/azureExampleBasic.spec.ts @@ -0,0 +1,37 @@ +import BasicClientFactory, { + BasicClient +} from "./generated/azure/example/basic/src/index.js"; +import { assert } from "chai"; +describe("Azure Example Basic Rest Client", () => { + let client: BasicClient; + + beforeEach(() => { + client = BasicClientFactory({ allowInsecureConnection: true }); + }); + + it("should support azure example client", async () => { + const result = await client + .path("/azure/example/basic/basic") + .post({ + queryParameters: { "query-param": "query" }, + body: { + stringProperty: "text", + modelProperty: { + int32Property: 1, + float32Property: 1.5, + enumProperty: "EnumValue1", + }, + arrayProperty: ["item"], + recordProperty: { + record: "value", + } + }, + headers: { + "header-param": "header", + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.stringProperty, "text"); + }); + +}); diff --git a/packages/typespec-ts/test/azureIntegration/azurePayloadPageable.spec.ts b/packages/typespec-ts/test/azureIntegration/azurePayloadPageable.spec.ts new file mode 100644 index 0000000000..d5ffdcb564 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/azurePayloadPageable.spec.ts @@ -0,0 +1,77 @@ +import { assert } from "chai"; +import PageableClientFactory, { + PageableClient, + UserOutput, + paginate +} from "./generated/azure/payload/pageable/src/index.js"; + +describe("Azure Pageable Client", () => { + let client: PageableClient; + + beforeEach(() => { + client = PageableClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get pagable list without skiptoken", async () => { + const result = await client + .path("/azure/payload/pageable") + .get({ queryParameters: { maxpagesize: 3 } }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value[0]?.name, "user5"); + assert.strictEqual(result.body.value[1]?.name, "user6"); + assert.strictEqual(result.body.value[2]?.name, "user7"); + assert.strictEqual( + result.body.nextLink, + "http://localhost:3000/azure/payload/pageable?skipToken=name-user7&maxpagesize=3" + ); + }); + + it("should get pagable list with skiptoken", async () => { + const result = await client + .path("/azure/payload/pageable") + .get({ queryParameters: { maxpagesize: 3, skipToken: "name-user7" } }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value[0]?.name, "user8"); + }); + + it("should get pagable list with wrong skiptoken", async () => { + const result = await client + .path("/azure/payload/pageable") + .get({ queryParameters: { maxpagesize: 3, skipToken: "wrong value" } }); + assert.strictEqual(result.status, "400"); + assert.strictEqual( + (result.body as any).message, + "Unsupported skipToken query parameter" + ); + assert.strictEqual( + (result.body as any).expected, + `Not provided for first page, "name-user7" for second page` + ); + assert.strictEqual((result.body as any).actual, "wrong value"); + }); + + it("should get pagable list", async () => { + const initialResponse = await client + .path("/azure/payload/pageable") + .get({ queryParameters: { maxpagesize: 3 } }); + + const iter = paginate(client, initialResponse); + + let result: UserOutput[] = []; + for await (const item of iter) { + result.push(item); + } + + assert.deepEqual(result, [ + { name: "user5" }, + { name: "user6" }, + { name: "user7" }, + { name: "user8" } + ]); + }); +}); \ No newline at end of file diff --git a/packages/typespec-ts/test/integration/azurecore.spec.ts b/packages/typespec-ts/test/azureIntegration/azurecore.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azurecore.spec.ts rename to packages/typespec-ts/test/azureIntegration/azurecore.spec.ts diff --git a/packages/typespec-ts/test/integration/azurecorescalar.spec.ts b/packages/typespec-ts/test/azureIntegration/azurecorescalar.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azurecorescalar.spec.ts rename to packages/typespec-ts/test/azureIntegration/azurecorescalar.spec.ts diff --git a/packages/typespec-ts/test/integration/azurecoretraits.spec.ts b/packages/typespec-ts/test/azureIntegration/azurecoretraits.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/azurecoretraits.spec.ts rename to packages/typespec-ts/test/azureIntegration/azurecoretraits.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/basicParameters.spec.ts b/packages/typespec-ts/test/azureIntegration/basicParameters.spec.ts new file mode 100644 index 0000000000..3e38501b73 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/basicParameters.spec.ts @@ -0,0 +1,33 @@ +import ParametersBasicClientFactory, { + BasicClient +} from "./generated/parameters/basic/src/index.js"; +import { assert } from "chai"; +describe("Basic Rest Client", () => { + let client: BasicClient; + + beforeEach(() => { + client = ParametersBasicClientFactory({ allowInsecureConnection: true }); + }); + + it("basic parameters explicit-body simple", async () => { + const result = await client + .path("/parameters/basic/explicit-body/simple") + .put({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("basic parameters implicit-body simple", async () => { + const result = await client + .path("/parameters/basic/implicit-body/simple") + .put({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/bodyParameters.spec.ts b/packages/typespec-ts/test/azureIntegration/bodyParameters.spec.ts new file mode 100644 index 0000000000..6b6f9503c8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/bodyParameters.spec.ts @@ -0,0 +1,51 @@ +import BodyOptionalityClientFactory, { + BodyOptionalityClient +} from "./generated/parameters/body-optionality/src/index.js"; +import { assert } from "chai"; +describe("BodyOptionalityClient Rest Client", () => { + let client: BodyOptionalityClient; + + beforeEach(() => { + client = BodyOptionalityClientFactory({ allowInsecureConnection: true }); + }); + + it("should support required-explicit body", async () => { + const result = await client + .path("/parameters/body-optionality/required-explicit") + .post({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should support optional-explicit body", async () => { + const result = await client + .path("/parameters/body-optionality/optional-explicit/set") + .post({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should support optional-explicit omitted body", async () => { + const result = await client + .path("/parameters/body-optionality/optional-explicit/omit") + .post(); + assert.strictEqual(result.status, "204"); + }); + + it("should support required-implicit body", async () => { + const result = await client + .path("/parameters/body-optionality/required-implicit") + .post({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/integration/clientNaming.spec.ts b/packages/typespec-ts/test/azureIntegration/clientNaming.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/clientNaming.spec.ts rename to packages/typespec-ts/test/azureIntegration/clientNaming.spec.ts diff --git a/packages/typespec-ts/test/integration/clientRequestIdHeader.spec.ts b/packages/typespec-ts/test/azureIntegration/clientRequestIdHeader.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/clientRequestIdHeader.spec.ts rename to packages/typespec-ts/test/azureIntegration/clientRequestIdHeader.spec.ts diff --git a/packages/typespec-ts/test/integration/clientStructure.spec.ts b/packages/typespec-ts/test/azureIntegration/clientStructure.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/clientStructure.spec.ts rename to packages/typespec-ts/test/azureIntegration/clientStructure.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/collectionFormat.spec.ts b/packages/typespec-ts/test/azureIntegration/collectionFormat.spec.ts new file mode 100644 index 0000000000..89838606f2 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/collectionFormat.spec.ts @@ -0,0 +1,125 @@ +import { assert } from "chai"; +import CollectionFormatClientFactory, { + buildCsvCollection, + buildMultiCollection, + CollectionFormatClient, +} from "./generated/parameters/collection-format/src/index.js"; +describe("Collection Format Rest Client", () => { + let client: CollectionFormatClient; + const colors = ["blue", "red", "green"]; + + beforeEach(() => { + client = CollectionFormatClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("[legacy]should serialize multi format query array parameter with buildMultiCollection helper", async () => { + const result = await client + .path("/parameters/collection-format/query/multi") + .get({ + queryParameters: { + colors: buildMultiCollection(colors, "colors") + }, + skipUrlEncoding: true + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize multi format query array parameter", async () => { + const result = await client + .path("/parameters/collection-format/query/multi") + .get({ + queryParameters: { + colors: { + value: colors, + explode: true, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize csv format query array parameter with array type", async () => { + const result = await client + .path("/parameters/collection-format/query/csv") + .get({ + queryParameters: { + colors + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize csv format query array parameter with wrapper types", async () => { + const result = await client + .path("/parameters/collection-format/query/csv") + .get({ + queryParameters: { + colors: { + value: colors, + explode: false, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize tsv format query array parameter", async () => { + const result = await client + .path("/parameters/collection-format/query/tsv") + .get({ + queryParameters: { + colors: colors.join("\t") + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize ssv format query array parameter", async () => { + const result = await client + .path("/parameters/collection-format/query/ssv") + .get({ + queryParameters: { + colors: { + value: colors, + explode: false, + style: "spaceDelimited" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize pipes format query array parameter", async () => { + const result = await client + .path("/parameters/collection-format/query/pipes") + .get({ + queryParameters: { + colors: { + value: colors, + explode: false, + style: "pipeDelimited" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should serialize csv format header array parameter", async () => { + const result = await client + .path("/parameters/collection-format/header/csv") + .get({ + headers: { + colors: buildCsvCollection(colors) + }, + skipUrlEncoding: true + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/dictionary.spec.ts b/packages/typespec-ts/test/azureIntegration/dictionary.spec.ts new file mode 100644 index 0000000000..9501f7bffa --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/dictionary.spec.ts @@ -0,0 +1,98 @@ +import { assert } from "chai"; +import { matrix } from "../util/matrix.js"; +import DictClientFactory, { + DictClient +} from "./generated/type/dictionary/src/index.js"; + +interface TypeDetail { + type: string; + defaultValue: any; + convertedToFn?: (_: any) => any; +} + +const testedTypes: TypeDetail[] = [ + { + type: "int32", + defaultValue: { k1: 1, k2: 2 } + }, + { + type: "int64", + defaultValue: { k1: Number.MAX_SAFE_INTEGER, k2: Number.MIN_SAFE_INTEGER } + }, + { + type: "boolean", + defaultValue: { k1: true, k2: false } + }, + { + type: "string", + defaultValue: { k1: "hello", k2: "" } + }, + { + type: "float32", + defaultValue: { k1: 43.125 } + }, + { + type: "datetime", + defaultValue: { k1: "2022-08-26T18:38:00Z" } + }, + { + type: "duration", + defaultValue: { k1: "P123DT22H14M12.011S" } + }, + { + type: "unknown", + defaultValue: { k1: 1, k2: "hello", k3: null } + }, + { + type: "model", + defaultValue: { k1: { property: "hello" }, k2: { property: "world" } } + }, + { + type: "model/recursive", + defaultValue: { + k1: { property: "hello", children: {} }, + k2: { + property: "world", + children: { "k2.1": { property: "inner world" } } + } + } + }, + { + type: "nullable-float", + defaultValue: { k1: 1.25, k2: 0.5, k3: null } + } +]; +describe("Dictionary Client", () => { + let client: DictClient; + + beforeEach(() => { + client = DictClientFactory({ + allowInsecureConnection: true + }); + }); + + matrix([testedTypes], async (params: TypeDetail) => { + it(`should get a ${params.type} value`, async () => { + const result = await client + .path(`/type/dictionary/${params.type}` as any) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, params.defaultValue); + }); + + it(`should put a ${params.type} value`, async () => { + let property; + if (params.convertedToFn) { + property = params.convertedToFn(params.defaultValue); + } else { + property = params.defaultValue; + } + const result = await client + .path(`/type/dictionary/${params.type}` as any) + .put({ + body: property + }); + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/emptyModel.spec.ts b/packages/typespec-ts/test/azureIntegration/emptyModel.spec.ts new file mode 100644 index 0000000000..d0b2c4ca62 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/emptyModel.spec.ts @@ -0,0 +1,37 @@ +import { assert } from "chai"; +import TypeModelEmptyClientFactory, { + EmptyClient +} from "./generated/type/model/empty/src/index.js"; +describe("TypeModelEmptyClient Rest Client", () => { + let client: EmptyClient; + + beforeEach(() => { + client = TypeModelEmptyClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it(`should put empty model`, async () => { + const result = await client.path("/type/model/empty/alone").put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get empty model`, async () => { + const result = await client.path("/type/model/empty/alone").get(); + assert.strictEqual(result.status, "200"); + assert.isEmpty(result.body); + }); + + it(`should post round-trip empty model`, async () => { + const result = await client.path("/type/model/empty/round-trip").post({ + body: {} + }); + assert.strictEqual(result.status, "200"); + assert.isEmpty(result.body); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/encodeBytes.spec.ts b/packages/typespec-ts/test/azureIntegration/encodeBytes.spec.ts new file mode 100644 index 0000000000..ef6634ee32 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/encodeBytes.spec.ts @@ -0,0 +1,248 @@ +import { assert } from "chai"; +import EncodeBytesClientFactory, { + BytesClient +} from "./generated/encode/bytes/src/index.js"; +import { buildCsvCollection } from "./generated/encode/bytes/src/serializeHelper.js"; +import { uint8ArrayToString } from "@azure/core-util"; +import { readFileSync } from "fs"; +import { resolve } from "path"; + +describe("EncodeDatetimeClient Rest Client", () => { + let client: BytesClient; + beforeEach(() => { + client = EncodeBytesClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("query", () => { + it(`should get bytes`, async () => { + const result = await client.path(`/encode/bytes/query/default`).get({ + queryParameters: { + value: "dGVzdA==" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get bytes base64 encoding`, async () => { + const result = await client.path(`/encode/bytes/query/base64`).get({ + queryParameters: { + value: "dGVzdA==" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get bytes base64url encoding`, async () => { + const result = await client.path(`/encode/bytes/query/base64url`).get({ + queryParameters: { + value: "dGVzdA" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get bytes base64url-array`, async () => { + const result = await client + .path(`/encode/bytes/query/base64url-array`) + .get({ + queryParameters: { + value: ["dGVzdA", "dGVzdA"] + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("property", () => { + it(`should post bytes`, async () => { + const result = await client + .path(`/encode/bytes/property/default`) + .post({ + body: { + value: "dGVzdA==" + } + }); + assert.strictEqual(result.status, "200"); + }); + + it(`should post bytes base64 encoding`, async () => { + const result = await client.path(`/encode/bytes/property/base64`).post({ + body: { + value: "dGVzdA==" + } + }); + assert.strictEqual(result.status, "200"); + }); + + it(`should post bytes base64url encoding`, async () => { + const result = await client + .path(`/encode/bytes/property/base64url`) + .post({ + body: { + value: "dGVzdA" + } + }); + assert.strictEqual(result.status, "200"); + }); + + it(`should post bytes base64url array`, async () => { + const result = await client + .path(`/encode/bytes/property/base64url-array`) + .post({ + body: { + value: ["dGVzdA", "dGVzdA"] + } + }); + assert.strictEqual(result.status, "200"); + }); + }); + + describe("header", () => { + it(`should get bytes`, async () => { + const result = await client.path(`/encode/bytes/header/default`).get({ + headers: { + value: "dGVzdA==" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get bytes base64 encoding`, async () => { + const result = await client.path(`/encode/bytes/header/base64`).get({ + headers: { + value: "dGVzdA==" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get bytes base64url encoding`, async () => { + const result = await client.path(`/encode/bytes/header/base64url`).get({ + headers: { + value: "dGVzdA" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get bytes base64url-array`, async () => { + const result = await client + .path(`/encode/bytes/header/base64url-array`) + .get({ + headers: { + value: buildCsvCollection(["dGVzdA", "dGVzdA"]) + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("request body", () => { + const pngFile = readFileSync( + resolve("../../packages/typespec-ts/temp/assets/image.png") + ); + it(`should post bytes`, async () => { + const result = await client + .path(`/encode/bytes/body/request/default`) + .post({ + contentType: "application/json", + body: "dGVzdA==" + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should post bytes base64 encoding`, async () => { + const result = await client + .path(`/encode/bytes/body/request/base64`) + .post({ + contentType: "application/json", + body: "dGVzdA==" + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should post bytes base64url encoding`, async () => { + const result = await client + .path(`/encode/bytes/body/request/base64url`) + .post({ + contentType: "application/json", + body: "dGVzdA" + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should post bytes with custom content type`, async () => { + const result = await client + .path(`/encode/bytes/body/request/custom-content-type`) + .post({ + contentType: "image/png", + body: pngFile + }); + assert.strictEqual(result.status, "204"); + }).timeout(10000); + + it(`should post bytes with custom content type`, async () => { + const result = await client + .path(`/encode/bytes/body/request/octet-stream`) + .post({ + contentType: "application/octet-stream", + body: pngFile + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("response body", () => { + const pngFile = readFileSync( + resolve("../../packages/typespec-ts/temp/assets/image.png") + ).toString(); + it(`should get bytes with base64 encoding by default`, async () => { + const result = await client + .path(`/encode/bytes/body/response/default`) + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "dGVzdA=="); + }); + + it(`should get bytes base64 encoding`, async () => { + const result = await client + .path(`/encode/bytes/body/response/base64`) + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "dGVzdA=="); + }); + + it(`should get bytes base64url encoding`, async () => { + const result = await client + .path(`/encode/bytes/body/response/base64url`) + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "dGVzdA"); + }); + + it(`should get bytes with custom content type`, async () => { + const result = await client + .path(`/encode/bytes/body/response/custom-content-type`) + .get({ + contentType: "image/png" + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(uint8ArrayToString(result.body, "utf-8"), pngFile); + }); + + it(`should get bytes with octet-stream content type`, async () => { + const result = await client + .path(`/encode/bytes/body/response/octet-stream`) + .get({ + contentType: "application/octet-stream" + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(uint8ArrayToString(result.body, "utf-8"), pngFile); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/encodeDatetime.spec.ts b/packages/typespec-ts/test/azureIntegration/encodeDatetime.spec.ts new file mode 100644 index 0000000000..7d0106102c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/encodeDatetime.spec.ts @@ -0,0 +1,228 @@ +import { assert } from "chai"; +import EncodeDatetimeClientFactory, { + DatetimeClient +} from "./generated/encode/datetime/src/index.js"; +import { buildCsvCollection } from "./generated/encode/datetime/src/serializeHelper.js"; +describe("EncodeDatetimeClient Rest Client", () => { + let client: DatetimeClient; + + beforeEach(() => { + client = EncodeDatetimeClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("query", () => { + it(`should get default query`, async () => { + const result = await client.path(`/encode/datetime/query/default`).get({ + queryParameters: { + value: "2022-08-26T18:38:00.000Z" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get rfc3339 query`, async () => { + const result = await client.path(`/encode/datetime/query/rfc3339`).get({ + queryParameters: { + value: "2022-08-26T18:38:00.000Z" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get rfc7231 query`, async () => { + const result = await client.path(`/encode/datetime/query/rfc7231`).get({ + queryParameters: { + value: "Fri, 26 Aug 2022 14:38:00 GMT" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get unix-timestamp query`, async () => { + const result = await client + .path(`/encode/datetime/query/unix-timestamp`) + .get({ + queryParameters: { + value: 1686566864 + }, + skipUrlEncoding: true + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get unix-timestamp-array query`, async () => { + const result = await client + .path(`/encode/datetime/query/unix-timestamp-array`) + .get({ + queryParameters: { + value: [1686566864, 1686734256] + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("property", () => { + it(`should post default property`, async () => { + const result = await client + .path(`/encode/datetime/property/default`) + .post({ + body: { + value: "2022-08-26T18:38:00.000Z" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "2022-08-26T18:38:00.000Z"); + }); + + it(`should post rfc3339 property`, async () => { + const result = await client + .path(`/encode/datetime/property/rfc3339`) + .post({ + body: { + value: "2022-08-26T18:38:00.000Z" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "2022-08-26T18:38:00.000Z"); + }); + + it(`should post rfc7231 property`, async () => { + const result = await client + .path(`/encode/datetime/property/rfc7231`) + .post({ + body: { + value: "Fri, 26 Aug 2022 14:38:00 GMT" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "Fri, 26 Aug 2022 14:38:00 GMT"); + }); + + it(`should post unix-timestamp property`, async () => { + const result = await client + .path(`/encode/datetime/property/unix-timestamp`) + .post({ + body: { + value: 1686566864 + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, 1686566864); + }); + + it(`should post unix-timestamp-array property`, async () => { + const result = await client + .path(`/encode/datetime/property/unix-timestamp-array`) + .post({ + body: { + value: [1686566864, 1686734256] + } + }); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body.value, [1686566864, 1686734256]); + }); + }); + + describe("header", () => { + it(`should get default header`, async () => { + const result = await client + .path(`/encode/datetime/header/default`) + .get({ + headers: { + value: "Fri, 26 Aug 2022 14:38:00 GMT" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get rfc3339 header`, async () => { + const result = await client + .path(`/encode/datetime/header/rfc3339`) + .get({ + headers: { + value: "2022-08-26T18:38:00.000Z" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get rfc7231 header`, async () => { + const result = await client + .path(`/encode/datetime/header/rfc7231`) + .get({ + headers: { + value: "Fri, 26 Aug 2022 14:38:00 GMT" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get unix-timestamp header`, async () => { + const result = await client + .path(`/encode/datetime/header/unix-timestamp`) + .get({ + headers: { + value: 1686566864 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get unix-timestamp-array header`, async () => { + const result = await client + .path(`/encode/datetime/header/unix-timestamp-array`) + .get({ + headers: { + value: buildCsvCollection([1686566864, 1686734256]) + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("response header", () => { + it(`should get default header`, async () => { + const result = await client + .path(`/encode/datetime/responseheader/default`) + .get(); + assert.strictEqual(result.status, "204"); + assert.strictEqual( + result.headers.value, + "Fri, 26 Aug 2022 14:38:00 GMT" + ); + }); + + it(`should get rfc3339 header`, async () => { + const result = await client + .path(`/encode/datetime/responseheader/rfc3339`) + .get(); + assert.strictEqual(result.status, "204"); + assert.strictEqual(result.headers.value, "2022-08-26T18:38:00.000Z"); + }); + + it(`should get rfc7231 header`, async () => { + const result = await client + .path(`/encode/datetime/responseheader/rfc7231`) + .get(); + assert.strictEqual(result.status, "204"); + assert.strictEqual( + result.headers.value, + "Fri, 26 Aug 2022 14:38:00 GMT" + ); + }); + + it(`should get unix-timestamp header`, async () => { + const result = await client + .path(`/encode/datetime/responseheader/unix-timestamp`) + .get(); + assert.strictEqual(result.status, "204"); + assert.strictEqual(result.headers.value, "1686566864"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/encodeDuration.spec.ts b/packages/typespec-ts/test/azureIntegration/encodeDuration.spec.ts new file mode 100644 index 0000000000..c63b672682 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/encodeDuration.spec.ts @@ -0,0 +1,224 @@ +import { assert } from "chai"; +import EncodeDurationClientFactory, { + DurationClient +} from "./generated/encode/duration/src/index.js"; +import { buildCsvCollection } from "./generated/encode/duration/src/serializeHelper.js"; +describe("EncodeDurationClient Rest Client", () => { + let client: DurationClient; + + beforeEach(() => { + client = EncodeDurationClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("property", () => { + it(`should post default property`, async () => { + const result = await client + .path(`/encode/duration/property/default`) + .post({ + body: { + value: "P40D" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "P40D"); + }); + + it(`should post float-seconds property`, async () => { + const result = await client + .path(`/encode/duration/property/float-seconds`) + .post({ + body: { + value: 35.625 + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, 35.625); + }); + + it(`should post float64-seconds property`, async () => { + const result = await client + .path(`/encode/duration/property/float64-seconds`) + .post({ + body: { + value: 35.625 + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, 35.625); + }); + + it(`should post int32-seconds property`, async () => { + const result = await client + .path(`/encode/duration/property/int32-seconds`) + .post({ + body: { + value: 36 + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, 36); + }); + + it(`should post iso8601 property`, async () => { + const result = await client + .path(`/encode/duration/property/iso8601`) + .post({ + body: { + value: "P40D" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "P40D"); + }); + + it(`should post float-seconds-array property`, async () => { + const result = await client + .path(`/encode/duration/property/float-seconds-array`) + .post({ + body: { + value: [35.625, 46.75] + } + }); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body.value, [35.625, 46.75]); + }); + }); + + describe("query", () => { + it(`should get default query`, async () => { + const result = await client.path(`/encode/duration/query/default`).get({ + queryParameters: { + input: "P40D" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get iso8601 query`, async () => { + const result = await client.path(`/encode/duration/query/iso8601`).get({ + queryParameters: { + input: "P40D" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get int32-seconds query`, async () => { + const result = await client + .path(`/encode/duration/query/int32-seconds`) + .get({ + queryParameters: { + input: 36 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get int32-seconds-array query`, async () => { + const result = await client + .path(`/encode/duration/query/int32-seconds-array`) + .get({ + queryParameters: { + input: [36, 47] + }, + skipUrlEncoding: true + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get float-seconds query`, async () => { + const result = await client + .path(`/encode/duration/query/float-seconds`) + .get({ + queryParameters: { + input: 35.625 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get float64-seconds query`, async () => { + const result = await client + .path(`/encode/duration/query/float64-seconds`) + .get({ + queryParameters: { + input: 35.625 + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("header", () => { + it(`should get default header`, async () => { + const result = await client + .path(`/encode/duration/header/default`) + .get({ + headers: { + duration: "P40D" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get iso8601 header`, async () => { + const result = await client + .path(`/encode/duration/header/iso8601`) + .get({ + headers: { + duration: "P40D" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get iso8601-array header`, async () => { + const result = await client + .path(`/encode/duration/header/iso8601-array`) + .get({ + headers: { + duration: buildCsvCollection(["P40D", "P50D"]) + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get int32-seconds header`, async () => { + const result = await client + .path(`/encode/duration/header/int32-seconds`) + .get({ + headers: { + duration: 36 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get float-seconds header`, async () => { + const result = await client + .path(`/encode/duration/header/float-seconds`) + .get({ + headers: { + duration: 35.625 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should get float64-seconds header`, async () => { + const result = await client + .path(`/encode/duration/header/float64-seconds`) + .get({ + headers: { + duration: 35.625 + } + }); + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/encodeNumeric.spec.ts b/packages/typespec-ts/test/azureIntegration/encodeNumeric.spec.ts new file mode 100644 index 0000000000..ee5b7baf63 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/encodeNumeric.spec.ts @@ -0,0 +1,47 @@ +import { assert } from "chai"; +import EncodeNumericClientFactory, { + NumericClient +} from "./generated/encode/numeric/src/index.js"; +describe("EncodeNumericClient Rest Client", () => { + let client: NumericClient; + + beforeEach(() => { + client = EncodeNumericClientFactory({ + allowInsecureConnection: true + }); + }); + + describe("property", () => { + it(`should post safeint property`, async () => { + const result = await client + .path(`/encode/numeric/property/safeint`) + .post({ + body: { + value: "10000000000" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "10000000000"); + }); + + it(`should post uint32 property`, async () => { + const result = await client.path(`/encode/numeric/property/uint32`).post({ + body: { + value: "1" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "1"); + }); + + it(`should post uint8 property`, async () => { + const result = await client.path(`/encode/numeric/property/uint8`).post({ + body: { + value: "255" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.value, "255"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/extensibleEnums.spec.ts b/packages/typespec-ts/test/azureIntegration/extensibleEnums.spec.ts new file mode 100644 index 0000000000..420dcc462a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/extensibleEnums.spec.ts @@ -0,0 +1,51 @@ +import TypeEnumExtensibleClientFactory, { + ExtensibleClient +} from "./generated/type/enum/extensible/src/index.js"; +import { assert } from "chai"; +describe("ExtensibleEnums Rest Client", () => { + let client: ExtensibleClient; + + beforeEach(() => { + client = TypeEnumExtensibleClientFactory({ allowInsecureConnection: true }); + }); + + it("should get known value", async () => { + const result = await client + .path("/type/enum/extensible/string/known-value") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "Monday"); + }); + + it("should put known value", async () => { + const result = await client + .path("/type/enum/extensible/string/known-value") + .put({ + body: "Monday", + headers: { + "content-type": "text/plain" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get unknown value", async () => { + const result = await client + .path("/type/enum/extensible/string/unknown-value") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "Weekend"); + }); + + it("should put unknown value", async () => { + const result = await client + .path("/type/enum/extensible/string/unknown-value") + .put({ + body: "Weekend", + headers: { + "content-type": "text/plain" + } + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/fixedEnums.spec.ts b/packages/typespec-ts/test/azureIntegration/fixedEnums.spec.ts new file mode 100644 index 0000000000..4acec614e7 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/fixedEnums.spec.ts @@ -0,0 +1,44 @@ +import { assert } from "chai"; +import TypeEnumFixedClientFactory, { + FixedClient +} from "./generated/type/enum/fixed/src/index.js"; +describe("FixedEnums Rest Client", () => { + let client: FixedClient; + + beforeEach(() => { + client = TypeEnumFixedClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get known value", async () => { + const result = await client + .path("/type/enum/fixed/string/known-value") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "Monday"); + }); + + it("should put known value", async () => { + const result = await client + .path("/type/enum/fixed/string/known-value") + .put({ + body: "Monday", + contentType: "application/json" + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put unknown value and receives 500", async () => { + const result = await client + .path("/type/enum/fixed/string/unknown-value") + .put({ + body: "Weekend" as any, + contentType: "application/json" + }); + assert.strictEqual(result.status, "500"); + }); +}); diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/src/index.d.ts new file mode 100644 index 0000000000..5fc0b799e1 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/src/index.d.ts @@ -0,0 +1,52 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare type AuthApiKeyClient = Client & { + path: Routes; +}; + +export declare interface AuthApiKeyClientOptions extends ClientOptions { +} + +declare function createClient(credentials: KeyCredential, options?: AuthApiKeyClientOptions): AuthApiKeyClient; +export default createClient; + +export declare interface Invalid { + get(options?: InvalidParameters): StreamableMethod; +} + +export declare interface Invalid204Response extends HttpResponse { + status: "204"; +} + +export declare interface Invalid403Response extends HttpResponse { + status: "403"; + body: InvalidAuthOutput; +} + +export declare interface InvalidAuthOutput { + error: string; +} + +export declare type InvalidParameters = RequestParameters; + +export declare interface Routes { + (path: "/authentication/api-key/valid"): Valid; + (path: "/authentication/api-key/invalid"): Invalid; +} + +export declare interface Valid { + get(options?: ValidParameters): StreamableMethod; +} + +export declare interface Valid204Response extends HttpResponse { + status: "204"; +} + +export declare type ValidParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/tspconfig.yaml new file mode 100644 index 0000000000..751998e03c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/api-key/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: AuthApiKeyClient + packageDetails: + name: "@msinternal/auth-apikey" + description: "Auth api key Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/src/index.d.ts new file mode 100644 index 0000000000..27928f70d8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/src/index.d.ts @@ -0,0 +1,52 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare type AuthHttpCustomClient = Client & { + path: Routes; +}; + +export declare interface AuthHttpCustomClientOptions extends ClientOptions { +} + +declare function createClient(credentials: KeyCredential, options?: AuthHttpCustomClientOptions): AuthHttpCustomClient; +export default createClient; + +export declare interface Invalid { + get(options?: InvalidParameters): StreamableMethod; +} + +export declare interface Invalid204Response extends HttpResponse { + status: "204"; +} + +export declare interface Invalid403Response extends HttpResponse { + status: "403"; + body: InvalidAuthOutput; +} + +export declare interface InvalidAuthOutput { + error: string; +} + +export declare type InvalidParameters = RequestParameters; + +export declare interface Routes { + (path: "/authentication/http/custom/valid"): Valid; + (path: "/authentication/http/custom/invalid"): Invalid; +} + +export declare interface Valid { + get(options?: ValidParameters): StreamableMethod; +} + +export declare interface Valid204Response extends HttpResponse { + status: "204"; +} + +export declare type ValidParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/tspconfig.yaml new file mode 100644 index 0000000000..9c9ac79eb8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/http/custom/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: AuthHttpCustomClient + packageDetails: + name: "@msinternal/auth-httpcustom" + description: "Auth Http Custom Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/src/index.d.ts new file mode 100644 index 0000000000..1fd63f991c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/src/index.d.ts @@ -0,0 +1,52 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +export declare type AuthOauth2Client = Client & { + path: Routes; +}; + +export declare interface AuthOauth2ClientOptions extends ClientOptions { +} + +declare function createClient(credentials: TokenCredential, options?: AuthOauth2ClientOptions): AuthOauth2Client; +export default createClient; + +export declare interface Invalid { + get(options?: InvalidParameters): StreamableMethod; +} + +export declare interface Invalid204Response extends HttpResponse { + status: "204"; +} + +export declare interface Invalid403Response extends HttpResponse { + status: "403"; + body: InvalidAuthOutput; +} + +export declare interface InvalidAuthOutput { + error: string; +} + +export declare type InvalidParameters = RequestParameters; + +export declare interface Routes { + (path: "/authentication/oauth2/valid"): Valid; + (path: "/authentication/oauth2/invalid"): Invalid; +} + +export declare interface Valid { + get(options?: ValidParameters): StreamableMethod; +} + +export declare interface Valid204Response extends HttpResponse { + status: "204"; +} + +export declare type ValidParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/tspconfig.yaml new file mode 100644 index 0000000000..31deae6f5a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/oauth2/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: true + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: AuthOauth2Client + packageDetails: + name: "@msinternal/auth-oauth2" + description: "Auth oauth2 Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/azure/core/basic/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/authentication/union/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/basic/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/authentication/union/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/union/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/authentication/union/src/index.d.ts new file mode 100644 index 0000000000..3164bcc0dd --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/union/src/index.d.ts @@ -0,0 +1,44 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { KeyCredential } from '@azure/core-auth'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +export declare type AuthUnionClient = Client & { + path: Routes; +}; + +export declare interface AuthUnionClientOptions extends ClientOptions { +} + +declare function createClient(credentials: TokenCredential | KeyCredential, options?: AuthUnionClientOptions): AuthUnionClient; +export default createClient; + +export declare interface Routes { + (path: "/authentication/union/validkey"): ValidKey; + (path: "/authentication/union/validtoken"): ValidToken; +} + +export declare interface ValidKey { + get(options?: ValidKeyParameters): StreamableMethod; +} + +export declare interface ValidKey204Response extends HttpResponse { + status: "204"; +} + +export declare type ValidKeyParameters = RequestParameters; + +export declare interface ValidToken { + get(options?: ValidTokenParameters): StreamableMethod; +} + +export declare interface ValidToken204Response extends HttpResponse { + status: "204"; +} + +export declare type ValidTokenParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/authentication/union/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/authentication/union/tspconfig.yaml new file mode 100644 index 0000000000..3181f34237 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/authentication/union/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: true + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: AuthUnionClient + packageDetails: + name: "@msinternal/auth-union" + description: "Auth Union Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/tspconfig.yaml index 9cbeea5f1f..f43f02c3c8 100644 --- a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/access/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/access/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true generateSample: true diff --git a/packages/typespec-ts/test/integration/generated/azure/core/lro/standard/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/lro/standard/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml index 2d2860a34b..ef941f17f3 100644 --- a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/azure/core/model/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/model/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml index f84b3a7d6f..ed69b3b406 100644 --- a/packages/typespec-ts/test/integration/generated/azure/client-generator-core/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true generateSample: true diff --git a/packages/typespec-ts/test/integration/generated/azure/core/page/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/page/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/basic/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/basic/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/basic/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/basic/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/tspconfig.yaml index 0d228a6a7a..d5089fe780 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/basic/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true generateSample: true diff --git a/packages/typespec-ts/test/integration/generated/azure/core/scalar/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/scalar/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/tspconfig.yaml index 9f331c854b..822fa13344 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/lro/rpc/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/rpc/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/azure/core/traits/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/traits/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/lro/standard/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/lro/standard/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/lro/standard/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/lro/standard/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/tspconfig.yaml index ca632f1612..6e179e9786 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/lro/standard/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/lro/standard/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/model/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/model/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/model/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/model/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/model/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/model/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/model/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/model/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/model/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/model/tspconfig.yaml index c1a4d4d022..4a17707985 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/model/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/model/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: AzureCoreModelClient diff --git a/packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/page/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/page/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/page/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/page/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/page/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/page/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/page/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/page/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/page/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/page/tspconfig.yaml index 4b299adbaa..cd1b461cdb 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/page/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/page/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: AzureCorePageClient diff --git a/packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/scalar/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/scalar/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/scalar/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/scalar/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/tspconfig.yaml index 50f2617fd2..5eb4368fb1 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/scalar/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/scalar/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: AzureCoreScalarClient diff --git a/packages/typespec-ts/test/integration/generated/client/naming/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/naming/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/core/traits/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/core/traits/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/azure/core/traits/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/tspconfig.yaml index 8e7844a64e..dbd625d753 100644 --- a/packages/typespec-ts/test/integration/generated/azure/core/traits/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/core/traits/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: AzureCoreTraitsClient diff --git a/packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/src/index.d.ts new file mode 100644 index 0000000000..230ccde52e --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/src/index.d.ts @@ -0,0 +1,84 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface ActionRequest { + stringProperty: string; + modelProperty?: Model; + arrayProperty?: string[]; + recordProperty?: Record; +} + +export declare interface ActionResponseOutput { + stringProperty: string; + modelProperty?: ModelOutput; + arrayProperty?: string[]; + recordProperty?: Record; +} + +export declare interface Basic { + post(options: ServiceOperationGroupBasicParameters): StreamableMethod; +} + +export declare type BasicClient = Client & { + path: Routes; +}; + +export declare interface BasicClientOptions extends ClientOptions { + apiVersion?: string; +} + +declare function createClient({ apiVersion, ...options }?: BasicClientOptions): BasicClient; +export default createClient; + +export declare type Enum = string; + +export declare type EnumOutput = string; + +export declare interface Model { + int32Property?: number; + float32Property?: number; + enumProperty?: Enum; +} + +export declare interface ModelOutput { + int32Property?: number; + float32Property?: number; + enumProperty?: EnumOutput; +} + +export declare interface Routes { + (path: "/azure/example/basic/basic"): Basic; +} + +export declare interface ServiceOperationGroupBasic200Response extends HttpResponse { + status: "200"; + body: ActionResponseOutput; +} + +export declare interface ServiceOperationGroupBasicBodyParam { + body: ActionRequest; +} + +export declare interface ServiceOperationGroupBasicHeaderParam { + headers: RawHttpHeadersInput & ServiceOperationGroupBasicHeaders; +} + +export declare interface ServiceOperationGroupBasicHeaders { + "header-param": string; +} + +export declare type ServiceOperationGroupBasicParameters = ServiceOperationGroupBasicQueryParam & ServiceOperationGroupBasicHeaderParam & ServiceOperationGroupBasicBodyParam & RequestParameters; + +export declare interface ServiceOperationGroupBasicQueryParam { + queryParameters: ServiceOperationGroupBasicQueryParamProperties; +} + +export declare interface ServiceOperationGroupBasicQueryParamProperties { + "query-param": string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/tspconfig.yaml new file mode 100644 index 0000000000..458c140d3d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/example/basic/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + isModularLibrary: false + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/azure-example-basic" diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/default/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/payload/pageable/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/src/index.d.ts similarity index 98% rename from packages/typespec-ts/test/integration/generated/payload/pageable/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/src/index.d.ts index 6cb6c099e9..d55b8d5472 100644 --- a/packages/typespec-ts/test/integration/generated/payload/pageable/src/index.d.ts +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/src/index.d.ts @@ -69,7 +69,7 @@ export declare interface PagingOptions { } export declare interface Routes { - (path: "/payload/pageable"): List; + (path: "/azure/payload/pageable"): List; } export declare interface UserOutput { diff --git a/packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/tspconfig.yaml new file mode 100644 index 0000000000..2d95aabd88 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/payload/pageable/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + isModularLibrary: false + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/azure-payload-pageable" diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/multi-client/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml index 6c006cde96..d1f467a6b4 100644 --- a/packages/typespec-ts/test/integration/generated/azure/resource-manager/common-properties/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true generateSample: true diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/tspconfig.yaml index 447a88d697..b4f8203826 100644 --- a/packages/typespec-ts/test/integration/generated/azure/resource-manager/resources/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/resource-manager/resources/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true generateSample: true diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml index 40ed5f9700..fe9698ae54 100644 --- a/packages/typespec-ts/test/integration/generated/azure/special-headers/client-request-id/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/media-types/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/client/naming/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/media-types/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/client/naming/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/client/naming/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/client/naming/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/naming/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/client/naming/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/client/naming/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/client/naming/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/client/naming/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/client/naming/tspconfig.yaml index 1bc54da741..4f504f1c40 100644 --- a/packages/typespec-ts/test/integration/generated/client/naming/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/client/naming/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/overload/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/overload/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/tspconfig.yaml index 2f30e37fb3..7162d15e3a 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/client-operation-group/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/client/structure/client-operation-group/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/payload/pageable/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/client/structure/default/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/payload/pageable/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/default/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/client/structure/default/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/default/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/default/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/client/structure/default/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/client/structure/default/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/client/structure/default/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/default/tspconfig.yaml index 8b53464f69..dc5bd2834d 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/default/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/client/structure/default/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/multi-client/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/client/structure/multi-client/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/tspconfig.yaml index c30b1c5841..eebc9d40ee 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/multi-client/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/client/structure/multi-client/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/tspconfig.yaml index 0920e0377a..32cd7bafe0 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/renamed-operation/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/client/structure/renamed-operation/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/type/property/additional-properties/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/tspconfig.yaml index 25aaddf2c8..db69752f4e 100644 --- a/packages/typespec-ts/test/integration/generated/client/structure/two-operation-group/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/client/structure/two-operation-group/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/integration/generated/versioning/removed/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/.gitignore similarity index 100% rename from packages/typespec-ts/test/integration/generated/versioning/removed/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/encode/bytes/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/src/index.d.ts new file mode 100644 index 0000000000..819afe802c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/src/index.d.ts @@ -0,0 +1,431 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface Base64BytesProperty { + value: string; +} + +export declare interface Base64BytesPropertyOutput { + value: string; +} + +export declare interface Base64urlArrayBytesProperty { + value: string[]; +} + +export declare interface Base64urlArrayBytesPropertyOutput { + value: string[]; +} + +export declare interface Base64urlBytesProperty { + value: string; +} + +export declare interface Base64urlBytesPropertyOutput { + value: string; +} + +export declare function buildCsvCollection(items: string[] | number[]): string; + +export declare type BytesClient = Client & { + path: Routes; +}; + +export declare interface BytesClientOptions extends ClientOptions { +} + +declare function createClient(options?: BytesClientOptions): BytesClient; +export default createClient; + +export declare interface DefaultBytesProperty { + value: string; +} + +export declare interface DefaultBytesPropertyOutput { + value: string; +} + +export declare interface HeaderBase64 { + get(options: HeaderBase64Parameters): StreamableMethod; +} + +export declare interface HeaderBase64204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderBase64HeaderParam { + headers: RawHttpHeadersInput & HeaderBase64Headers; +} + +export declare interface HeaderBase64Headers { + value: string; +} + +export declare type HeaderBase64Parameters = HeaderBase64HeaderParam & RequestParameters; + +export declare interface HeaderBase64url { + get(options: HeaderBase64urlParameters): StreamableMethod; +} + +export declare interface HeaderBase64url204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderBase64urlArray { + get(options: HeaderBase64urlArrayParameters): StreamableMethod; +} + +export declare interface HeaderBase64urlArray204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderBase64urlArrayHeaderParam { + headers: RawHttpHeadersInput & HeaderBase64urlArrayHeaders; +} + +export declare interface HeaderBase64urlArrayHeaders { + value: string; +} + +export declare type HeaderBase64urlArrayParameters = HeaderBase64urlArrayHeaderParam & RequestParameters; + +export declare interface HeaderBase64urlHeaderParam { + headers: RawHttpHeadersInput & HeaderBase64urlHeaders; +} + +export declare interface HeaderBase64urlHeaders { + value: string; +} + +export declare type HeaderBase64urlParameters = HeaderBase64urlHeaderParam & RequestParameters; + +export declare interface HeaderDefault { + get(options: HeaderDefaultParameters): StreamableMethod; +} + +export declare interface HeaderDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderDefaultHeaderParam { + headers: RawHttpHeadersInput & HeaderDefaultHeaders; +} + +export declare interface HeaderDefaultHeaders { + value: string; +} + +export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; + +export declare interface PropertyBase64 { + post(options: PropertyBase64Parameters): StreamableMethod; +} + +export declare interface PropertyBase64200Response extends HttpResponse { + status: "200"; + body: Base64BytesPropertyOutput; +} + +export declare interface PropertyBase64BodyParam { + body: Base64BytesProperty; +} + +export declare type PropertyBase64Parameters = PropertyBase64BodyParam & RequestParameters; + +export declare interface PropertyBase64url { + post(options: PropertyBase64urlParameters): StreamableMethod; +} + +export declare interface PropertyBase64url200Response extends HttpResponse { + status: "200"; + body: Base64urlBytesPropertyOutput; +} + +export declare interface PropertyBase64urlArray { + post(options: PropertyBase64urlArrayParameters): StreamableMethod; +} + +export declare interface PropertyBase64urlArray200Response extends HttpResponse { + status: "200"; + body: Base64urlArrayBytesPropertyOutput; +} + +export declare interface PropertyBase64urlArrayBodyParam { + body: Base64urlArrayBytesProperty; +} + +export declare type PropertyBase64urlArrayParameters = PropertyBase64urlArrayBodyParam & RequestParameters; + +export declare interface PropertyBase64urlBodyParam { + body: Base64urlBytesProperty; +} + +export declare type PropertyBase64urlParameters = PropertyBase64urlBodyParam & RequestParameters; + +export declare interface PropertyDefault { + post(options: PropertyDefaultParameters): StreamableMethod; +} + +export declare interface PropertyDefault200Response extends HttpResponse { + status: "200"; + body: DefaultBytesPropertyOutput; +} + +export declare interface PropertyDefaultBodyParam { + body: DefaultBytesProperty; +} + +export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; + +export declare interface QueryBase64 { + get(options: QueryBase64Parameters): StreamableMethod; +} + +export declare interface QueryBase64204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryBase64Parameters = QueryBase64QueryParam & RequestParameters; + +export declare interface QueryBase64QueryParam { + queryParameters: QueryBase64QueryParamProperties; +} + +export declare interface QueryBase64QueryParamProperties { + value: string; +} + +export declare interface QueryBase64url { + get(options: QueryBase64urlParameters): StreamableMethod; +} + +export declare interface QueryBase64url204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryBase64urlArray { + get(options: QueryBase64urlArrayParameters): StreamableMethod; +} + +export declare interface QueryBase64urlArray204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryBase64urlArrayParameters = QueryBase64urlArrayQueryParam & RequestParameters; + +export declare interface QueryBase64urlArrayQueryParam { + queryParameters: QueryBase64urlArrayQueryParamProperties; +} + +export declare interface QueryBase64urlArrayQueryParamProperties { + value: string[] | QueryBase64urlArrayValueQueryParam; +} + +export declare interface QueryBase64urlArrayValueQueryParam { + value: string[]; + explode: false; + style: "form"; +} + +export declare type QueryBase64urlParameters = QueryBase64urlQueryParam & RequestParameters; + +export declare interface QueryBase64urlQueryParam { + queryParameters: QueryBase64urlQueryParamProperties; +} + +export declare interface QueryBase64urlQueryParamProperties { + value: string; +} + +export declare interface QueryDefault { + get(options: QueryDefaultParameters): StreamableMethod; +} + +export declare interface QueryDefault204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryDefaultParameters = QueryDefaultQueryParam & RequestParameters; + +export declare interface QueryDefaultQueryParam { + queryParameters: QueryDefaultQueryParamProperties; +} + +export declare interface QueryDefaultQueryParamProperties { + value: string; +} + +export declare interface RequestBodyBase64 { + post(options: RequestBodyBase64Parameters): StreamableMethod; +} + +export declare interface RequestBodyBase64204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequestBodyBase64BodyParam { + body: string; +} + +export declare type RequestBodyBase64Parameters = RequestBodyBase64BodyParam & RequestParameters; + +export declare interface RequestBodyBase64url { + post(options: RequestBodyBase64urlParameters): StreamableMethod; +} + +export declare interface RequestBodyBase64url204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequestBodyBase64urlBodyParam { + body: string; +} + +export declare type RequestBodyBase64urlParameters = RequestBodyBase64urlBodyParam & RequestParameters; + +export declare interface RequestBodyCustomContentType { + post(options: RequestBodyCustomContentTypeParameters): StreamableMethod; +} + +export declare interface RequestBodyCustomContentType204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequestBodyCustomContentTypeBodyParam { + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; +} + +export declare interface RequestBodyCustomContentTypeMediaTypesParam { + contentType: "image/png"; +} + +export declare type RequestBodyCustomContentTypeParameters = RequestBodyCustomContentTypeMediaTypesParam & RequestBodyCustomContentTypeBodyParam & RequestParameters; + +export declare interface RequestBodyDefault { + post(options: RequestBodyDefaultParameters): StreamableMethod; +} + +export declare interface RequestBodyDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequestBodyDefaultBodyParam { + body: string; +} + +export declare type RequestBodyDefaultParameters = RequestBodyDefaultBodyParam & RequestParameters; + +export declare interface RequestBodyOctetStream { + post(options: RequestBodyOctetStreamParameters): StreamableMethod; +} + +export declare interface RequestBodyOctetStream204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequestBodyOctetStreamBodyParam { + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream; +} + +export declare interface RequestBodyOctetStreamMediaTypesParam { + contentType: "application/octet-stream"; +} + +export declare type RequestBodyOctetStreamParameters = RequestBodyOctetStreamMediaTypesParam & RequestBodyOctetStreamBodyParam & RequestParameters; + +export declare interface ResponseBodyBase64 { + get(options?: ResponseBodyBase64Parameters): StreamableMethod; +} + +export declare interface ResponseBodyBase64200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare type ResponseBodyBase64Parameters = RequestParameters; + +export declare interface ResponseBodyBase64url { + get(options?: ResponseBodyBase64urlParameters): StreamableMethod; +} + +export declare interface ResponseBodyBase64url200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare type ResponseBodyBase64urlParameters = RequestParameters; + +export declare interface ResponseBodyCustomContentType { + get(options?: ResponseBodyCustomContentTypeParameters): StreamableMethod; +} + +export declare interface ResponseBodyCustomContentType200Headers { + "content-type": "image/png"; +} + +export declare interface ResponseBodyCustomContentType200Response extends HttpResponse { + status: "200"; + body: Uint8Array; + headers: RawHttpHeaders & ResponseBodyCustomContentType200Headers; +} + +export declare type ResponseBodyCustomContentTypeParameters = RequestParameters; + +export declare interface ResponseBodyDefault { + get(options?: ResponseBodyDefaultParameters): StreamableMethod; +} + +export declare interface ResponseBodyDefault200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare type ResponseBodyDefaultParameters = RequestParameters; + +export declare interface ResponseBodyOctetStream { + get(options?: ResponseBodyOctetStreamParameters): StreamableMethod; +} + +export declare interface ResponseBodyOctetStream200Headers { + "content-type": "application/octet-stream"; +} + +export declare interface ResponseBodyOctetStream200Response extends HttpResponse { + status: "200"; + body: Uint8Array; + headers: RawHttpHeaders & ResponseBodyOctetStream200Headers; +} + +export declare type ResponseBodyOctetStreamParameters = RequestParameters; + +export declare interface Routes { + (path: "/encode/bytes/query/default"): QueryDefault; + (path: "/encode/bytes/query/base64"): QueryBase64; + (path: "/encode/bytes/query/base64url"): QueryBase64url; + (path: "/encode/bytes/query/base64url-array"): QueryBase64urlArray; + (path: "/encode/bytes/property/default"): PropertyDefault; + (path: "/encode/bytes/property/base64"): PropertyBase64; + (path: "/encode/bytes/property/base64url"): PropertyBase64url; + (path: "/encode/bytes/property/base64url-array"): PropertyBase64urlArray; + (path: "/encode/bytes/header/default"): HeaderDefault; + (path: "/encode/bytes/header/base64"): HeaderBase64; + (path: "/encode/bytes/header/base64url"): HeaderBase64url; + (path: "/encode/bytes/header/base64url-array"): HeaderBase64urlArray; + (path: "/encode/bytes/body/request/default"): RequestBodyDefault; + (path: "/encode/bytes/body/request/octet-stream"): RequestBodyOctetStream; + (path: "/encode/bytes/body/request/custom-content-type"): RequestBodyCustomContentType; + (path: "/encode/bytes/body/request/base64"): RequestBodyBase64; + (path: "/encode/bytes/body/request/base64url"): RequestBodyBase64url; + (path: "/encode/bytes/body/response/default"): ResponseBodyDefault; + (path: "/encode/bytes/body/response/octet-stream"): ResponseBodyOctetStream; + (path: "/encode/bytes/body/response/custom-content-type"): ResponseBodyCustomContentType; + (path: "/encode/bytes/body/response/base64"): ResponseBodyBase64; + (path: "/encode/bytes/body/response/base64url"): ResponseBodyBase64url; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/tspconfig.yaml new file mode 100644 index 0000000000..19c33e15ef --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/bytes/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/encode-bytes" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/encode/datetime/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/src/index.d.ts new file mode 100644 index 0000000000..f84dcf7f29 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/src/index.d.ts @@ -0,0 +1,404 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare function buildCsvCollection(items: string[] | number[]): string; + +declare function createClient(options?: DatetimeClientOptions): DatetimeClient; +export default createClient; + +export declare type DatetimeClient = Client & { + path: Routes; +}; + +export declare interface DatetimeClientOptions extends ClientOptions { +} + +export declare interface DefaultDatetimeProperty { + value: Date | string; +} + +export declare interface DefaultDatetimePropertyOutput { + value: string; +} + +export declare interface HeaderDefault { + get(options: HeaderDefaultParameters): StreamableMethod; +} + +export declare interface HeaderDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderDefaultHeaderParam { + headers: RawHttpHeadersInput & HeaderDefaultHeaders; +} + +export declare interface HeaderDefaultHeaders { + value: string; +} + +export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; + +export declare interface HeaderRfc3339 { + get(options: HeaderRfc3339Parameters): StreamableMethod; +} + +export declare interface HeaderRfc3339204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderRfc3339HeaderParam { + headers: RawHttpHeadersInput & HeaderRfc3339Headers; +} + +export declare interface HeaderRfc3339Headers { + value: string; +} + +export declare type HeaderRfc3339Parameters = HeaderRfc3339HeaderParam & RequestParameters; + +export declare interface HeaderRfc7231 { + get(options: HeaderRfc7231Parameters): StreamableMethod; +} + +export declare interface HeaderRfc7231204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderRfc7231HeaderParam { + headers: RawHttpHeadersInput & HeaderRfc7231Headers; +} + +export declare interface HeaderRfc7231Headers { + value: string; +} + +export declare type HeaderRfc7231Parameters = HeaderRfc7231HeaderParam & RequestParameters; + +export declare interface HeaderUnixTimestamp { + get(options: HeaderUnixTimestampParameters): StreamableMethod; +} + +export declare interface HeaderUnixTimestamp204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderUnixTimestampArray { + get(options: HeaderUnixTimestampArrayParameters): StreamableMethod; +} + +export declare interface HeaderUnixTimestampArray204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderUnixTimestampArrayHeaderParam { + headers: RawHttpHeadersInput & HeaderUnixTimestampArrayHeaders; +} + +export declare interface HeaderUnixTimestampArrayHeaders { + value: string; +} + +export declare type HeaderUnixTimestampArrayParameters = HeaderUnixTimestampArrayHeaderParam & RequestParameters; + +export declare interface HeaderUnixTimestampHeaderParam { + headers: RawHttpHeadersInput & HeaderUnixTimestampHeaders; +} + +export declare interface HeaderUnixTimestampHeaders { + value: number; +} + +export declare type HeaderUnixTimestampParameters = HeaderUnixTimestampHeaderParam & RequestParameters; + +export declare interface PropertyDefault { + post(options: PropertyDefaultParameters): StreamableMethod; +} + +export declare interface PropertyDefault200Response extends HttpResponse { + status: "200"; + body: DefaultDatetimePropertyOutput; +} + +export declare interface PropertyDefaultBodyParam { + body: DefaultDatetimeProperty; +} + +export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; + +export declare interface PropertyRfc3339 { + post(options: PropertyRfc3339Parameters): StreamableMethod; +} + +export declare interface PropertyRfc3339200Response extends HttpResponse { + status: "200"; + body: Rfc3339DatetimePropertyOutput; +} + +export declare interface PropertyRfc3339BodyParam { + body: Rfc3339DatetimeProperty; +} + +export declare type PropertyRfc3339Parameters = PropertyRfc3339BodyParam & RequestParameters; + +export declare interface PropertyRfc7231 { + post(options: PropertyRfc7231Parameters): StreamableMethod; +} + +export declare interface PropertyRfc7231200Response extends HttpResponse { + status: "200"; + body: Rfc7231DatetimePropertyOutput; +} + +export declare interface PropertyRfc7231BodyParam { + body: Rfc7231DatetimeProperty; +} + +export declare type PropertyRfc7231Parameters = PropertyRfc7231BodyParam & RequestParameters; + +export declare interface PropertyUnixTimestamp { + post(options: PropertyUnixTimestampParameters): StreamableMethod; +} + +export declare interface PropertyUnixTimestamp200Response extends HttpResponse { + status: "200"; + body: UnixTimestampDatetimePropertyOutput; +} + +export declare interface PropertyUnixTimestampArray { + post(options: PropertyUnixTimestampArrayParameters): StreamableMethod; +} + +export declare interface PropertyUnixTimestampArray200Response extends HttpResponse { + status: "200"; + body: UnixTimestampArrayDatetimePropertyOutput; +} + +export declare interface PropertyUnixTimestampArrayBodyParam { + body: UnixTimestampArrayDatetimeProperty; +} + +export declare type PropertyUnixTimestampArrayParameters = PropertyUnixTimestampArrayBodyParam & RequestParameters; + +export declare interface PropertyUnixTimestampBodyParam { + body: UnixTimestampDatetimeProperty; +} + +export declare type PropertyUnixTimestampParameters = PropertyUnixTimestampBodyParam & RequestParameters; + +export declare interface QueryDefault { + get(options: QueryDefaultParameters): StreamableMethod; +} + +export declare interface QueryDefault204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryDefaultParameters = QueryDefaultQueryParam & RequestParameters; + +export declare interface QueryDefaultQueryParam { + queryParameters: QueryDefaultQueryParamProperties; +} + +export declare interface QueryDefaultQueryParamProperties { + value: Date | string; +} + +export declare interface QueryRfc3339 { + get(options: QueryRfc3339Parameters): StreamableMethod; +} + +export declare interface QueryRfc3339204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryRfc3339Parameters = QueryRfc3339QueryParam & RequestParameters; + +export declare interface QueryRfc3339QueryParam { + queryParameters: QueryRfc3339QueryParamProperties; +} + +export declare interface QueryRfc3339QueryParamProperties { + value: Date | string; +} + +export declare interface QueryRfc7231 { + get(options: QueryRfc7231Parameters): StreamableMethod; +} + +export declare interface QueryRfc7231204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryRfc7231Parameters = QueryRfc7231QueryParam & RequestParameters; + +export declare interface QueryRfc7231QueryParam { + queryParameters: QueryRfc7231QueryParamProperties; +} + +export declare interface QueryRfc7231QueryParamProperties { + value: Date | string; +} + +export declare interface QueryUnixTimestamp { + get(options: QueryUnixTimestampParameters): StreamableMethod; +} + +export declare interface QueryUnixTimestamp204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryUnixTimestampArray { + get(options: QueryUnixTimestampArrayParameters): StreamableMethod; +} + +export declare interface QueryUnixTimestampArray204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryUnixTimestampArrayParameters = QueryUnixTimestampArrayQueryParam & RequestParameters; + +export declare interface QueryUnixTimestampArrayQueryParam { + queryParameters: QueryUnixTimestampArrayQueryParamProperties; +} + +export declare interface QueryUnixTimestampArrayQueryParamProperties { + value: number[] | QueryUnixTimestampArrayValueQueryParam; +} + +export declare interface QueryUnixTimestampArrayValueQueryParam { + value: number[]; + explode: false; + style: "form"; +} + +export declare type QueryUnixTimestampParameters = QueryUnixTimestampQueryParam & RequestParameters; + +export declare interface QueryUnixTimestampQueryParam { + queryParameters: QueryUnixTimestampQueryParamProperties; +} + +export declare interface QueryUnixTimestampQueryParamProperties { + value: number; +} + +export declare interface ResponseHeaderDefault { + get(options?: ResponseHeaderDefaultParameters): StreamableMethod; +} + +export declare interface ResponseHeaderDefault204Headers { + value: string; +} + +export declare interface ResponseHeaderDefault204Response extends HttpResponse { + status: "204"; + headers: RawHttpHeaders & ResponseHeaderDefault204Headers; +} + +export declare type ResponseHeaderDefaultParameters = RequestParameters; + +export declare interface ResponseHeaderRfc3339 { + get(options?: ResponseHeaderRfc3339Parameters): StreamableMethod; +} + +export declare interface ResponseHeaderRfc3339204Headers { + value: string; +} + +export declare interface ResponseHeaderRfc3339204Response extends HttpResponse { + status: "204"; + headers: RawHttpHeaders & ResponseHeaderRfc3339204Headers; +} + +export declare type ResponseHeaderRfc3339Parameters = RequestParameters; + +export declare interface ResponseHeaderRfc7231 { + get(options?: ResponseHeaderRfc7231Parameters): StreamableMethod; +} + +export declare interface ResponseHeaderRfc7231204Headers { + value: string; +} + +export declare interface ResponseHeaderRfc7231204Response extends HttpResponse { + status: "204"; + headers: RawHttpHeaders & ResponseHeaderRfc7231204Headers; +} + +export declare type ResponseHeaderRfc7231Parameters = RequestParameters; + +export declare interface ResponseHeaderUnixTimestamp { + get(options?: ResponseHeaderUnixTimestampParameters): StreamableMethod; +} + +export declare interface ResponseHeaderUnixTimestamp204Headers { + value: string; +} + +export declare interface ResponseHeaderUnixTimestamp204Response extends HttpResponse { + status: "204"; + headers: RawHttpHeaders & ResponseHeaderUnixTimestamp204Headers; +} + +export declare type ResponseHeaderUnixTimestampParameters = RequestParameters; + +export declare interface Rfc3339DatetimeProperty { + value: Date | string; +} + +export declare interface Rfc3339DatetimePropertyOutput { + value: string; +} + +export declare interface Rfc7231DatetimeProperty { + value: Date | string; +} + +export declare interface Rfc7231DatetimePropertyOutput { + value: string; +} + +export declare interface Routes { + (path: "/encode/datetime/query/default"): QueryDefault; + (path: "/encode/datetime/query/rfc3339"): QueryRfc3339; + (path: "/encode/datetime/query/rfc7231"): QueryRfc7231; + (path: "/encode/datetime/query/unix-timestamp"): QueryUnixTimestamp; + (path: "/encode/datetime/query/unix-timestamp-array"): QueryUnixTimestampArray; + (path: "/encode/datetime/property/default"): PropertyDefault; + (path: "/encode/datetime/property/rfc3339"): PropertyRfc3339; + (path: "/encode/datetime/property/rfc7231"): PropertyRfc7231; + (path: "/encode/datetime/property/unix-timestamp"): PropertyUnixTimestamp; + (path: "/encode/datetime/property/unix-timestamp-array"): PropertyUnixTimestampArray; + (path: "/encode/datetime/header/default"): HeaderDefault; + (path: "/encode/datetime/header/rfc3339"): HeaderRfc3339; + (path: "/encode/datetime/header/rfc7231"): HeaderRfc7231; + (path: "/encode/datetime/header/unix-timestamp"): HeaderUnixTimestamp; + (path: "/encode/datetime/header/unix-timestamp-array"): HeaderUnixTimestampArray; + (path: "/encode/datetime/responseheader/default"): ResponseHeaderDefault; + (path: "/encode/datetime/responseheader/rfc3339"): ResponseHeaderRfc3339; + (path: "/encode/datetime/responseheader/rfc7231"): ResponseHeaderRfc7231; + (path: "/encode/datetime/responseheader/unix-timestamp"): ResponseHeaderUnixTimestamp; +} + +export declare interface UnixTimestampArrayDatetimeProperty { + value: number[]; +} + +export declare interface UnixTimestampArrayDatetimePropertyOutput { + value: number[]; +} + +export declare interface UnixTimestampDatetimeProperty { + value: number; +} + +export declare interface UnixTimestampDatetimePropertyOutput { + value: number; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/tspconfig.yaml new file mode 100644 index 0000000000..1ec854abd8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/datetime/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/encode-datetime" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/encode/duration/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/encode/duration/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/encode/duration/src/index.d.ts new file mode 100644 index 0000000000..42736307d5 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/duration/src/index.d.ts @@ -0,0 +1,401 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare function buildCsvCollection(items: string[] | number[]): string; + +declare function createClient(options?: DurationClientOptions): DurationClient; +export default createClient; + +export declare interface DefaultDurationProperty { + value: string; +} + +export declare interface DefaultDurationPropertyOutput { + value: string; +} + +export declare type DurationClient = Client & { + path: Routes; +}; + +export declare interface DurationClientOptions extends ClientOptions { +} + +export declare interface Float64SecondsDurationProperty { + value: number; +} + +export declare interface Float64SecondsDurationPropertyOutput { + value: number; +} + +export declare interface FloatSecondsDurationArrayProperty { + value: number[]; +} + +export declare interface FloatSecondsDurationArrayPropertyOutput { + value: number[]; +} + +export declare interface FloatSecondsDurationProperty { + value: number; +} + +export declare interface FloatSecondsDurationPropertyOutput { + value: number; +} + +export declare interface HeaderDefault { + get(options: HeaderDefaultParameters): StreamableMethod; +} + +export declare interface HeaderDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderDefaultHeaderParam { + headers: RawHttpHeadersInput & HeaderDefaultHeaders; +} + +export declare interface HeaderDefaultHeaders { + duration: string; +} + +export declare type HeaderDefaultParameters = HeaderDefaultHeaderParam & RequestParameters; + +export declare interface HeaderFloat64Seconds { + get(options: HeaderFloat64SecondsParameters): StreamableMethod; +} + +export declare interface HeaderFloat64Seconds204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderFloat64SecondsHeaderParam { + headers: RawHttpHeadersInput & HeaderFloat64SecondsHeaders; +} + +export declare interface HeaderFloat64SecondsHeaders { + duration: number; +} + +export declare type HeaderFloat64SecondsParameters = HeaderFloat64SecondsHeaderParam & RequestParameters; + +export declare interface HeaderFloatSeconds { + get(options: HeaderFloatSecondsParameters): StreamableMethod; +} + +export declare interface HeaderFloatSeconds204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderFloatSecondsHeaderParam { + headers: RawHttpHeadersInput & HeaderFloatSecondsHeaders; +} + +export declare interface HeaderFloatSecondsHeaders { + duration: number; +} + +export declare type HeaderFloatSecondsParameters = HeaderFloatSecondsHeaderParam & RequestParameters; + +export declare interface HeaderInt32Seconds { + get(options: HeaderInt32SecondsParameters): StreamableMethod; +} + +export declare interface HeaderInt32Seconds204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderInt32SecondsHeaderParam { + headers: RawHttpHeadersInput & HeaderInt32SecondsHeaders; +} + +export declare interface HeaderInt32SecondsHeaders { + duration: number; +} + +export declare type HeaderInt32SecondsParameters = HeaderInt32SecondsHeaderParam & RequestParameters; + +export declare interface HeaderIso8601 { + get(options: HeaderIso8601Parameters): StreamableMethod; +} + +export declare interface HeaderIso8601204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderIso8601Array { + get(options: HeaderIso8601ArrayParameters): StreamableMethod; +} + +export declare interface HeaderIso8601Array204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderIso8601ArrayHeaderParam { + headers: RawHttpHeadersInput & HeaderIso8601ArrayHeaders; +} + +export declare interface HeaderIso8601ArrayHeaders { + duration: string; +} + +export declare type HeaderIso8601ArrayParameters = HeaderIso8601ArrayHeaderParam & RequestParameters; + +export declare interface HeaderIso8601HeaderParam { + headers: RawHttpHeadersInput & HeaderIso8601Headers; +} + +export declare interface HeaderIso8601Headers { + duration: string; +} + +export declare type HeaderIso8601Parameters = HeaderIso8601HeaderParam & RequestParameters; + +export declare interface Int32SecondsDurationProperty { + value: number; +} + +export declare interface Int32SecondsDurationPropertyOutput { + value: number; +} + +export declare interface ISO8601DurationProperty { + value: string; +} + +export declare interface ISO8601DurationPropertyOutput { + value: string; +} + +export declare interface PropertyDefault { + post(options: PropertyDefaultParameters): StreamableMethod; +} + +export declare interface PropertyDefault200Response extends HttpResponse { + status: "200"; + body: DefaultDurationPropertyOutput; +} + +export declare interface PropertyDefaultBodyParam { + body: DefaultDurationProperty; +} + +export declare type PropertyDefaultParameters = PropertyDefaultBodyParam & RequestParameters; + +export declare interface PropertyFloat64Seconds { + post(options: PropertyFloat64SecondsParameters): StreamableMethod; +} + +export declare interface PropertyFloat64Seconds200Response extends HttpResponse { + status: "200"; + body: Float64SecondsDurationPropertyOutput; +} + +export declare interface PropertyFloat64SecondsBodyParam { + body: Float64SecondsDurationProperty; +} + +export declare type PropertyFloat64SecondsParameters = PropertyFloat64SecondsBodyParam & RequestParameters; + +export declare interface PropertyFloatSeconds { + post(options: PropertyFloatSecondsParameters): StreamableMethod; +} + +export declare interface PropertyFloatSeconds200Response extends HttpResponse { + status: "200"; + body: FloatSecondsDurationPropertyOutput; +} + +export declare interface PropertyFloatSecondsArray { + post(options: PropertyFloatSecondsArrayParameters): StreamableMethod; +} + +export declare interface PropertyFloatSecondsArray200Response extends HttpResponse { + status: "200"; + body: FloatSecondsDurationArrayPropertyOutput; +} + +export declare interface PropertyFloatSecondsArrayBodyParam { + body: FloatSecondsDurationArrayProperty; +} + +export declare type PropertyFloatSecondsArrayParameters = PropertyFloatSecondsArrayBodyParam & RequestParameters; + +export declare interface PropertyFloatSecondsBodyParam { + body: FloatSecondsDurationProperty; +} + +export declare type PropertyFloatSecondsParameters = PropertyFloatSecondsBodyParam & RequestParameters; + +export declare interface PropertyInt32Seconds { + post(options: PropertyInt32SecondsParameters): StreamableMethod; +} + +export declare interface PropertyInt32Seconds200Response extends HttpResponse { + status: "200"; + body: Int32SecondsDurationPropertyOutput; +} + +export declare interface PropertyInt32SecondsBodyParam { + body: Int32SecondsDurationProperty; +} + +export declare type PropertyInt32SecondsParameters = PropertyInt32SecondsBodyParam & RequestParameters; + +export declare interface PropertyIso8601 { + post(options: PropertyIso8601Parameters): StreamableMethod; +} + +export declare interface PropertyIso8601200Response extends HttpResponse { + status: "200"; + body: ISO8601DurationPropertyOutput; +} + +export declare interface PropertyIso8601BodyParam { + body: ISO8601DurationProperty; +} + +export declare type PropertyIso8601Parameters = PropertyIso8601BodyParam & RequestParameters; + +export declare interface QueryDefault { + get(options: QueryDefaultParameters): StreamableMethod; +} + +export declare interface QueryDefault204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryDefaultParameters = QueryDefaultQueryParam & RequestParameters; + +export declare interface QueryDefaultQueryParam { + queryParameters: QueryDefaultQueryParamProperties; +} + +export declare interface QueryDefaultQueryParamProperties { + input: string; +} + +export declare interface QueryFloat64Seconds { + get(options: QueryFloat64SecondsParameters): StreamableMethod; +} + +export declare interface QueryFloat64Seconds204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryFloat64SecondsParameters = QueryFloat64SecondsQueryParam & RequestParameters; + +export declare interface QueryFloat64SecondsQueryParam { + queryParameters: QueryFloat64SecondsQueryParamProperties; +} + +export declare interface QueryFloat64SecondsQueryParamProperties { + input: number; +} + +export declare interface QueryFloatSeconds { + get(options: QueryFloatSecondsParameters): StreamableMethod; +} + +export declare interface QueryFloatSeconds204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryFloatSecondsParameters = QueryFloatSecondsQueryParam & RequestParameters; + +export declare interface QueryFloatSecondsQueryParam { + queryParameters: QueryFloatSecondsQueryParamProperties; +} + +export declare interface QueryFloatSecondsQueryParamProperties { + input: number; +} + +export declare interface QueryInt32Seconds { + get(options: QueryInt32SecondsParameters): StreamableMethod; +} + +export declare interface QueryInt32Seconds204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryInt32SecondsArray { + get(options: QueryInt32SecondsArrayParameters): StreamableMethod; +} + +export declare interface QueryInt32SecondsArray204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryInt32SecondsArrayInputQueryParam { + value: number[]; + explode: false; + style: "form"; +} + +export declare type QueryInt32SecondsArrayParameters = QueryInt32SecondsArrayQueryParam & RequestParameters; + +export declare interface QueryInt32SecondsArrayQueryParam { + queryParameters: QueryInt32SecondsArrayQueryParamProperties; +} + +export declare interface QueryInt32SecondsArrayQueryParamProperties { + input: number[] | QueryInt32SecondsArrayInputQueryParam; +} + +export declare type QueryInt32SecondsParameters = QueryInt32SecondsQueryParam & RequestParameters; + +export declare interface QueryInt32SecondsQueryParam { + queryParameters: QueryInt32SecondsQueryParamProperties; +} + +export declare interface QueryInt32SecondsQueryParamProperties { + input: number; +} + +export declare interface QueryIso8601 { + get(options: QueryIso8601Parameters): StreamableMethod; +} + +export declare interface QueryIso8601204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryIso8601Parameters = QueryIso8601QueryParam & RequestParameters; + +export declare interface QueryIso8601QueryParam { + queryParameters: QueryIso8601QueryParamProperties; +} + +export declare interface QueryIso8601QueryParamProperties { + input: string; +} + +export declare interface Routes { + (path: "/encode/duration/query/default"): QueryDefault; + (path: "/encode/duration/query/iso8601"): QueryIso8601; + (path: "/encode/duration/query/int32-seconds"): QueryInt32Seconds; + (path: "/encode/duration/query/float-seconds"): QueryFloatSeconds; + (path: "/encode/duration/query/float64-seconds"): QueryFloat64Seconds; + (path: "/encode/duration/query/int32-seconds-array"): QueryInt32SecondsArray; + (path: "/encode/duration/property/default"): PropertyDefault; + (path: "/encode/duration/property/iso8601"): PropertyIso8601; + (path: "/encode/duration/property/int32-seconds"): PropertyInt32Seconds; + (path: "/encode/duration/property/float-seconds"): PropertyFloatSeconds; + (path: "/encode/duration/property/float64-seconds"): PropertyFloat64Seconds; + (path: "/encode/duration/property/float-seconds-array"): PropertyFloatSecondsArray; + (path: "/encode/duration/header/default"): HeaderDefault; + (path: "/encode/duration/header/iso8601"): HeaderIso8601; + (path: "/encode/duration/header/iso8601-array"): HeaderIso8601Array; + (path: "/encode/duration/header/int32-seconds"): HeaderInt32Seconds; + (path: "/encode/duration/header/float-seconds"): HeaderFloatSeconds; + (path: "/encode/duration/header/float64-seconds"): HeaderFloat64Seconds; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/duration/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/encode/duration/tspconfig.yaml new file mode 100644 index 0000000000..12c5003e7f --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/duration/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/encode-duration" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/encode/numeric/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/src/index.d.ts new file mode 100644 index 0000000000..754b622f6b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/src/index.d.ts @@ -0,0 +1,92 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: NumericClientOptions): NumericClient; +export default createClient; + +export declare type NumericClient = Client & { + path: Routes; +}; + +export declare interface NumericClientOptions extends ClientOptions { +} + +export declare interface PropertySafeintAsString200Response extends HttpResponse { + status: "200"; + body: SafeintAsStringPropertyOutput; +} + +export declare interface PropertySafeintAsStringBodyParam { + body: SafeintAsStringProperty; +} + +export declare type PropertySafeintAsStringParameters = PropertySafeintAsStringBodyParam & RequestParameters; + +export declare interface PropertyUint32AsStringOptional200Response extends HttpResponse { + status: "200"; + body: Uint32AsStringPropertyOutput; +} + +export declare interface PropertyUint32AsStringOptionalBodyParam { + body: Uint32AsStringProperty; +} + +export declare type PropertyUint32AsStringOptionalParameters = PropertyUint32AsStringOptionalBodyParam & RequestParameters; + +export declare interface PropertyUint8AsString200Response extends HttpResponse { + status: "200"; + body: Uint8AsStringPropertyOutput; +} + +export declare interface PropertyUint8AsStringBodyParam { + body: Uint8AsStringProperty; +} + +export declare type PropertyUint8AsStringParameters = PropertyUint8AsStringBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/encode/numeric/property/safeint"): SafeintAsString; + (path: "/encode/numeric/property/uint32"): Uint32AsStringOptional; + (path: "/encode/numeric/property/uint8"): Uint8AsString; +} + +export declare interface SafeintAsString { + post(options: PropertySafeintAsStringParameters): StreamableMethod; +} + +export declare interface SafeintAsStringProperty { + value: string; +} + +export declare interface SafeintAsStringPropertyOutput { + value: string; +} + +export declare interface Uint32AsStringOptional { + post(options: PropertyUint32AsStringOptionalParameters): StreamableMethod; +} + +export declare interface Uint32AsStringProperty { + value?: string; +} + +export declare interface Uint32AsStringPropertyOutput { + value?: string; +} + +export declare interface Uint8AsString { + post(options: PropertyUint8AsStringParameters): StreamableMethod; +} + +export declare interface Uint8AsStringProperty { + value: string; +} + +export declare interface Uint8AsStringPropertyOutput { + value: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/tspconfig.yaml new file mode 100644 index 0000000000..ba9e7ad72c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/encode/numeric/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/encode-numeric" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/media-types/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/media-types/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/media-types/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/media-types/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/media-types/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/media-types/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/media-types/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/media-types/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/integration/generated/media-types/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/media-types/tspconfig.yaml index 7c0b57e852..d09abeaf25 100644 --- a/packages/typespec-ts/test/integration/generated/media-types/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/media-types/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: MediaTypesClient diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/overload/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/overload/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/overload/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/overload/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/overload/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/overload/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/overload/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/overload/tspconfig.yaml similarity index 93% rename from packages/typespec-ts/test/integration/generated/overload/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/overload/tspconfig.yaml index 390011f6fa..f255e019cc 100644 --- a/packages/typespec-ts/test/integration/generated/overload/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/overload/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true packageDetails: diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/parameters/basic/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/src/index.d.ts new file mode 100644 index 0000000000..63b3b02083 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/src/index.d.ts @@ -0,0 +1,56 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare type BasicClient = Client & { + path: Routes; +}; + +export declare interface BasicClientOptions extends ClientOptions { +} + +declare function createClient(options?: BasicClientOptions): BasicClient; +export default createClient; + +export declare interface ExplicitBodySimple { + put(options: ExplicitBodySimpleParameters): StreamableMethod; +} + +export declare interface ExplicitBodySimple204Response extends HttpResponse { + status: "204"; +} + +export declare interface ExplicitBodySimpleBodyParam { + body: User; +} + +export declare type ExplicitBodySimpleParameters = ExplicitBodySimpleBodyParam & RequestParameters; + +export declare interface ImplicitBodySimple { + put(options: ImplicitBodySimpleParameters): StreamableMethod; +} + +export declare interface ImplicitBodySimple204Response extends HttpResponse { + status: "204"; +} + +export declare interface ImplicitBodySimpleBodyParam { + body: { + name: string; + }; +} + +export declare type ImplicitBodySimpleParameters = ImplicitBodySimpleBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/parameters/basic/explicit-body/simple"): ExplicitBodySimple; + (path: "/parameters/basic/implicit-body/simple"): ImplicitBodySimple; +} + +export declare interface User { + name: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/tspconfig.yaml new file mode 100644 index 0000000000..dfdf28a1b6 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/basic/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + enableOperationGroup: true + isTypeSpecTest: true + packageDetails: + name: "@msinternal/parameterBasic" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/model/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/src/index.d.ts new file mode 100644 index 0000000000..17563456de --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/src/index.d.ts @@ -0,0 +1,85 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface BodyModel { + name: string; +} + +export declare type BodyOptionalityClient = Client & { + path: Routes; +}; + +export declare interface BodyOptionalityClientOptions extends ClientOptions { +} + +declare function createClient(options?: BodyOptionalityClientOptions): BodyOptionalityClient; +export default createClient; + +declare interface Omit_2 { + post(options?: OptionalExplicitOmitParameters): StreamableMethod; +} +export { Omit_2 as Omit } + +export declare interface OptionalExplicitOmit204Response extends HttpResponse { + status: "204"; +} + +export declare interface OptionalExplicitOmitBodyParam { + body?: BodyModel; +} + +export declare type OptionalExplicitOmitParameters = OptionalExplicitOmitBodyParam & RequestParameters; + +export declare interface OptionalExplicitSetModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface OptionalExplicitSetModelBodyParam { + body?: BodyModel; +} + +export declare type OptionalExplicitSetModelParameters = OptionalExplicitSetModelBodyParam & RequestParameters; + +export declare interface RequiredExplicit { + post(options: RequiredExplicitParameters): StreamableMethod; +} + +export declare interface RequiredExplicit204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequiredExplicitBodyParam { + body: BodyModel; +} + +export declare type RequiredExplicitParameters = RequiredExplicitBodyParam & RequestParameters; + +export declare interface RequiredImplicit { + post(options: RequiredImplicitParameters): StreamableMethod; +} + +export declare interface RequiredImplicit204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequiredImplicitBodyParam { + body: BodyModel; +} + +export declare type RequiredImplicitParameters = RequiredImplicitBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/parameters/body-optionality/required-explicit"): RequiredExplicit; + (path: "/parameters/body-optionality/required-implicit"): RequiredImplicit; + (path: "/parameters/body-optionality/optional-explicit/set"): SetModel; + (path: "/parameters/body-optionality/optional-explicit/omit"): Omit_2; +} + +export declare interface SetModel { + post(options?: OptionalExplicitSetModelParameters): StreamableMethod; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/tspconfig.yaml new file mode 100644 index 0000000000..5c279cf112 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/body-optionality/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + enableOperationGroup: true + isTypeSpecTest: true + packageDetails: + name: "@msinternal/collectionFormat" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/page/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/src/index.d.ts new file mode 100644 index 0000000000..97d913289d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/src/index.d.ts @@ -0,0 +1,163 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare function buildCsvCollection(items: string[] | number[]): string; + +export declare function buildMultiCollection(items: string[], parameterName: string): string; + +export declare type CollectionFormatClient = Client & { + path: Routes; +}; + +export declare interface CollectionFormatClientOptions extends ClientOptions { +} + +declare function createClient(options?: CollectionFormatClientOptions): CollectionFormatClient; +export default createClient; + +export declare interface HeaderCsv { + get(options: HeaderCsvParameters): StreamableMethod; +} + +export declare interface HeaderCsv204Response extends HttpResponse { + status: "204"; +} + +export declare interface HeaderCsvHeaderParam { + headers: RawHttpHeadersInput & HeaderCsvHeaders; +} + +export declare interface HeaderCsvHeaders { + colors: string; +} + +export declare type HeaderCsvParameters = HeaderCsvHeaderParam & RequestParameters; + +export declare interface QueryCsv { + get(options: QueryCsvParameters): StreamableMethod; +} + +export declare interface QueryCsv204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryCsvColorsQueryParam { + value: string[]; + explode: false; + style: "form"; +} + +export declare type QueryCsvParameters = QueryCsvQueryParam & RequestParameters; + +export declare interface QueryCsvQueryParam { + queryParameters: QueryCsvQueryParamProperties; +} + +export declare interface QueryCsvQueryParamProperties { + colors: string[] | QueryCsvColorsQueryParam; +} + +export declare interface QueryMulti { + get(options: QueryMultiParameters): StreamableMethod; +} + +export declare interface QueryMulti204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryMultiColorsQueryParam { + value: string[]; + explode: true; + style: "form"; +} + +export declare type QueryMultiParameters = QueryMultiQueryParam & RequestParameters; + +export declare interface QueryMultiQueryParam { + queryParameters: QueryMultiQueryParamProperties; +} + +export declare interface QueryMultiQueryParamProperties { + colors: QueryMultiColorsQueryParam | string; +} + +export declare interface QueryPipes { + get(options: QueryPipesParameters): StreamableMethod; +} + +export declare interface QueryPipes204Response extends HttpResponse { + status: "204"; +} + +export declare interface QueryPipesColorsQueryParam { + value: string[]; + explode: false; + style: "pipeDelimited"; +} + +export declare type QueryPipesParameters = QueryPipesQueryParam & RequestParameters; + +export declare interface QueryPipesQueryParam { + queryParameters: QueryPipesQueryParamProperties; +} + +export declare interface QueryPipesQueryParamProperties { + colors: QueryPipesColorsQueryParam; +} + +export declare interface QuerySsv { + get(options: QuerySsvParameters): StreamableMethod; +} + +export declare interface QuerySsv204Response extends HttpResponse { + status: "204"; +} + +export declare interface QuerySsvColorsQueryParam { + value: string[]; + explode: false; + style: "spaceDelimited"; +} + +export declare type QuerySsvParameters = QuerySsvQueryParam & RequestParameters; + +export declare interface QuerySsvQueryParam { + queryParameters: QuerySsvQueryParamProperties; +} + +export declare interface QuerySsvQueryParamProperties { + colors: QuerySsvColorsQueryParam; +} + +export declare interface QueryTsv { + get(options: QueryTsvParameters): StreamableMethod; +} + +export declare interface QueryTsv204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryTsvParameters = QueryTsvQueryParam & RequestParameters; + +export declare interface QueryTsvQueryParam { + queryParameters: QueryTsvQueryParamProperties; +} + +export declare interface QueryTsvQueryParamProperties { + colors: string; +} + +export declare interface Routes { + (path: "/parameters/collection-format/query/multi"): QueryMulti; + (path: "/parameters/collection-format/query/ssv"): QuerySsv; + (path: "/parameters/collection-format/query/tsv"): QueryTsv; + (path: "/parameters/collection-format/query/pipes"): QueryPipes; + (path: "/parameters/collection-format/query/csv"): QueryCsv; + (path: "/parameters/collection-format/header/csv"): HeaderCsv; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/tspconfig.yaml new file mode 100644 index 0000000000..7cf447a034 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/collection-format/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + enableOperationGroup: true + compatibilityQueryMultiFormat: true + isTypeSpecTest: true + title: CollectionFormatClient + packageDetails: + name: "@msinternal/collectionFormat" + description: "CollectionFormat Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/parameters/spread/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/src/index.d.ts new file mode 100644 index 0000000000..baa647880d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/src/index.d.ts @@ -0,0 +1,247 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface AliasSpreadAsRequestBody { + put(options: AliasSpreadAsRequestBodyParameters): StreamableMethod; +} + +export declare interface AliasSpreadAsRequestBody204Response extends HttpResponse { + status: "204"; +} + +export declare interface AliasSpreadAsRequestBodyBodyParam { + body: { + name: string; + }; +} + +export declare type AliasSpreadAsRequestBodyParameters = AliasSpreadAsRequestBodyBodyParam & RequestParameters; + +export declare interface AliasSpreadAsRequestParameter { + put(options: AliasSpreadAsRequestParameterParameters): StreamableMethod; +} + +export declare interface AliasSpreadAsRequestParameter204Response extends HttpResponse { + status: "204"; +} + +export declare interface AliasSpreadAsRequestParameterBodyParam { + body: { + name: string; + }; +} + +export declare interface AliasSpreadAsRequestParameterHeaderParam { + headers: RawHttpHeadersInput & AliasSpreadAsRequestParameterHeaders; +} + +export declare interface AliasSpreadAsRequestParameterHeaders { + "x-ms-test-header": string; +} + +export declare type AliasSpreadAsRequestParameterParameters = AliasSpreadAsRequestParameterHeaderParam & AliasSpreadAsRequestParameterBodyParam & RequestParameters; + +export declare interface AliasSpreadParameterWithInnerAlias { + post(options: AliasSpreadParameterWithInnerAliasParameters): StreamableMethod; +} + +export declare interface AliasSpreadParameterWithInnerAlias204Response extends HttpResponse { + status: "204"; +} + +export declare interface AliasSpreadParameterWithInnerAliasBodyParam { + body: { + name: string; + age: number; + }; +} + +export declare interface AliasSpreadParameterWithInnerAliasHeaderParam { + headers: RawHttpHeadersInput & AliasSpreadParameterWithInnerAliasHeaders; +} + +export declare interface AliasSpreadParameterWithInnerAliasHeaders { + "x-ms-test-header": string; +} + +export declare type AliasSpreadParameterWithInnerAliasParameters = AliasSpreadParameterWithInnerAliasHeaderParam & AliasSpreadParameterWithInnerAliasBodyParam & RequestParameters; + +export declare interface AliasSpreadParameterWithInnerModel { + post(options: AliasSpreadParameterWithInnerModelParameters): StreamableMethod; +} + +export declare interface AliasSpreadParameterWithInnerModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface AliasSpreadParameterWithInnerModelBodyParam { + body: InnerModel; +} + +export declare interface AliasSpreadParameterWithInnerModelHeaderParam { + headers: RawHttpHeadersInput & AliasSpreadParameterWithInnerModelHeaders; +} + +export declare interface AliasSpreadParameterWithInnerModelHeaders { + "x-ms-test-header": string; +} + +export declare type AliasSpreadParameterWithInnerModelParameters = AliasSpreadParameterWithInnerModelHeaderParam & AliasSpreadParameterWithInnerModelBodyParam & RequestParameters; + +export declare interface AliasSpreadWithMultipleParameters { + put(options: AliasSpreadWithMultipleParametersParameters): StreamableMethod; +} + +export declare interface AliasSpreadWithMultipleParameters204Response extends HttpResponse { + status: "204"; +} + +export declare interface AliasSpreadWithMultipleParametersBodyParam { + body: { + requiredString: string; + optionalInt?: number; + requiredIntList: number[]; + optionalStringList?: string[]; + }; +} + +export declare interface AliasSpreadWithMultipleParametersHeaderParam { + headers: RawHttpHeadersInput & AliasSpreadWithMultipleParametersHeaders; +} + +export declare interface AliasSpreadWithMultipleParametersHeaders { + "x-ms-test-header": string; +} + +export declare type AliasSpreadWithMultipleParametersParameters = AliasSpreadWithMultipleParametersHeaderParam & AliasSpreadWithMultipleParametersBodyParam & RequestParameters; + +export declare interface BodyParameter { + name: string; +} + +export declare interface CompositeRequestMix { + prop: string; +} + +declare function createClient(options?: SpreadClientOptions): SpreadClient; +export default createClient; + +export declare interface InnerModel { + name: string; +} + +export declare interface ModelSpreadAsRequestBody { + put(options: ModelSpreadAsRequestBodyParameters): StreamableMethod; +} + +export declare interface ModelSpreadAsRequestBody204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelSpreadAsRequestBodyBodyParam { + body: BodyParameter; +} + +export declare type ModelSpreadAsRequestBodyParameters = ModelSpreadAsRequestBodyBodyParam & RequestParameters; + +export declare interface ModelSpreadCompositeRequest { + put(options: ModelSpreadCompositeRequestParameters): StreamableMethod; +} + +export declare interface ModelSpreadCompositeRequest204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelSpreadCompositeRequestBodyParam { + body: BodyParameter; +} + +export declare interface ModelSpreadCompositeRequestHeaderParam { + headers: RawHttpHeadersInput & ModelSpreadCompositeRequestHeaders; +} + +export declare interface ModelSpreadCompositeRequestHeaders { + "test-header": string; +} + +export declare interface ModelSpreadCompositeRequestMix { + put(options: ModelSpreadCompositeRequestMixParameters): StreamableMethod; +} + +export declare interface ModelSpreadCompositeRequestMix204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelSpreadCompositeRequestMixBodyParam { + body: CompositeRequestMix; +} + +export declare interface ModelSpreadCompositeRequestMixHeaderParam { + headers: RawHttpHeadersInput & ModelSpreadCompositeRequestMixHeaders; +} + +export declare interface ModelSpreadCompositeRequestMixHeaders { + "test-header": string; +} + +export declare type ModelSpreadCompositeRequestMixParameters = ModelSpreadCompositeRequestMixHeaderParam & ModelSpreadCompositeRequestMixBodyParam & RequestParameters; + +export declare interface ModelSpreadCompositeRequestOnlyWithBody { + put(options: ModelSpreadCompositeRequestOnlyWithBodyParameters): StreamableMethod; +} + +export declare interface ModelSpreadCompositeRequestOnlyWithBody204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelSpreadCompositeRequestOnlyWithBodyBodyParam { + body: BodyParameter; +} + +export declare type ModelSpreadCompositeRequestOnlyWithBodyParameters = ModelSpreadCompositeRequestOnlyWithBodyBodyParam & RequestParameters; + +export declare type ModelSpreadCompositeRequestParameters = ModelSpreadCompositeRequestHeaderParam & ModelSpreadCompositeRequestBodyParam & RequestParameters; + +export declare interface ModelSpreadCompositeRequestWithoutBody { + put(options: ModelSpreadCompositeRequestWithoutBodyParameters): StreamableMethod; +} + +export declare interface ModelSpreadCompositeRequestWithoutBody204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelSpreadCompositeRequestWithoutBodyHeaderParam { + headers: RawHttpHeadersInput & ModelSpreadCompositeRequestWithoutBodyHeaders; +} + +export declare interface ModelSpreadCompositeRequestWithoutBodyHeaders { + "test-header": string; +} + +export declare type ModelSpreadCompositeRequestWithoutBodyParameters = ModelSpreadCompositeRequestWithoutBodyHeaderParam & RequestParameters; + +export declare interface Routes { + (path: "/parameters/spread/model/request-body"): ModelSpreadAsRequestBody; + (path: "/parameters/spread/model/composite-request-only-with-body"): ModelSpreadCompositeRequestOnlyWithBody; + (path: "/parameters/spread/model/composite-request-without-body/{name}", name: string): ModelSpreadCompositeRequestWithoutBody; + (path: "/parameters/spread/model/composite-request/{name}", name: string): ModelSpreadCompositeRequest; + (path: "/parameters/spread/model/composite-request-mix/{name}", name: string): ModelSpreadCompositeRequestMix; + (path: "/parameters/spread/alias/request-body"): AliasSpreadAsRequestBody; + (path: "/parameters/spread/alias/inner-model-parameter/{id}", id: string): AliasSpreadParameterWithInnerModel; + (path: "/parameters/spread/alias/request-parameter/{id}", id: string): AliasSpreadAsRequestParameter; + (path: "/parameters/spread/alias/multiple-parameters/{id}", id: string): AliasSpreadWithMultipleParameters; + (path: "/parameters/spread/alias/inner-alias-parameter/{id}", id: string): AliasSpreadParameterWithInnerAlias; +} + +export declare type SpreadClient = Client & { + path: Routes; +}; + +export declare interface SpreadClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/tspconfig.yaml new file mode 100644 index 0000000000..479e735c31 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/parameters/spread/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + enableOperationGroup: true + isTypeSpecTest: true + packageDetails: + name: "@msinternal/parameterSpread" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/src/index.d.ts new file mode 100644 index 0000000000..34ae3fd4ca --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/src/index.d.ts @@ -0,0 +1,118 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare type ContentNegotiationClient = Client & { + path: Routes; +}; + +export declare interface ContentNegotiationClientOptions extends ClientOptions { +} + +declare function createClient(options?: ContentNegotiationClientOptions): ContentNegotiationClient; +export default createClient; + +export declare interface DifferentBodyGetAvatarAsJson200Headers { + "content-type": "application/json"; +} + +export declare interface DifferentBodyGetAvatarAsJson200Response extends HttpResponse { + status: "200"; + body: PngImageAsJsonOutput; + headers: RawHttpHeaders & DifferentBodyGetAvatarAsJson200Headers; +} + +export declare interface DifferentBodyGetAvatarAsJsonHeaderParam { + headers: RawHttpHeadersInput & DifferentBodyGetAvatarAsJsonHeaders; +} + +export declare interface DifferentBodyGetAvatarAsJsonHeaders { + accept: "application/json"; +} + +export declare type DifferentBodyGetAvatarAsJsonParameters = DifferentBodyGetAvatarAsJsonHeaderParam & RequestParameters; + +export declare interface DifferentBodyGetAvatarAsPng { + get(options: DifferentBodyGetAvatarAsPngParameters): StreamableMethod; + get(options: DifferentBodyGetAvatarAsJsonParameters): StreamableMethod; +} + +export declare interface DifferentBodyGetAvatarAsPng200Headers { + "content-type": "image/png"; +} + +export declare interface DifferentBodyGetAvatarAsPng200Response extends HttpResponse { + status: "200"; + body: Uint8Array; + headers: RawHttpHeaders & DifferentBodyGetAvatarAsPng200Headers; +} + +export declare interface DifferentBodyGetAvatarAsPngHeaderParam { + headers: RawHttpHeadersInput & DifferentBodyGetAvatarAsPngHeaders; +} + +export declare interface DifferentBodyGetAvatarAsPngHeaders { + accept: "image/png"; +} + +export declare type DifferentBodyGetAvatarAsPngParameters = DifferentBodyGetAvatarAsPngHeaderParam & RequestParameters; + +export declare interface PngImageAsJsonOutput { + content: string; +} + +export declare interface Routes { + (path: "/content-negotiation/same-body"): SameBodyGetAvatarAsPng; + (path: "/content-negotiation/different-body"): DifferentBodyGetAvatarAsPng; +} + +export declare interface SameBodyGetAvatarAsJpeg200Headers { + "content-type": "image/jpeg"; +} + +export declare interface SameBodyGetAvatarAsJpeg200Response extends HttpResponse { + status: "200"; + body: Uint8Array; + headers: RawHttpHeaders & SameBodyGetAvatarAsJpeg200Headers; +} + +export declare interface SameBodyGetAvatarAsJpegHeaderParam { + headers: RawHttpHeadersInput & SameBodyGetAvatarAsJpegHeaders; +} + +export declare interface SameBodyGetAvatarAsJpegHeaders { + accept: "image/jpeg"; +} + +export declare type SameBodyGetAvatarAsJpegParameters = SameBodyGetAvatarAsJpegHeaderParam & RequestParameters; + +export declare interface SameBodyGetAvatarAsPng { + get(options: SameBodyGetAvatarAsPngParameters): StreamableMethod; + get(options: SameBodyGetAvatarAsJpegParameters): StreamableMethod; +} + +export declare interface SameBodyGetAvatarAsPng200Headers { + "content-type": "image/png"; +} + +export declare interface SameBodyGetAvatarAsPng200Response extends HttpResponse { + status: "200"; + body: Uint8Array; + headers: RawHttpHeaders & SameBodyGetAvatarAsPng200Headers; +} + +export declare interface SameBodyGetAvatarAsPngHeaderParam { + headers: RawHttpHeadersInput & SameBodyGetAvatarAsPngHeaders; +} + +export declare interface SameBodyGetAvatarAsPngHeaders { + accept: "image/png"; +} + +export declare type SameBodyGetAvatarAsPngParameters = SameBodyGetAvatarAsPngHeaderParam & RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/tspconfig.yaml new file mode 100644 index 0000000000..a3a0677e3d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/content-negotiation/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/payload-content-negotiation" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/payload/media-type/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/src/index.d.ts new file mode 100644 index 0000000000..3f09ace33b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/src/index.d.ts @@ -0,0 +1,93 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: MediaTypeClientOptions): MediaTypeClient; +export default createClient; + +export declare interface GetAsJson { + get(options?: StringBodyGetAsJsonParameters): StreamableMethod; +} + +export declare interface GetAsText { + get(options?: StringBodyGetAsTextParameters): StreamableMethod; +} + +export declare type MediaTypeClient = Client & { + path: Routes; +}; + +export declare interface MediaTypeClientOptions extends ClientOptions { +} + +export declare interface Routes { + (path: "/payload/media-type/string-body/sendAsText"): SendAsText; + (path: "/payload/media-type/string-body/getAsText"): GetAsText; + (path: "/payload/media-type/string-body/sendAsJson"): SendAsJson; + (path: "/payload/media-type/string-body/getAsJson"): GetAsJson; +} + +export declare interface SendAsJson { + post(options: StringBodySendAsJsonParameters): StreamableMethod; +} + +export declare interface SendAsText { + post(options: StringBodySendAsTextParameters): StreamableMethod; +} + +export declare interface StringBodyGetAsJson200Headers { + "content-type": "application/json"; +} + +export declare interface StringBodyGetAsJson200Response extends HttpResponse { + status: "200"; + body: string; + headers: RawHttpHeaders & StringBodyGetAsJson200Headers; +} + +export declare type StringBodyGetAsJsonParameters = RequestParameters; + +export declare interface StringBodyGetAsText200Headers { + "content-type": "text/plain"; +} + +export declare interface StringBodyGetAsText200Response extends HttpResponse { + status: "200"; + body: string; + headers: RawHttpHeaders & StringBodyGetAsText200Headers; +} + +export declare type StringBodyGetAsTextParameters = RequestParameters; + +export declare interface StringBodySendAsJson200Response extends HttpResponse { + status: "200"; +} + +export declare interface StringBodySendAsJsonBodyParam { + body: string; +} + +export declare interface StringBodySendAsJsonMediaTypesParam { + contentType: "application/json"; +} + +export declare type StringBodySendAsJsonParameters = StringBodySendAsJsonMediaTypesParam & StringBodySendAsJsonBodyParam & RequestParameters; + +export declare interface StringBodySendAsText200Response extends HttpResponse { + status: "200"; +} + +export declare interface StringBodySendAsTextBodyParam { + body: string; +} + +export declare interface StringBodySendAsTextMediaTypesParam { + contentType: "text/plain"; +} + +export declare type StringBodySendAsTextParameters = StringBodySendAsTextMediaTypesParam & StringBodySendAsTextBodyParam & RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/tspconfig.yaml new file mode 100644 index 0000000000..3dbc551fe2 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/media-type/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/payload-media-type" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/payload/multipart/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/src/index.d.ts new file mode 100644 index 0000000000..bf63630040 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/src/index.d.ts @@ -0,0 +1,395 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface Address { + city: string; +} + +export declare type BinaryArrayPartsRequest = FormData | Array; + +export declare interface BinaryArrayPartsRequestIdPartDescriptor { + name: "id"; + body: string; +} + +export declare interface BinaryArrayPartsRequestPicturesPartDescriptor { + name: "pictures"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +export declare type ComplexHttpPartsModelRequest = FormData | Array; + +export declare interface ComplexHttpPartsModelRequestAddressPartDescriptor { + name: "address"; + body: HttpPart; +} + +export declare interface ComplexHttpPartsModelRequestIdPartDescriptor { + name: "id"; + body: HttpPart; +} + +export declare interface ComplexHttpPartsModelRequestPicturesPartDescriptor { + name: "pictures"; + body: Array; +} + +export declare interface ComplexHttpPartsModelRequestPreviousAddressesPartDescriptor { + name: "previousAddresses"; + body: HttpPart; +} + +export declare interface ComplexHttpPartsModelRequestProfileImagePartDescriptor { + name: "profileImage"; + body: HttpPart; +} + +export declare type ComplexPartsRequest = FormData | Array; + +export declare interface ComplexPartsRequestAddressPartDescriptor { + name: "address"; + body: Address; +} + +export declare interface ComplexPartsRequestIdPartDescriptor { + name: "id"; + body: string; +} + +export declare interface ComplexPartsRequestPicturesPartDescriptor { + name: "pictures"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +export declare interface ComplexPartsRequestProfileImagePartDescriptor { + name: "profileImage"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +declare function createClient(options?: MultiPartClientOptions): MultiPartClient; +export default createClient; + +export declare type FileWithHttpPartOptionalContentTypeRequest = FormData | Array; + +export declare interface FileWithHttpPartOptionalContentTypeRequestProfileImagePartDescriptor { + name: "profileImage"; + body: HttpPart; +} + +export declare type FileWithHttpPartRequiredContentTypeRequest = FormData | Array; + +export declare interface FileWithHttpPartRequiredContentTypeRequestProfileImagePartDescriptor { + name: "profileImage"; + body: HttpPart; +} + +export declare type FileWithHttpPartSpecificContentTypeRequest = FormData | Array; + +export declare interface FileWithHttpPartSpecificContentTypeRequestProfileImagePartDescriptor { + name: "profileImage"; + body: HttpPart; +} + +export declare interface FormDataAnonymousModel { + post(options: FormDataAnonymousModelParameters): StreamableMethod; +} + +export declare interface FormDataAnonymousModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataAnonymousModelBodyParam { + body: FormData | Array<{ + name: "profileImage"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; + }>; +} + +export declare interface FormDataAnonymousModelMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataAnonymousModelParameters = FormDataAnonymousModelMediaTypesParam & FormDataAnonymousModelBodyParam & RequestParameters; + +export declare interface FormDataBasic { + post(options: FormDataBasicParameters): StreamableMethod; +} + +export declare interface FormDataBasic204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataBasicBodyParam { + body: MultiPartRequest; +} + +export declare interface FormDataBasicMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataBasicParameters = FormDataBasicMediaTypesParam & FormDataBasicBodyParam & RequestParameters; + +export declare interface FormDataBinaryArrayParts { + post(options: FormDataBinaryArrayPartsParameters): StreamableMethod; +} + +export declare interface FormDataBinaryArrayParts204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataBinaryArrayPartsBodyParam { + body: BinaryArrayPartsRequest; +} + +export declare interface FormDataBinaryArrayPartsMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataBinaryArrayPartsParameters = FormDataBinaryArrayPartsMediaTypesParam & FormDataBinaryArrayPartsBodyParam & RequestParameters; + +export declare interface FormDataCheckFileNameAndContentType { + post(options: FormDataCheckFileNameAndContentTypeParameters): StreamableMethod; +} + +export declare interface FormDataCheckFileNameAndContentType204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataCheckFileNameAndContentTypeBodyParam { + body: MultiPartRequest; +} + +export declare interface FormDataCheckFileNameAndContentTypeMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataCheckFileNameAndContentTypeParameters = FormDataCheckFileNameAndContentTypeMediaTypesParam & FormDataCheckFileNameAndContentTypeBodyParam & RequestParameters; + +export declare interface FormDataFileArrayAndBasic { + post(options: FormDataFileArrayAndBasicParameters): StreamableMethod; +} + +export declare interface FormDataFileArrayAndBasic204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataFileArrayAndBasicBodyParam { + body: ComplexPartsRequest; +} + +export declare interface FormDataFileArrayAndBasicMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataFileArrayAndBasicParameters = FormDataFileArrayAndBasicMediaTypesParam & FormDataFileArrayAndBasicBodyParam & RequestParameters; + +export declare interface FormDataHttpPartsContentTypeImageJpegContentType { + post(options: FormDataHttpPartsContentTypeImageJpegContentTypeParameters): StreamableMethod; +} + +export declare interface FormDataHttpPartsContentTypeImageJpegContentType204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataHttpPartsContentTypeImageJpegContentTypeBodyParam { + body: FileWithHttpPartSpecificContentTypeRequest; +} + +export declare interface FormDataHttpPartsContentTypeImageJpegContentTypeMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataHttpPartsContentTypeImageJpegContentTypeParameters = FormDataHttpPartsContentTypeImageJpegContentTypeMediaTypesParam & FormDataHttpPartsContentTypeImageJpegContentTypeBodyParam & RequestParameters; + +export declare interface FormDataHttpPartsContentTypeOptionalContentType { + post(options: FormDataHttpPartsContentTypeOptionalContentTypeParameters): StreamableMethod; +} + +export declare interface FormDataHttpPartsContentTypeOptionalContentType204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataHttpPartsContentTypeOptionalContentTypeBodyParam { + body: FileWithHttpPartOptionalContentTypeRequest; +} + +export declare interface FormDataHttpPartsContentTypeOptionalContentTypeMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataHttpPartsContentTypeOptionalContentTypeParameters = FormDataHttpPartsContentTypeOptionalContentTypeMediaTypesParam & FormDataHttpPartsContentTypeOptionalContentTypeBodyParam & RequestParameters; + +export declare interface FormDataHttpPartsContentTypeRequiredContentType { + post(options: FormDataHttpPartsContentTypeRequiredContentTypeParameters): StreamableMethod; +} + +export declare interface FormDataHttpPartsContentTypeRequiredContentType204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataHttpPartsContentTypeRequiredContentTypeBodyParam { + body: FileWithHttpPartRequiredContentTypeRequest; +} + +export declare interface FormDataHttpPartsContentTypeRequiredContentTypeMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataHttpPartsContentTypeRequiredContentTypeParameters = FormDataHttpPartsContentTypeRequiredContentTypeMediaTypesParam & FormDataHttpPartsContentTypeRequiredContentTypeBodyParam & RequestParameters; + +export declare interface FormDataHttpPartsJsonArrayAndFileArray { + post(options: FormDataHttpPartsJsonArrayAndFileArrayParameters): StreamableMethod; +} + +export declare interface FormDataHttpPartsJsonArrayAndFileArray204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataHttpPartsJsonArrayAndFileArrayBodyParam { + body: ComplexHttpPartsModelRequest; +} + +export declare interface FormDataHttpPartsJsonArrayAndFileArrayMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataHttpPartsJsonArrayAndFileArrayParameters = FormDataHttpPartsJsonArrayAndFileArrayMediaTypesParam & FormDataHttpPartsJsonArrayAndFileArrayBodyParam & RequestParameters; + +export declare interface FormDataHttpPartsNonStringFloat { + post(options: FormDataHttpPartsNonStringFloatParameters): StreamableMethod; +} + +export declare interface FormDataHttpPartsNonStringFloat204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataHttpPartsNonStringFloatBodyParam { + body: FormData | Array<{ + name: "temperature"; + body: HttpPart; + }>; +} + +export declare interface FormDataHttpPartsNonStringFloatMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataHttpPartsNonStringFloatParameters = FormDataHttpPartsNonStringFloatMediaTypesParam & FormDataHttpPartsNonStringFloatBodyParam & RequestParameters; + +export declare interface FormDataJsonPart { + post(options: FormDataJsonPartParameters): StreamableMethod; +} + +export declare interface FormDataJsonPart204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataJsonPartBodyParam { + body: JsonPartRequest; +} + +export declare interface FormDataJsonPartMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataJsonPartParameters = FormDataJsonPartMediaTypesParam & FormDataJsonPartBodyParam & RequestParameters; + +export declare interface FormDataMultiBinaryParts { + post(options: FormDataMultiBinaryPartsParameters): StreamableMethod; +} + +export declare interface FormDataMultiBinaryParts204Response extends HttpResponse { + status: "204"; +} + +export declare interface FormDataMultiBinaryPartsBodyParam { + body: MultiBinaryPartsRequest; +} + +export declare interface FormDataMultiBinaryPartsMediaTypesParam { + contentType: "multipart/form-data"; +} + +export declare type FormDataMultiBinaryPartsParameters = FormDataMultiBinaryPartsMediaTypesParam & FormDataMultiBinaryPartsBodyParam & RequestParameters; + +export declare interface HttpPart { +} + +export declare type JsonPartRequest = FormData | Array; + +export declare interface JsonPartRequestAddressPartDescriptor { + name: "address"; + body: Address; +} + +export declare interface JsonPartRequestProfileImagePartDescriptor { + name: "profileImage"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +export declare type MultiBinaryPartsRequest = FormData | Array; + +export declare interface MultiBinaryPartsRequestPicturePartDescriptor { + name: "picture"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +export declare interface MultiBinaryPartsRequestProfileImagePartDescriptor { + name: "profileImage"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +export declare type MultiPartClient = Client & { + path: Routes; +}; + +export declare interface MultiPartClientOptions extends ClientOptions { +} + +export declare type MultiPartRequest = FormData | Array; + +export declare interface MultiPartRequestIdPartDescriptor { + name: "id"; + body: string; +} + +export declare interface MultiPartRequestProfileImagePartDescriptor { + name: "profileImage"; + body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; + filename?: string; + contentType?: string; +} + +export declare interface Routes { + (path: "/multipart/form-data/mixed-parts"): FormDataBasic; + (path: "/multipart/form-data/complex-parts"): FormDataFileArrayAndBasic; + (path: "/multipart/form-data/json-part"): FormDataJsonPart; + (path: "/multipart/form-data/binary-array-parts"): FormDataBinaryArrayParts; + (path: "/multipart/form-data/multi-binary-parts"): FormDataMultiBinaryParts; + (path: "/multipart/form-data/check-filename-and-content-type"): FormDataCheckFileNameAndContentType; + (path: "/multipart/form-data/anonymous-model"): FormDataAnonymousModel; + (path: "/multipart/form-data/complex-parts-with-httppart"): FormDataHttpPartsJsonArrayAndFileArray; + (path: "/multipart/form-data/check-filename-and-specific-content-type-with-httppart"): FormDataHttpPartsContentTypeImageJpegContentType; + (path: "/multipart/form-data/check-filename-and-required-content-type-with-httppart"): FormDataHttpPartsContentTypeRequiredContentType; + (path: "/multipart/form-data/file-with-http-part-optional-content-type"): FormDataHttpPartsContentTypeOptionalContentType; + (path: "/multipart/form-data/non-string-float"): FormDataHttpPartsNonStringFloat; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/tspconfig.yaml new file mode 100644 index 0000000000..8b176d238b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/multipart/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/payload-multipart" diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/payload/pageable/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/payload/pageable/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/payload/pageable/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/payload/pageable/src/index.d.ts new file mode 100644 index 0000000000..f570369921 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/pageable/src/index.d.ts @@ -0,0 +1,45 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: PageableClientOptions): PageableClient; +export default createClient; + +export declare interface Link { + get(options?: ServerDrivenPaginationLinkParameters): StreamableMethod; +} + +export declare type PageableClient = Client & { + path: Routes; +}; + +export declare interface PageableClientOptions extends ClientOptions { +} + +export declare interface PetOutput { + id: string; + name: string; +} + +export declare interface Routes { + (path: "/payload/pageable/server-driven-pagination/link"): Link; +} + +export declare interface ServerDrivenPaginationLink200Response extends HttpResponse { + status: "200"; + body: { + pets: Array; + links: { + next?: string; + prev?: string; + first?: string; + last?: string; + }; + }; +} + +export declare type ServerDrivenPaginationLinkParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/integration/generated/payload/pageable/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/payload/pageable/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/integration/generated/payload/pageable/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/payload/pageable/tspconfig.yaml index f5e355c3a3..45db92a72a 100644 --- a/packages/typespec-ts/test/integration/generated/payload/pageable/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/payload/pageable/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml index 8bfff60308..0880f8e183 100644 --- a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-main/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: ServiceDrivenNewClient diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/naming/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/.gitignore diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml index 234f9798c3..e36ae230b6 100644 --- a/packages/typespec-ts/test/integration/generated/resiliency/srv-driven-old/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true title: ServiceDrivenOldClient diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/routes/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/routes/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/routes/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/routes/src/index.d.ts new file mode 100644 index 0000000000..5d08b70677 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/routes/src/index.d.ts @@ -0,0 +1,704 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: RoutesClientOptions): RoutesClient; +export default createClient; + +export declare interface Fixed { + get(options?: FixedParameters): StreamableMethod; +} + +export declare interface Fixed204Response extends HttpResponse { + status: "204"; +} + +export declare type FixedParameters = RequestParameters; + +export declare interface InInterfaceFixed { + get(options?: InInterfaceFixedParameters): StreamableMethod; +} + +export declare interface InInterfaceFixed204Response extends HttpResponse { + status: "204"; +} + +export declare type InInterfaceFixedParameters = RequestParameters; + +export declare interface PathParametersAnnotationOnly { + get(options?: PathParametersAnnotationOnlyParameters): StreamableMethod; +} + +export declare interface PathParametersAnnotationOnly204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersAnnotationOnlyParameters = RequestParameters; + +export declare interface PathParametersExplicit { + get(options?: PathParametersExplicitParameters): StreamableMethod; +} + +export declare interface PathParametersExplicit204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersExplicitParameters = RequestParameters; + +export declare interface PathParametersLabelExpansionExplodeArray { + get(options?: PathParametersLabelExpansionExplodeArrayParameters): StreamableMethod; +} + +export declare interface PathParametersLabelExpansionExplodeArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersLabelExpansionExplodeArrayParameters = RequestParameters; + +export declare interface PathParametersLabelExpansionExplodePrimitive { + get(options?: PathParametersLabelExpansionExplodePrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersLabelExpansionExplodePrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersLabelExpansionExplodePrimitiveParameters = RequestParameters; + +export declare interface PathParametersLabelExpansionExplodeRecord { + get(options?: PathParametersLabelExpansionExplodeRecordParameters): StreamableMethod; +} + +export declare interface PathParametersLabelExpansionExplodeRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersLabelExpansionExplodeRecordParameters = RequestParameters; + +export declare interface PathParametersLabelExpansionStandardArray { + get(options?: PathParametersLabelExpansionStandardArrayParameters): StreamableMethod; +} + +export declare interface PathParametersLabelExpansionStandardArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersLabelExpansionStandardArrayParameters = RequestParameters; + +export declare interface PathParametersLabelExpansionStandardPrimitive { + get(options?: PathParametersLabelExpansionStandardPrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersLabelExpansionStandardPrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersLabelExpansionStandardPrimitiveParameters = RequestParameters; + +export declare interface PathParametersLabelExpansionStandardRecord { + get(options?: PathParametersLabelExpansionStandardRecordParameters): StreamableMethod; +} + +export declare interface PathParametersLabelExpansionStandardRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersLabelExpansionStandardRecordParameters = RequestParameters; + +export declare interface PathParametersMatrixExpansionExplodeArray { + get(options?: PathParametersMatrixExpansionExplodeArrayParameters): StreamableMethod; +} + +export declare interface PathParametersMatrixExpansionExplodeArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersMatrixExpansionExplodeArrayParameters = RequestParameters; + +export declare interface PathParametersMatrixExpansionExplodePrimitive { + get(options?: PathParametersMatrixExpansionExplodePrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersMatrixExpansionExplodePrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersMatrixExpansionExplodePrimitiveParameters = RequestParameters; + +export declare interface PathParametersMatrixExpansionExplodeRecord { + get(options?: PathParametersMatrixExpansionExplodeRecordParameters): StreamableMethod; +} + +export declare interface PathParametersMatrixExpansionExplodeRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersMatrixExpansionExplodeRecordParameters = RequestParameters; + +export declare interface PathParametersMatrixExpansionStandardArray { + get(options?: PathParametersMatrixExpansionStandardArrayParameters): StreamableMethod; +} + +export declare interface PathParametersMatrixExpansionStandardArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersMatrixExpansionStandardArrayParameters = RequestParameters; + +export declare interface PathParametersMatrixExpansionStandardPrimitive { + get(options?: PathParametersMatrixExpansionStandardPrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersMatrixExpansionStandardPrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersMatrixExpansionStandardPrimitiveParameters = RequestParameters; + +export declare interface PathParametersMatrixExpansionStandardRecord { + get(options?: PathParametersMatrixExpansionStandardRecordParameters): StreamableMethod; +} + +export declare interface PathParametersMatrixExpansionStandardRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersMatrixExpansionStandardRecordParameters = RequestParameters; + +export declare interface PathParametersPathExpansionExplodeArray { + get(options?: PathParametersPathExpansionExplodeArrayParameters): StreamableMethod; +} + +export declare interface PathParametersPathExpansionExplodeArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersPathExpansionExplodeArrayParameters = RequestParameters; + +export declare interface PathParametersPathExpansionExplodePrimitive { + get(options?: PathParametersPathExpansionExplodePrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersPathExpansionExplodePrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersPathExpansionExplodePrimitiveParameters = RequestParameters; + +export declare interface PathParametersPathExpansionExplodeRecord { + get(options?: PathParametersPathExpansionExplodeRecordParameters): StreamableMethod; +} + +export declare interface PathParametersPathExpansionExplodeRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersPathExpansionExplodeRecordParameters = RequestParameters; + +export declare interface PathParametersPathExpansionStandardArray { + get(options?: PathParametersPathExpansionStandardArrayParameters): StreamableMethod; +} + +export declare interface PathParametersPathExpansionStandardArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersPathExpansionStandardArrayParameters = RequestParameters; + +export declare interface PathParametersPathExpansionStandardPrimitive { + get(options?: PathParametersPathExpansionStandardPrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersPathExpansionStandardPrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersPathExpansionStandardPrimitiveParameters = RequestParameters; + +export declare interface PathParametersPathExpansionStandardRecord { + get(options?: PathParametersPathExpansionStandardRecordParameters): StreamableMethod; +} + +export declare interface PathParametersPathExpansionStandardRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersPathExpansionStandardRecordParameters = RequestParameters; + +export declare interface PathParametersReservedExpansionAnnotation { + get(options?: PathParametersReservedExpansionAnnotationParameters): StreamableMethod; +} + +export declare interface PathParametersReservedExpansionAnnotation204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersReservedExpansionAnnotationParameters = RequestParameters; + +export declare interface PathParametersReservedExpansionAnnotationParamPathParam { + value: string; + allowReserved: true; +} + +export declare interface PathParametersReservedExpansionTemplate { + get(options?: PathParametersReservedExpansionTemplateParameters): StreamableMethod; +} + +export declare interface PathParametersReservedExpansionTemplate204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersReservedExpansionTemplateParameters = RequestParameters; + +export declare interface PathParametersReservedExpansionTemplateParamPathParam { + value: string; + allowReserved: true; +} + +export declare interface PathParametersSimpleExpansionExplodeArray { + get(options?: PathParametersSimpleExpansionExplodeArrayParameters): StreamableMethod; +} + +export declare interface PathParametersSimpleExpansionExplodeArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersSimpleExpansionExplodeArrayParameters = RequestParameters; + +export declare interface PathParametersSimpleExpansionExplodePrimitive { + get(options?: PathParametersSimpleExpansionExplodePrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersSimpleExpansionExplodePrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersSimpleExpansionExplodePrimitiveParameters = RequestParameters; + +export declare interface PathParametersSimpleExpansionExplodeRecord { + get(options?: PathParametersSimpleExpansionExplodeRecordParameters): StreamableMethod; +} + +export declare interface PathParametersSimpleExpansionExplodeRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersSimpleExpansionExplodeRecordParameters = RequestParameters; + +export declare interface PathParametersSimpleExpansionStandardArray { + get(options?: PathParametersSimpleExpansionStandardArrayParameters): StreamableMethod; +} + +export declare interface PathParametersSimpleExpansionStandardArray204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersSimpleExpansionStandardArrayParameters = RequestParameters; + +export declare interface PathParametersSimpleExpansionStandardPrimitive { + get(options?: PathParametersSimpleExpansionStandardPrimitiveParameters): StreamableMethod; +} + +export declare interface PathParametersSimpleExpansionStandardPrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersSimpleExpansionStandardPrimitiveParameters = RequestParameters; + +export declare interface PathParametersSimpleExpansionStandardRecord { + get(options?: PathParametersSimpleExpansionStandardRecordParameters): StreamableMethod; +} + +export declare interface PathParametersSimpleExpansionStandardRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersSimpleExpansionStandardRecordParameters = RequestParameters; + +export declare interface PathParametersTemplateOnly { + get(options?: PathParametersTemplateOnlyParameters): StreamableMethod; +} + +export declare interface PathParametersTemplateOnly204Response extends HttpResponse { + status: "204"; +} + +export declare type PathParametersTemplateOnlyParameters = RequestParameters; + +export declare interface QueryParametersAnnotationOnly { + get(options: QueryParametersAnnotationOnlyParameters): StreamableMethod; +} + +export declare interface QueryParametersAnnotationOnly204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersAnnotationOnlyParameters = QueryParametersAnnotationOnlyQueryParam & RequestParameters; + +export declare interface QueryParametersAnnotationOnlyQueryParam { + queryParameters: QueryParametersAnnotationOnlyQueryParamProperties; +} + +export declare interface QueryParametersAnnotationOnlyQueryParamProperties { + param: string; +} + +export declare interface QueryParametersExplicit { + get(options: QueryParametersExplicitParameters): StreamableMethod; +} + +export declare interface QueryParametersExplicit204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersExplicitParameters = QueryParametersExplicitQueryParam & RequestParameters; + +export declare interface QueryParametersExplicitQueryParam { + queryParameters: QueryParametersExplicitQueryParamProperties; +} + +export declare interface QueryParametersExplicitQueryParamProperties { + param: string; +} + +export declare interface QueryParametersQueryContinuationExplodeArray { + get(options: QueryParametersQueryContinuationExplodeArrayParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryContinuationExplodeArray204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryContinuationExplodeArrayParameters = QueryParametersQueryContinuationExplodeArrayQueryParam & RequestParameters; + +export declare interface QueryParametersQueryContinuationExplodeArrayParamQueryParam { + value: string[]; + explode: true; + style: "form"; +} + +export declare interface QueryParametersQueryContinuationExplodeArrayQueryParam { + queryParameters: QueryParametersQueryContinuationExplodeArrayQueryParamProperties; +} + +export declare interface QueryParametersQueryContinuationExplodeArrayQueryParamProperties { + param: QueryParametersQueryContinuationExplodeArrayParamQueryParam; +} + +export declare interface QueryParametersQueryContinuationExplodePrimitive { + get(options: QueryParametersQueryContinuationExplodePrimitiveParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryContinuationExplodePrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryContinuationExplodePrimitiveParameters = QueryParametersQueryContinuationExplodePrimitiveQueryParam & RequestParameters; + +export declare interface QueryParametersQueryContinuationExplodePrimitiveQueryParam { + queryParameters: QueryParametersQueryContinuationExplodePrimitiveQueryParamProperties; +} + +export declare interface QueryParametersQueryContinuationExplodePrimitiveQueryParamProperties { + param: string; +} + +export declare interface QueryParametersQueryContinuationExplodeRecord { + get(options: QueryParametersQueryContinuationExplodeRecordParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryContinuationExplodeRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryContinuationExplodeRecordParameters = QueryParametersQueryContinuationExplodeRecordQueryParam & RequestParameters; + +export declare interface QueryParametersQueryContinuationExplodeRecordParamQueryParam { + value: Record; + explode: true; + style: "form"; +} + +export declare interface QueryParametersQueryContinuationExplodeRecordQueryParam { + queryParameters: QueryParametersQueryContinuationExplodeRecordQueryParamProperties; +} + +export declare interface QueryParametersQueryContinuationExplodeRecordQueryParamProperties { + param: QueryParametersQueryContinuationExplodeRecordParamQueryParam; +} + +export declare interface QueryParametersQueryContinuationStandardArray { + get(options: QueryParametersQueryContinuationStandardArrayParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryContinuationStandardArray204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryContinuationStandardArrayParameters = QueryParametersQueryContinuationStandardArrayQueryParam & RequestParameters; + +export declare interface QueryParametersQueryContinuationStandardArrayParamQueryParam { + value: string[]; + explode: false; + style: "form"; +} + +export declare interface QueryParametersQueryContinuationStandardArrayQueryParam { + queryParameters: QueryParametersQueryContinuationStandardArrayQueryParamProperties; +} + +export declare interface QueryParametersQueryContinuationStandardArrayQueryParamProperties { + param: string[] | QueryParametersQueryContinuationStandardArrayParamQueryParam; +} + +export declare interface QueryParametersQueryContinuationStandardPrimitive { + get(options: QueryParametersQueryContinuationStandardPrimitiveParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryContinuationStandardPrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryContinuationStandardPrimitiveParameters = QueryParametersQueryContinuationStandardPrimitiveQueryParam & RequestParameters; + +export declare interface QueryParametersQueryContinuationStandardPrimitiveQueryParam { + queryParameters: QueryParametersQueryContinuationStandardPrimitiveQueryParamProperties; +} + +export declare interface QueryParametersQueryContinuationStandardPrimitiveQueryParamProperties { + param: string; +} + +export declare interface QueryParametersQueryContinuationStandardRecord { + get(options: QueryParametersQueryContinuationStandardRecordParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryContinuationStandardRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryContinuationStandardRecordParameters = QueryParametersQueryContinuationStandardRecordQueryParam & RequestParameters; + +export declare interface QueryParametersQueryContinuationStandardRecordParamQueryParam { + value: Record; + explode: false; + style: "form"; +} + +export declare interface QueryParametersQueryContinuationStandardRecordQueryParam { + queryParameters: QueryParametersQueryContinuationStandardRecordQueryParamProperties; +} + +export declare interface QueryParametersQueryContinuationStandardRecordQueryParamProperties { + param: QueryParametersQueryContinuationStandardRecordParamQueryParam; +} + +export declare interface QueryParametersQueryExpansionExplodeArray { + get(options: QueryParametersQueryExpansionExplodeArrayParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryExpansionExplodeArray204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryExpansionExplodeArrayParameters = QueryParametersQueryExpansionExplodeArrayQueryParam & RequestParameters; + +export declare interface QueryParametersQueryExpansionExplodeArrayParamQueryParam { + value: string[]; + explode: true; + style: "form"; +} + +export declare interface QueryParametersQueryExpansionExplodeArrayQueryParam { + queryParameters: QueryParametersQueryExpansionExplodeArrayQueryParamProperties; +} + +export declare interface QueryParametersQueryExpansionExplodeArrayQueryParamProperties { + param: QueryParametersQueryExpansionExplodeArrayParamQueryParam; +} + +export declare interface QueryParametersQueryExpansionExplodePrimitive { + get(options: QueryParametersQueryExpansionExplodePrimitiveParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryExpansionExplodePrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryExpansionExplodePrimitiveParameters = QueryParametersQueryExpansionExplodePrimitiveQueryParam & RequestParameters; + +export declare interface QueryParametersQueryExpansionExplodePrimitiveQueryParam { + queryParameters: QueryParametersQueryExpansionExplodePrimitiveQueryParamProperties; +} + +export declare interface QueryParametersQueryExpansionExplodePrimitiveQueryParamProperties { + param: string; +} + +export declare interface QueryParametersQueryExpansionExplodeRecord { + get(options: QueryParametersQueryExpansionExplodeRecordParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryExpansionExplodeRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryExpansionExplodeRecordParameters = QueryParametersQueryExpansionExplodeRecordQueryParam & RequestParameters; + +export declare interface QueryParametersQueryExpansionExplodeRecordParamQueryParam { + value: Record; + explode: true; + style: "form"; +} + +export declare interface QueryParametersQueryExpansionExplodeRecordQueryParam { + queryParameters: QueryParametersQueryExpansionExplodeRecordQueryParamProperties; +} + +export declare interface QueryParametersQueryExpansionExplodeRecordQueryParamProperties { + param: QueryParametersQueryExpansionExplodeRecordParamQueryParam; +} + +export declare interface QueryParametersQueryExpansionStandardArray { + get(options: QueryParametersQueryExpansionStandardArrayParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryExpansionStandardArray204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryExpansionStandardArrayParameters = QueryParametersQueryExpansionStandardArrayQueryParam & RequestParameters; + +export declare interface QueryParametersQueryExpansionStandardArrayParamQueryParam { + value: string[]; + explode: false; + style: "form"; +} + +export declare interface QueryParametersQueryExpansionStandardArrayQueryParam { + queryParameters: QueryParametersQueryExpansionStandardArrayQueryParamProperties; +} + +export declare interface QueryParametersQueryExpansionStandardArrayQueryParamProperties { + param: string[] | QueryParametersQueryExpansionStandardArrayParamQueryParam; +} + +export declare interface QueryParametersQueryExpansionStandardPrimitive { + get(options: QueryParametersQueryExpansionStandardPrimitiveParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryExpansionStandardPrimitive204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryExpansionStandardPrimitiveParameters = QueryParametersQueryExpansionStandardPrimitiveQueryParam & RequestParameters; + +export declare interface QueryParametersQueryExpansionStandardPrimitiveQueryParam { + queryParameters: QueryParametersQueryExpansionStandardPrimitiveQueryParamProperties; +} + +export declare interface QueryParametersQueryExpansionStandardPrimitiveQueryParamProperties { + param: string; +} + +export declare interface QueryParametersQueryExpansionStandardRecord { + get(options: QueryParametersQueryExpansionStandardRecordParameters): StreamableMethod; +} + +export declare interface QueryParametersQueryExpansionStandardRecord204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersQueryExpansionStandardRecordParameters = QueryParametersQueryExpansionStandardRecordQueryParam & RequestParameters; + +export declare interface QueryParametersQueryExpansionStandardRecordParamQueryParam { + value: Record; + explode: false; + style: "form"; +} + +export declare interface QueryParametersQueryExpansionStandardRecordQueryParam { + queryParameters: QueryParametersQueryExpansionStandardRecordQueryParamProperties; +} + +export declare interface QueryParametersQueryExpansionStandardRecordQueryParamProperties { + param: QueryParametersQueryExpansionStandardRecordParamQueryParam; +} + +export declare interface QueryParametersTemplateOnly { + get(options: QueryParametersTemplateOnlyParameters): StreamableMethod; +} + +export declare interface QueryParametersTemplateOnly204Response extends HttpResponse { + status: "204"; +} + +export declare type QueryParametersTemplateOnlyParameters = QueryParametersTemplateOnlyQueryParam & RequestParameters; + +export declare interface QueryParametersTemplateOnlyQueryParam { + queryParameters: QueryParametersTemplateOnlyQueryParamProperties; +} + +export declare interface QueryParametersTemplateOnlyQueryParamProperties { + param: string; +} + +export declare interface Routes { + (path: "/routes/fixed"): Fixed; + (path: "/routes/path/template-only/{param}", param: string): PathParametersTemplateOnly; + (path: "/routes/path/explicit/{param}", param: string): PathParametersExplicit; + (path: "/routes/path/annotation-only/{param}", param: string): PathParametersAnnotationOnly; + (path: "/routes/path/reserved-expansion/template/{param}", param: PathParametersReservedExpansionTemplateParamPathParam): PathParametersReservedExpansionTemplate; + (path: "/routes/path/reserved-expansion/annotation/{param}", param: PathParametersReservedExpansionAnnotationParamPathParam): PathParametersReservedExpansionAnnotation; + (path: "/routes/path/simple/standard/primitive{param}", param: string): PathParametersSimpleExpansionStandardPrimitive; + (path: "/routes/path/simple/standard/array{param}", param: string[]): PathParametersSimpleExpansionStandardArray; + (path: "/routes/path/simple/standard/record{param}", param: Record): PathParametersSimpleExpansionStandardRecord; + (path: "/routes/path/simple/explode/primitive{param}", param: string): PathParametersSimpleExpansionExplodePrimitive; + (path: "/routes/path/simple/explode/array{param}", param: string[]): PathParametersSimpleExpansionExplodeArray; + (path: "/routes/path/simple/explode/record{param}", param: Record): PathParametersSimpleExpansionExplodeRecord; + (path: "/routes/path/path/standard/primitive{param}", param: string): PathParametersPathExpansionStandardPrimitive; + (path: "/routes/path/path/standard/array{param}", param: string[]): PathParametersPathExpansionStandardArray; + (path: "/routes/path/path/standard/record{param}", param: Record): PathParametersPathExpansionStandardRecord; + (path: "/routes/path/path/explode/primitive{param}", param: string): PathParametersPathExpansionExplodePrimitive; + (path: "/routes/path/path/explode/array{param}", param: string[]): PathParametersPathExpansionExplodeArray; + (path: "/routes/path/path/explode/record{param}", param: Record): PathParametersPathExpansionExplodeRecord; + (path: "/routes/path/label/standard/primitive{param}", param: string): PathParametersLabelExpansionStandardPrimitive; + (path: "/routes/path/label/standard/array{param}", param: string[]): PathParametersLabelExpansionStandardArray; + (path: "/routes/path/label/standard/record{param}", param: Record): PathParametersLabelExpansionStandardRecord; + (path: "/routes/path/label/explode/primitive{param}", param: string): PathParametersLabelExpansionExplodePrimitive; + (path: "/routes/path/label/explode/array{param}", param: string[]): PathParametersLabelExpansionExplodeArray; + (path: "/routes/path/label/explode/record{param}", param: Record): PathParametersLabelExpansionExplodeRecord; + (path: "/routes/path/matrix/standard/primitive{param}", param: string): PathParametersMatrixExpansionStandardPrimitive; + (path: "/routes/path/matrix/standard/array{param}", param: string[]): PathParametersMatrixExpansionStandardArray; + (path: "/routes/path/matrix/standard/record{param}", param: Record): PathParametersMatrixExpansionStandardRecord; + (path: "/routes/path/matrix/explode/primitive{param}", param: string): PathParametersMatrixExpansionExplodePrimitive; + (path: "/routes/path/matrix/explode/array{param}", param: string[]): PathParametersMatrixExpansionExplodeArray; + (path: "/routes/path/matrix/explode/record{param}", param: Record): PathParametersMatrixExpansionExplodeRecord; + (path: "/routes/query/template-only"): QueryParametersTemplateOnly; + (path: "/routes/query/explicit"): QueryParametersExplicit; + (path: "/routes/query/annotation-only"): QueryParametersAnnotationOnly; + (path: "/routes/query/query-expansion/standard/primitive"): QueryParametersQueryExpansionStandardPrimitive; + (path: "/routes/query/query-expansion/standard/array"): QueryParametersQueryExpansionStandardArray; + (path: "/routes/query/query-expansion/standard/record"): QueryParametersQueryExpansionStandardRecord; + (path: "/routes/query/query-expansion/explode/primitive"): QueryParametersQueryExpansionExplodePrimitive; + (path: "/routes/query/query-expansion/explode/array"): QueryParametersQueryExpansionExplodeArray; + (path: "/routes/query/query-expansion/explode/record"): QueryParametersQueryExpansionExplodeRecord; + (path: "/routes/query/query-continuation/standard/primitive?fixed=true"): QueryParametersQueryContinuationStandardPrimitive; + (path: "/routes/query/query-continuation/standard/array?fixed=true"): QueryParametersQueryContinuationStandardArray; + (path: "/routes/query/query-continuation/standard/record?fixed=true"): QueryParametersQueryContinuationStandardRecord; + (path: "/routes/query/query-continuation/explode/primitive?fixed=true"): QueryParametersQueryContinuationExplodePrimitive; + (path: "/routes/query/query-continuation/explode/array?fixed=true"): QueryParametersQueryContinuationExplodeArray; + (path: "/routes/query/query-continuation/explode/record?fixed=true"): QueryParametersQueryContinuationExplodeRecord; + (path: "/routes/in-interface/fixed"): InInterfaceFixed; +} + +export declare type RoutesClient = Client & { + path: Routes; +}; + +export declare interface RoutesClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/routes/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/routes/tspconfig.yaml new file mode 100644 index 0000000000..4a4baca6c8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/routes/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: true + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: RoutesClient + packageDetails: + name: "@msinternal/routes" + description: "Routes Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/default/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/src/index.d.ts new file mode 100644 index 0000000000..42c1c812d7 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/src/index.d.ts @@ -0,0 +1,51 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: SerializationEncodedNameJsonClientOptions): SerializationEncodedNameJsonClient; +export default createClient; + +export declare interface JsonEncodedNameModel { + wireName: boolean; +} + +export declare interface JsonEncodedNameModelOutput { + wireName: boolean; +} + +export declare interface PropertyGet200Response extends HttpResponse { + status: "200"; + body: JsonEncodedNameModelOutput; +} + +export declare type PropertyGetParameters = RequestParameters; + +export declare interface PropertySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface PropertySendBodyParam { + body: JsonEncodedNameModel; +} + +export declare type PropertySendParameters = PropertySendBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/serialization/encoded-name/json/property"): Send; +} + +export declare interface Send { + post(options: PropertySendParameters): StreamableMethod; + get(options?: PropertyGetParameters): StreamableMethod; +} + +export declare type SerializationEncodedNameJsonClient = Client & { + path: Routes; +}; + +export declare interface SerializationEncodedNameJsonClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/tspconfig.yaml new file mode 100644 index 0000000000..22393ce373 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/serialization/encoded-name/json/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: SerializationEncodedNameJsonClient + enableOperationGroup: true + packageDetails: + name: "@msinternal/serialization-encoded-name-json" + description: "Serialization Encoded Name Json Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/src/index.d.ts new file mode 100644 index 0000000000..d83e5e08ec --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/src/index.d.ts @@ -0,0 +1,31 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, options?: NotDefinedParamInServerEndpointClientOptions): NotDefinedParamInServerEndpointClient; +export default createClient; + +export declare type NotDefinedParamInServerEndpointClient = Client & { + path: Routes; +}; + +export declare interface NotDefinedParamInServerEndpointClientOptions extends ClientOptions { +} + +export declare interface Routes { + (path: "/server/endpoint/not-defined/valid"): Valid; +} + +export declare interface Valid { + head(options?: ValidParameters): StreamableMethod; +} + +export declare interface Valid200Response extends HttpResponse { + status: "200"; +} + +export declare type ValidParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/tspconfig.yaml new file mode 100644 index 0000000000..9a2f805705 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/endpoint/not-defined/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: NotDefinedParamInServerEndpointClient + packageDetails: + name: "@msinternal/notdefinedparam" + description: "NotDefinedParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/src/index.d.ts new file mode 100644 index 0000000000..c2d424a64d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/src/index.d.ts @@ -0,0 +1,45 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, { apiVersion, ...options }?: MultipleParamInServerPathClientOptions): MultipleParamInServerPathClient; +export default createClient; + +export declare type MultipleParamInServerPathClient = Client & { + path: Routes; +}; + +export declare interface MultipleParamInServerPathClientOptions extends ClientOptions { + apiVersion?: Versions; +} + +export declare interface NoOperationParams { + get(options?: NoOperationParamsParameters): StreamableMethod; +} + +export declare interface NoOperationParams204Response extends HttpResponse { + status: "204"; +} + +export declare type NoOperationParamsParameters = RequestParameters; + +export declare interface Routes { + (path: "/"): NoOperationParams; + (path: "/{keyword}", keyword: string): WithOperationPathParam; +} + +export declare type Versions = "v1.0"; + +export declare interface WithOperationPathParam { + get(options?: WithOperationPathParamParameters): StreamableMethod; +} + +export declare interface WithOperationPathParam204Response extends HttpResponse { + status: "204"; +} + +export declare type WithOperationPathParamParameters = RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/tspconfig.yaml new file mode 100644 index 0000000000..97c3d19888 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/path/multiple/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: MultipleParamInServerPathClient + packageDetails: + name: "@msinternal/multipleparam" + description: "MultipleParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/server/path/single/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/server/path/single/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/path/single/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/server/path/single/src/index.d.ts new file mode 100644 index 0000000000..e868628331 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/path/single/src/index.d.ts @@ -0,0 +1,31 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, options?: SingleParamInServerPathClientOptions): SingleParamInServerPathClient; +export default createClient; + +export declare interface MyOp { + head(options?: MyOpParameters): StreamableMethod; +} + +export declare interface MyOp200Response extends HttpResponse { + status: "200"; +} + +export declare type MyOpParameters = RequestParameters; + +export declare interface Routes { + (path: "/server/path/single/myOp"): MyOp; +} + +export declare type SingleParamInServerPathClient = Client & { + path: Routes; +}; + +export declare interface SingleParamInServerPathClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/path/single/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/server/path/single/tspconfig.yaml new file mode 100644 index 0000000000..770600e818 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/path/single/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: SingleParamInServerPathClient + packageDetails: + name: "@msinternal/singleparam" + description: "SingleParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/payload/pageable/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/src/index.d.ts new file mode 100644 index 0000000000..02f064b0bd --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/src/index.d.ts @@ -0,0 +1,61 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, options?: NotVersionedParamInServerVersionsClientOptions): NotVersionedParamInServerVersionsClient; +export default createClient; + +export declare type NotVersionedParamInServerVersionsClient = Client & { + path: Routes; +}; + +export declare interface NotVersionedParamInServerVersionsClientOptions extends ClientOptions { +} + +export declare interface Routes { + (path: "/server/versions/not-versioned/without-api-version"): WithoutApiVersion; + (path: "/server/versions/not-versioned/with-query-api-version"): WithQueryApiVersion; + (path: "/server/versions/not-versioned/with-path-api-version/{apiVersion}", apiVersion: string): WithPathApiVersion; +} + +export declare interface WithoutApiVersion { + head(options?: WithoutApiVersionParameters): StreamableMethod; +} + +export declare interface WithoutApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithoutApiVersionParameters = RequestParameters; + +export declare interface WithPathApiVersion { + head(options?: WithPathApiVersionParameters): StreamableMethod; +} + +export declare interface WithPathApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithPathApiVersionParameters = RequestParameters; + +export declare interface WithQueryApiVersion { + head(options?: WithQueryApiVersionParameters): StreamableMethod; +} + +export declare interface WithQueryApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithQueryApiVersionParameters = WithQueryApiVersionQueryParam & RequestParameters; + +export declare interface WithQueryApiVersionQueryParam { + queryParameters: WithQueryApiVersionQueryParamProperties; +} + +export declare interface WithQueryApiVersionQueryParamProperties { + "api-version": string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/tspconfig.yaml new file mode 100644 index 0000000000..319d46c4d6 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/versions/not-versioned/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: NotVersionedParamInServerVersionsClient + packageDetails: + name: "@msinternal/not-versioned" + description: "Not-versioned Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/src/index.d.ts new file mode 100644 index 0000000000..9f1d80128d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/src/index.d.ts @@ -0,0 +1,80 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, options?: VersionedParamInServerVersionsClientOptions): VersionedParamInServerVersionsClient; +export default createClient; + +export declare interface Routes { + (path: "/server/versions/versioned/without-api-version"): WithoutApiVersion; + (path: "/server/versions/versioned/with-query-api-version"): WithQueryApiVersion; + (path: "/server/versions/versioned/with-path-api-version/{apiVersion}", apiVersion: string): WithPathApiVersion; + (path: "/server/versions/versioned/with-query-old-api-version"): WithQueryOldApiVersion; +} + +export declare type VersionedParamInServerVersionsClient = Client & { + path: Routes; +}; + +export declare interface VersionedParamInServerVersionsClientOptions extends ClientOptions { +} + +export declare interface WithoutApiVersion { + head(options?: WithoutApiVersionParameters): StreamableMethod; +} + +export declare interface WithoutApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithoutApiVersionParameters = RequestParameters; + +export declare interface WithPathApiVersion { + head(options?: WithPathApiVersionParameters): StreamableMethod; +} + +export declare interface WithPathApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithPathApiVersionParameters = RequestParameters; + +export declare interface WithQueryApiVersion { + head(options?: WithQueryApiVersionParameters): StreamableMethod; +} + +export declare interface WithQueryApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithQueryApiVersionParameters = WithQueryApiVersionQueryParam & RequestParameters; + +export declare interface WithQueryApiVersionQueryParam { + queryParameters: WithQueryApiVersionQueryParamProperties; +} + +export declare interface WithQueryApiVersionQueryParamProperties { + "api-version": string; +} + +export declare interface WithQueryOldApiVersion { + head(options?: WithQueryOldApiVersionParameters): StreamableMethod; +} + +export declare interface WithQueryOldApiVersion200Response extends HttpResponse { + status: "200"; +} + +export declare type WithQueryOldApiVersionParameters = WithQueryOldApiVersionQueryParam & RequestParameters; + +export declare interface WithQueryOldApiVersionQueryParam { + queryParameters: WithQueryOldApiVersionQueryParamProperties; +} + +export declare interface WithQueryOldApiVersionQueryParamProperties { + "api-version": string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/tspconfig.yaml new file mode 100644 index 0000000000..c300d625bf --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/server/versions/versioned/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersionedParamInServerVersionsClient + packageDetails: + name: "@msinternal/versioned" + description: "Versioned Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/shared-route/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/shared-route/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/shared-route/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/shared-route/src/index.d.ts new file mode 100644 index 0000000000..6f63f54f83 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/shared-route/src/index.d.ts @@ -0,0 +1,222 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient($host: string, options?: SharedRouteClientOptions): SharedRouteClient; +export default createClient; + +export declare interface ErrorModelOutput { + code: number; + message: string; +} + +export declare function isUnexpected(response: ListBySubscription202Response | ListBySubscriptionDefaultResponse): response is ListBySubscriptionDefaultResponse; + +export declare function isUnexpected(response: ListByResourceGroup200Response | ListByResourceGroupDefaultResponse): response is ListByResourceGroupDefaultResponse; + +export declare interface ListByResourceGroup200Response extends HttpResponse { + status: "200"; + body: Array; +} + +export declare interface ListByResourceGroupBodyParam { + body: Resource; +} + +export declare interface ListByResourceGroupDefaultResponse extends HttpResponse { + status: string; + body: ErrorModelOutput; +} + +export declare type ListByResourceGroupParameters = ListByResourceGroupQueryParam & ListByResourceGroupBodyParam & RequestParameters; + +export declare interface ListByResourceGroupQueryParam { + queryParameters: ListByResourceGroupQueryParamProperties; +} + +export declare interface ListByResourceGroupQueryParamProperties { + filter: "resourceGroup"; +} + +export declare interface ListBySubscription { + post(options: ListBySubscriptionParameters): StreamableMethod; + post(options: ListByResourceGroupParameters): StreamableMethod; +} + +export declare interface ListBySubscription202Response extends HttpResponse { + status: "202"; + body: ResourceOutput; +} + +export declare interface ListBySubscriptionBodyParam { + body: Resource; +} + +export declare interface ListBySubscriptionDefaultResponse extends HttpResponse { + status: string; + body: ErrorModelOutput; +} + +export declare interface ListBySubscriptionHeaderParam { + headers: RawHttpHeadersInput & ListBySubscriptionHeaders; +} + +export declare interface ListBySubscriptionHeaders { + filter: "subscription"; +} + +export declare type ListBySubscriptionParameters = ListBySubscriptionHeaderParam & ListBySubscriptionBodyParam & RequestParameters; + +export declare interface ProcessInt { + post(options: ProcessIntParameters): StreamableMethod; + post(options: ProcessStringParameters): StreamableMethod; +} + +export declare interface ProcessInt200Response extends HttpResponse { + status: "200"; + body: number; +} + +export declare interface ProcessIntBodyParam { + body: number; +} + +export declare type ProcessIntParameters = ProcessIntQueryParam & ProcessIntBodyParam & RequestParameters; + +export declare interface ProcessIntQueryParam { + queryParameters: ProcessIntQueryParamProperties; +} + +export declare interface ProcessIntQueryParamProperties { + options: string; +} + +export declare interface ProcessString200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare interface ProcessStringBodyParam { + body: string; +} + +export declare type ProcessStringParameters = ProcessStringQueryParam & ProcessStringBodyParam & RequestParameters; + +export declare interface ProcessStringQueryParam { + queryParameters: ProcessStringQueryParamProperties; +} + +export declare interface ProcessStringQueryParamProperties { + options: string; +} + +export declare interface Resource { + id: string; +} + +export declare interface ResourceOutput { + id: string; +} + +export declare interface ReturnsInt { + post(options: ReturnsIntParameters): StreamableMethod; + post(options: ReturnsStringParameters): StreamableMethod; +} + +export declare interface ReturnsInt200Response extends HttpResponse { + status: "200"; + body: number; +} + +export declare interface ReturnsIntBodyParam { + body: Resource; +} + +export declare type ReturnsIntParameters = ReturnsIntQueryParam & ReturnsIntBodyParam & RequestParameters; + +export declare interface ReturnsIntQueryParam { + queryParameters: ReturnsIntQueryParamProperties; +} + +export declare interface ReturnsIntQueryParamProperties { + options: string; +} + +export declare interface ReturnsString200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare interface ReturnsStringBodyParam { + body: Resource; +} + +export declare type ReturnsStringParameters = ReturnsStringQueryParam & ReturnsStringBodyParam & RequestParameters; + +export declare interface ReturnsStringQueryParam { + queryParameters: ReturnsStringQueryParamProperties; +} + +export declare interface ReturnsStringQueryParamProperties { + options: string; +} + +export declare interface Routes { + (path: "/sharedroute/query"): ListBySubscription; + (path: "/sharedroute/request-body"): UpdateInt; + (path: "/sharedroute/response-body"): ReturnsInt; + (path: "/sharedroute/request-response"): ProcessInt; +} + +export declare type SharedRouteClient = Client & { + path: Routes; +}; + +export declare interface SharedRouteClientOptions extends ClientOptions { +} + +export declare interface UpdateInt { + post(options: UpdateIntParameters): StreamableMethod; + post(options: UpdateStringParameters): StreamableMethod; +} + +export declare interface UpdateInt204Response extends HttpResponse { + status: "204"; +} + +export declare interface UpdateIntBodyParam { + body: number; +} + +export declare type UpdateIntParameters = UpdateIntQueryParam & UpdateIntBodyParam & RequestParameters; + +export declare interface UpdateIntQueryParam { + queryParameters: UpdateIntQueryParamProperties; +} + +export declare interface UpdateIntQueryParamProperties { + options: string; +} + +export declare interface UpdateString204Response extends HttpResponse { + status: "204"; +} + +export declare interface UpdateStringBodyParam { + body: string; +} + +export declare type UpdateStringParameters = UpdateStringQueryParam & UpdateStringBodyParam & RequestParameters; + +export declare interface UpdateStringQueryParam { + queryParameters: UpdateStringQueryParamProperties; +} + +export declare interface UpdateStringQueryParamProperties { + options: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/shared-route/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/shared-route/tspconfig.yaml new file mode 100644 index 0000000000..f255e019cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/shared-route/tspconfig.yaml @@ -0,0 +1,12 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/media-types" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/.gitignore similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/src/index.d.ts new file mode 100644 index 0000000000..7506462e55 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/src/index.d.ts @@ -0,0 +1,47 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: RepeatabilityClientOptions): RepeatabilityClient; +export default createClient; + +export declare interface ImmediateSuccess { + post(options: ImmediateSuccessParameters): StreamableMethod; +} + +export declare interface ImmediateSuccess204Headers { + "repeatability-result"?: "accepted" | "rejected"; +} + +export declare interface ImmediateSuccess204Response extends HttpResponse { + status: "204"; + headers: RawHttpHeaders & ImmediateSuccess204Headers; +} + +export declare interface ImmediateSuccessHeaderParam { + headers: RawHttpHeadersInput & ImmediateSuccessHeaders; +} + +export declare interface ImmediateSuccessHeaders { + "Repeatability-Request-ID": string; + "Repeatability-First-Sent": string; +} + +export declare type ImmediateSuccessParameters = ImmediateSuccessHeaderParam & RequestParameters; + +export declare type RepeatabilityClient = Client & { + path: Routes; +}; + +export declare interface RepeatabilityClientOptions extends ClientOptions { +} + +export declare interface Routes { + (path: "/special-headers/repeatability/immediateSuccess"): ImmediateSuccess; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/tspconfig.yaml new file mode 100644 index 0000000000..80b27a89b6 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/special-headers/repeatability/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/repeatable-header" diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/special-words/.gitignore similarity index 100% rename from packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/special-words/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/special-words/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/special-words/src/index.d.ts new file mode 100644 index 0000000000..92a7505959 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/special-words/src/index.d.ts @@ -0,0 +1,1675 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface And { + name: string; +} + +export declare interface As { + name: string; +} + +export declare interface Assert { + name: string; +} + +export declare interface Async { + name: string; +} + +export declare interface Await { + name: string; +} + +export declare interface Break { + name: string; +} + +export declare interface Class { + name: string; +} + +export declare interface Constructor { + name: string; +} + +export declare interface Continue { + name: string; +} + +declare function createClient(options?: SpecialWordsClientOptions): SpecialWordsClient; +export default createClient; + +export declare interface Def { + name: string; +} + +export declare interface Del { + name: string; +} + +export declare interface Elif { + name: string; +} + +export declare interface Else { + name: string; +} + +export declare interface Except { + name: string; +} + +export declare interface Exec { + name: string; +} + +export declare interface Finally { + name: string; +} + +export declare interface For { + name: string; +} + +export declare interface From { + name: string; +} + +export declare interface GlobalModel { + name: string; +} + +export declare interface If { + name: string; +} + +export declare interface Import { + name: string; +} + +export declare interface In { + name: string; +} + +export declare interface Is { + name: string; +} + +export declare interface Lambda { + name: string; +} + +export declare interface ModelPropertiesSameAsModel { + post(options: ModelPropertiesSameAsModelParameters): StreamableMethod; +} + +export declare interface ModelPropertiesSameAsModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelPropertiesSameAsModelBodyParam { + body: SameAsModel; +} + +export declare type ModelPropertiesSameAsModelParameters = ModelPropertiesSameAsModelBodyParam & RequestParameters; + +export declare interface ModelsWithAnd { + post(options: ModelsWithAndParameters): StreamableMethod; +} + +export declare interface ModelsWithAnd204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithAndBodyParam { + body: And; +} + +export declare type ModelsWithAndParameters = ModelsWithAndBodyParam & RequestParameters; + +export declare interface ModelsWithAs { + post(options: ModelsWithAsParameters): StreamableMethod; +} + +export declare interface ModelsWithAs204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithAsBodyParam { + body: As; +} + +export declare type ModelsWithAsParameters = ModelsWithAsBodyParam & RequestParameters; + +export declare interface ModelsWithAssert { + post(options: ModelsWithAssertParameters): StreamableMethod; +} + +export declare interface ModelsWithAssert204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithAssertBodyParam { + body: Assert; +} + +export declare type ModelsWithAssertParameters = ModelsWithAssertBodyParam & RequestParameters; + +export declare interface ModelsWithAsync { + post(options: ModelsWithAsyncParameters): StreamableMethod; +} + +export declare interface ModelsWithAsync204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithAsyncBodyParam { + body: Async; +} + +export declare type ModelsWithAsyncParameters = ModelsWithAsyncBodyParam & RequestParameters; + +export declare interface ModelsWithAwait { + post(options: ModelsWithAwaitParameters): StreamableMethod; +} + +export declare interface ModelsWithAwait204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithAwaitBodyParam { + body: Await; +} + +export declare type ModelsWithAwaitParameters = ModelsWithAwaitBodyParam & RequestParameters; + +export declare interface ModelsWithBreak { + post(options: ModelsWithBreakParameters): StreamableMethod; +} + +export declare interface ModelsWithBreak204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithBreakBodyParam { + body: Break; +} + +export declare type ModelsWithBreakParameters = ModelsWithBreakBodyParam & RequestParameters; + +export declare interface ModelsWithClass { + post(options: ModelsWithClassParameters): StreamableMethod; +} + +export declare interface ModelsWithClass204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithClassBodyParam { + body: Class; +} + +export declare type ModelsWithClassParameters = ModelsWithClassBodyParam & RequestParameters; + +export declare interface ModelsWithConstructor { + post(options: ModelsWithConstructorParameters): StreamableMethod; +} + +export declare interface ModelsWithConstructor204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithConstructorBodyParam { + body: Constructor; +} + +export declare type ModelsWithConstructorParameters = ModelsWithConstructorBodyParam & RequestParameters; + +export declare interface ModelsWithContinue { + post(options: ModelsWithContinueParameters): StreamableMethod; +} + +export declare interface ModelsWithContinue204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithContinueBodyParam { + body: Continue; +} + +export declare type ModelsWithContinueParameters = ModelsWithContinueBodyParam & RequestParameters; + +export declare interface ModelsWithDef { + post(options: ModelsWithDefParameters): StreamableMethod; +} + +export declare interface ModelsWithDef204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithDefBodyParam { + body: Def; +} + +export declare type ModelsWithDefParameters = ModelsWithDefBodyParam & RequestParameters; + +export declare interface ModelsWithDel { + post(options: ModelsWithDelParameters): StreamableMethod; +} + +export declare interface ModelsWithDel204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithDelBodyParam { + body: Del; +} + +export declare type ModelsWithDelParameters = ModelsWithDelBodyParam & RequestParameters; + +export declare interface ModelsWithElif { + post(options: ModelsWithElifParameters): StreamableMethod; +} + +export declare interface ModelsWithElif204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithElifBodyParam { + body: Elif; +} + +export declare type ModelsWithElifParameters = ModelsWithElifBodyParam & RequestParameters; + +export declare interface ModelsWithElse { + post(options: ModelsWithElseParameters): StreamableMethod; +} + +export declare interface ModelsWithElse204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithElseBodyParam { + body: Else; +} + +export declare type ModelsWithElseParameters = ModelsWithElseBodyParam & RequestParameters; + +export declare interface ModelsWithExcept { + post(options: ModelsWithExceptParameters): StreamableMethod; +} + +export declare interface ModelsWithExcept204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithExceptBodyParam { + body: Except; +} + +export declare type ModelsWithExceptParameters = ModelsWithExceptBodyParam & RequestParameters; + +export declare interface ModelsWithExec { + post(options: ModelsWithExecParameters): StreamableMethod; +} + +export declare interface ModelsWithExec204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithExecBodyParam { + body: Exec; +} + +export declare type ModelsWithExecParameters = ModelsWithExecBodyParam & RequestParameters; + +export declare interface ModelsWithFinally { + post(options: ModelsWithFinallyParameters): StreamableMethod; +} + +export declare interface ModelsWithFinally204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithFinallyBodyParam { + body: Finally; +} + +export declare type ModelsWithFinallyParameters = ModelsWithFinallyBodyParam & RequestParameters; + +export declare interface ModelsWithFor { + post(options: ModelsWithForParameters): StreamableMethod; +} + +export declare interface ModelsWithFor204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithForBodyParam { + body: For; +} + +export declare type ModelsWithForParameters = ModelsWithForBodyParam & RequestParameters; + +export declare interface ModelsWithFrom { + post(options: ModelsWithFromParameters): StreamableMethod; +} + +export declare interface ModelsWithFrom204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithFromBodyParam { + body: From; +} + +export declare type ModelsWithFromParameters = ModelsWithFromBodyParam & RequestParameters; + +export declare interface ModelsWithGlobal { + post(options: ModelsWithGlobalParameters): StreamableMethod; +} + +export declare interface ModelsWithGlobal204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithGlobalBodyParam { + body: GlobalModel; +} + +export declare type ModelsWithGlobalParameters = ModelsWithGlobalBodyParam & RequestParameters; + +export declare interface ModelsWithIf { + post(options: ModelsWithIfParameters): StreamableMethod; +} + +export declare interface ModelsWithIf204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithIfBodyParam { + body: If; +} + +export declare type ModelsWithIfParameters = ModelsWithIfBodyParam & RequestParameters; + +export declare interface ModelsWithImport { + post(options: ModelsWithImportParameters): StreamableMethod; +} + +export declare interface ModelsWithImport204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithImportBodyParam { + body: Import; +} + +export declare type ModelsWithImportParameters = ModelsWithImportBodyParam & RequestParameters; + +export declare interface ModelsWithIn { + post(options: ModelsWithInParameters): StreamableMethod; +} + +export declare interface ModelsWithIn204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithInBodyParam { + body: In; +} + +export declare type ModelsWithInParameters = ModelsWithInBodyParam & RequestParameters; + +export declare interface ModelsWithIs { + post(options: ModelsWithIsParameters): StreamableMethod; +} + +export declare interface ModelsWithIs204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithIsBodyParam { + body: Is; +} + +export declare type ModelsWithIsParameters = ModelsWithIsBodyParam & RequestParameters; + +export declare interface ModelsWithLambda { + post(options: ModelsWithLambdaParameters): StreamableMethod; +} + +export declare interface ModelsWithLambda204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithLambdaBodyParam { + body: Lambda; +} + +export declare type ModelsWithLambdaParameters = ModelsWithLambdaBodyParam & RequestParameters; + +export declare interface ModelsWithNot { + post(options: ModelsWithNotParameters): StreamableMethod; +} + +export declare interface ModelsWithNot204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithNotBodyParam { + body: Not; +} + +export declare type ModelsWithNotParameters = ModelsWithNotBodyParam & RequestParameters; + +export declare interface ModelsWithOr { + post(options: ModelsWithOrParameters): StreamableMethod; +} + +export declare interface ModelsWithOr204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithOrBodyParam { + body: Or; +} + +export declare type ModelsWithOrParameters = ModelsWithOrBodyParam & RequestParameters; + +export declare interface ModelsWithPass { + post(options: ModelsWithPassParameters): StreamableMethod; +} + +export declare interface ModelsWithPass204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithPassBodyParam { + body: Pass; +} + +export declare type ModelsWithPassParameters = ModelsWithPassBodyParam & RequestParameters; + +export declare interface ModelsWithRaise { + post(options: ModelsWithRaiseParameters): StreamableMethod; +} + +export declare interface ModelsWithRaise204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithRaiseBodyParam { + body: Raise; +} + +export declare type ModelsWithRaiseParameters = ModelsWithRaiseBodyParam & RequestParameters; + +export declare interface ModelsWithReturn { + post(options: ModelsWithReturnParameters): StreamableMethod; +} + +export declare interface ModelsWithReturn204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithReturnBodyParam { + body: Return; +} + +export declare type ModelsWithReturnParameters = ModelsWithReturnBodyParam & RequestParameters; + +export declare interface ModelsWithTry { + post(options: ModelsWithTryParameters): StreamableMethod; +} + +export declare interface ModelsWithTry204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithTryBodyParam { + body: Try; +} + +export declare type ModelsWithTryParameters = ModelsWithTryBodyParam & RequestParameters; + +export declare interface ModelsWithWhile { + post(options: ModelsWithWhileParameters): StreamableMethod; +} + +export declare interface ModelsWithWhile204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithWhileBodyParam { + body: While; +} + +export declare type ModelsWithWhileParameters = ModelsWithWhileBodyParam & RequestParameters; + +export declare interface ModelsWithWith { + post(options: ModelsWithWithParameters): StreamableMethod; +} + +export declare interface ModelsWithWith204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithWithBodyParam { + body: With; +} + +export declare type ModelsWithWithParameters = ModelsWithWithBodyParam & RequestParameters; + +export declare interface ModelsWithYield { + post(options: ModelsWithYieldParameters): StreamableMethod; +} + +export declare interface ModelsWithYield204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsWithYieldBodyParam { + body: Yield; +} + +export declare type ModelsWithYieldParameters = ModelsWithYieldBodyParam & RequestParameters; + +export declare interface Not { + name: string; +} + +export declare interface OperationsAnd { + get(options?: OperationsAndParameters): StreamableMethod; +} + +export declare interface OperationsAnd204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsAndParameters = RequestParameters; + +export declare interface OperationsAs { + get(options?: OperationsAsParameters): StreamableMethod; +} + +export declare interface OperationsAs204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsAsParameters = RequestParameters; + +export declare interface OperationsAssert { + get(options?: OperationsAssertParameters): StreamableMethod; +} + +export declare interface OperationsAssert204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsAssertParameters = RequestParameters; + +export declare interface OperationsAsync { + get(options?: OperationsAsyncParameters): StreamableMethod; +} + +export declare interface OperationsAsync204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsAsyncParameters = RequestParameters; + +export declare interface OperationsAwait { + get(options?: OperationsAwaitParameters): StreamableMethod; +} + +export declare interface OperationsAwait204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsAwaitParameters = RequestParameters; + +export declare interface OperationsBreak { + get(options?: OperationsBreakParameters): StreamableMethod; +} + +export declare interface OperationsBreak204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsBreakParameters = RequestParameters; + +export declare interface OperationsClass { + get(options?: OperationsClassParameters): StreamableMethod; +} + +export declare interface OperationsClass204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsClassParameters = RequestParameters; + +export declare interface OperationsConstructor { + get(options?: OperationsConstructorParameters): StreamableMethod; +} + +export declare interface OperationsConstructor204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsConstructorParameters = RequestParameters; + +export declare interface OperationsContinue { + get(options?: OperationsContinueParameters): StreamableMethod; +} + +export declare interface OperationsContinue204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsContinueParameters = RequestParameters; + +export declare interface OperationsDef { + get(options?: OperationsDefParameters): StreamableMethod; +} + +export declare interface OperationsDef204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsDefParameters = RequestParameters; + +export declare interface OperationsDel { + get(options?: OperationsDelParameters): StreamableMethod; +} + +export declare interface OperationsDel204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsDelParameters = RequestParameters; + +export declare interface OperationsElif { + get(options?: OperationsElifParameters): StreamableMethod; +} + +export declare interface OperationsElif204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsElifParameters = RequestParameters; + +export declare interface OperationsElse { + get(options?: OperationsElseParameters): StreamableMethod; +} + +export declare interface OperationsElse204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsElseParameters = RequestParameters; + +export declare interface OperationsExcept { + get(options?: OperationsExceptParameters): StreamableMethod; +} + +export declare interface OperationsExcept204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsExceptParameters = RequestParameters; + +export declare interface OperationsExec { + get(options?: OperationsExecParameters): StreamableMethod; +} + +export declare interface OperationsExec204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsExecParameters = RequestParameters; + +export declare interface OperationsFinally { + get(options?: OperationsFinallyParameters): StreamableMethod; +} + +export declare interface OperationsFinally204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsFinallyParameters = RequestParameters; + +export declare interface OperationsFor { + get(options?: OperationsForParameters): StreamableMethod; +} + +export declare interface OperationsFor204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsForParameters = RequestParameters; + +export declare interface OperationsFrom { + get(options?: OperationsFromParameters): StreamableMethod; +} + +export declare interface OperationsFrom204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsFromParameters = RequestParameters; + +export declare interface OperationsGlobalModel { + get(options?: OperationsGlobalModelParameters): StreamableMethod; +} + +export declare interface OperationsGlobalModel204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsGlobalModelParameters = RequestParameters; + +export declare interface OperationsIf { + get(options?: OperationsIfParameters): StreamableMethod; +} + +export declare interface OperationsIf204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsIfParameters = RequestParameters; + +export declare interface OperationsImport { + get(options?: OperationsImportParameters): StreamableMethod; +} + +export declare interface OperationsImport204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsImportParameters = RequestParameters; + +export declare interface OperationsIn { + get(options?: OperationsInParameters): StreamableMethod; +} + +export declare interface OperationsIn204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsInParameters = RequestParameters; + +export declare interface OperationsIs { + get(options?: OperationsIsParameters): StreamableMethod; +} + +export declare interface OperationsIs204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsIsParameters = RequestParameters; + +export declare interface OperationsLambda { + get(options?: OperationsLambdaParameters): StreamableMethod; +} + +export declare interface OperationsLambda204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsLambdaParameters = RequestParameters; + +export declare interface OperationsNot { + get(options?: OperationsNotParameters): StreamableMethod; +} + +export declare interface OperationsNot204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsNotParameters = RequestParameters; + +export declare interface OperationsOr { + get(options?: OperationsOrParameters): StreamableMethod; +} + +export declare interface OperationsOr204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsOrParameters = RequestParameters; + +export declare interface OperationsPass { + get(options?: OperationsPassParameters): StreamableMethod; +} + +export declare interface OperationsPass204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsPassParameters = RequestParameters; + +export declare interface OperationsRaise { + get(options?: OperationsRaiseParameters): StreamableMethod; +} + +export declare interface OperationsRaise204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsRaiseParameters = RequestParameters; + +export declare interface OperationsReturn { + get(options?: OperationsReturnParameters): StreamableMethod; +} + +export declare interface OperationsReturn204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsReturnParameters = RequestParameters; + +export declare interface OperationsTry { + get(options?: OperationsTryParameters): StreamableMethod; +} + +export declare interface OperationsTry204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsTryParameters = RequestParameters; + +export declare interface OperationsWhile { + get(options?: OperationsWhileParameters): StreamableMethod; +} + +export declare interface OperationsWhile204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsWhileParameters = RequestParameters; + +export declare interface OperationsWith { + get(options?: OperationsWithParameters): StreamableMethod; +} + +export declare interface OperationsWith204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsWithParameters = RequestParameters; + +export declare interface OperationsYield { + get(options?: OperationsYieldParameters): StreamableMethod; +} + +export declare interface OperationsYield204Response extends HttpResponse { + status: "204"; +} + +export declare type OperationsYieldParameters = RequestParameters; + +export declare interface Or { + name: string; +} + +export declare interface ParametersWithAnd { + get(options: ParametersWithAndParameters): StreamableMethod; +} + +export declare interface ParametersWithAnd204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithAndParameters = ParametersWithAndQueryParam & RequestParameters; + +export declare interface ParametersWithAndQueryParam { + queryParameters: ParametersWithAndQueryParamProperties; +} + +export declare interface ParametersWithAndQueryParamProperties { + and: string; +} + +export declare interface ParametersWithAs { + get(options: ParametersWithAsParameters): StreamableMethod; +} + +export declare interface ParametersWithAs204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithAsParameters = ParametersWithAsQueryParam & RequestParameters; + +export declare interface ParametersWithAsQueryParam { + queryParameters: ParametersWithAsQueryParamProperties; +} + +export declare interface ParametersWithAsQueryParamProperties { + as: string; +} + +export declare interface ParametersWithAssert { + get(options: ParametersWithAssertParameters): StreamableMethod; +} + +export declare interface ParametersWithAssert204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithAssertParameters = ParametersWithAssertQueryParam & RequestParameters; + +export declare interface ParametersWithAssertQueryParam { + queryParameters: ParametersWithAssertQueryParamProperties; +} + +export declare interface ParametersWithAssertQueryParamProperties { + assert: string; +} + +export declare interface ParametersWithAsync { + get(options: ParametersWithAsyncParameters): StreamableMethod; +} + +export declare interface ParametersWithAsync204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithAsyncParameters = ParametersWithAsyncQueryParam & RequestParameters; + +export declare interface ParametersWithAsyncQueryParam { + queryParameters: ParametersWithAsyncQueryParamProperties; +} + +export declare interface ParametersWithAsyncQueryParamProperties { + async: string; +} + +export declare interface ParametersWithAwait { + get(options: ParametersWithAwaitParameters): StreamableMethod; +} + +export declare interface ParametersWithAwait204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithAwaitParameters = ParametersWithAwaitQueryParam & RequestParameters; + +export declare interface ParametersWithAwaitQueryParam { + queryParameters: ParametersWithAwaitQueryParamProperties; +} + +export declare interface ParametersWithAwaitQueryParamProperties { + await: string; +} + +export declare interface ParametersWithBreak { + get(options: ParametersWithBreakParameters): StreamableMethod; +} + +export declare interface ParametersWithBreak204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithBreakParameters = ParametersWithBreakQueryParam & RequestParameters; + +export declare interface ParametersWithBreakQueryParam { + queryParameters: ParametersWithBreakQueryParamProperties; +} + +export declare interface ParametersWithBreakQueryParamProperties { + break: string; +} + +export declare interface ParametersWithCancellationToken { + get(options: ParametersWithCancellationTokenParameters): StreamableMethod; +} + +export declare interface ParametersWithCancellationToken204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithCancellationTokenParameters = ParametersWithCancellationTokenQueryParam & RequestParameters; + +export declare interface ParametersWithCancellationTokenQueryParam { + queryParameters: ParametersWithCancellationTokenQueryParamProperties; +} + +export declare interface ParametersWithCancellationTokenQueryParamProperties { + cancellationToken: string; +} + +export declare interface ParametersWithClass { + get(options: ParametersWithClassParameters): StreamableMethod; +} + +export declare interface ParametersWithClass204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithClassParameters = ParametersWithClassQueryParam & RequestParameters; + +export declare interface ParametersWithClassQueryParam { + queryParameters: ParametersWithClassQueryParamProperties; +} + +export declare interface ParametersWithClassQueryParamProperties { + class: string; +} + +export declare interface ParametersWithConstructor { + get(options: ParametersWithConstructorParameters): StreamableMethod; +} + +export declare interface ParametersWithConstructor204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithConstructorParameters = ParametersWithConstructorQueryParam & RequestParameters; + +export declare interface ParametersWithConstructorQueryParam { + queryParameters: ParametersWithConstructorQueryParamProperties; +} + +export declare interface ParametersWithConstructorQueryParamProperties { + constructor: string; +} + +export declare interface ParametersWithContinue { + get(options: ParametersWithContinueParameters): StreamableMethod; +} + +export declare interface ParametersWithContinue204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithContinueParameters = ParametersWithContinueQueryParam & RequestParameters; + +export declare interface ParametersWithContinueQueryParam { + queryParameters: ParametersWithContinueQueryParamProperties; +} + +export declare interface ParametersWithContinueQueryParamProperties { + continue: string; +} + +export declare interface ParametersWithDef { + get(options: ParametersWithDefParameters): StreamableMethod; +} + +export declare interface ParametersWithDef204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithDefParameters = ParametersWithDefQueryParam & RequestParameters; + +export declare interface ParametersWithDefQueryParam { + queryParameters: ParametersWithDefQueryParamProperties; +} + +export declare interface ParametersWithDefQueryParamProperties { + def: string; +} + +export declare interface ParametersWithDel { + get(options: ParametersWithDelParameters): StreamableMethod; +} + +export declare interface ParametersWithDel204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithDelParameters = ParametersWithDelQueryParam & RequestParameters; + +export declare interface ParametersWithDelQueryParam { + queryParameters: ParametersWithDelQueryParamProperties; +} + +export declare interface ParametersWithDelQueryParamProperties { + del: string; +} + +export declare interface ParametersWithElif { + get(options: ParametersWithElifParameters): StreamableMethod; +} + +export declare interface ParametersWithElif204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithElifParameters = ParametersWithElifQueryParam & RequestParameters; + +export declare interface ParametersWithElifQueryParam { + queryParameters: ParametersWithElifQueryParamProperties; +} + +export declare interface ParametersWithElifQueryParamProperties { + elif: string; +} + +export declare interface ParametersWithElse { + get(options: ParametersWithElseParameters): StreamableMethod; +} + +export declare interface ParametersWithElse204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithElseParameters = ParametersWithElseQueryParam & RequestParameters; + +export declare interface ParametersWithElseQueryParam { + queryParameters: ParametersWithElseQueryParamProperties; +} + +export declare interface ParametersWithElseQueryParamProperties { + else: string; +} + +export declare interface ParametersWithExcept { + get(options: ParametersWithExceptParameters): StreamableMethod; +} + +export declare interface ParametersWithExcept204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithExceptParameters = ParametersWithExceptQueryParam & RequestParameters; + +export declare interface ParametersWithExceptQueryParam { + queryParameters: ParametersWithExceptQueryParamProperties; +} + +export declare interface ParametersWithExceptQueryParamProperties { + except: string; +} + +export declare interface ParametersWithExec { + get(options: ParametersWithExecParameters): StreamableMethod; +} + +export declare interface ParametersWithExec204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithExecParameters = ParametersWithExecQueryParam & RequestParameters; + +export declare interface ParametersWithExecQueryParam { + queryParameters: ParametersWithExecQueryParamProperties; +} + +export declare interface ParametersWithExecQueryParamProperties { + exec: string; +} + +export declare interface ParametersWithFinally { + get(options: ParametersWithFinallyParameters): StreamableMethod; +} + +export declare interface ParametersWithFinally204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithFinallyParameters = ParametersWithFinallyQueryParam & RequestParameters; + +export declare interface ParametersWithFinallyQueryParam { + queryParameters: ParametersWithFinallyQueryParamProperties; +} + +export declare interface ParametersWithFinallyQueryParamProperties { + finally: string; +} + +export declare interface ParametersWithFor { + get(options: ParametersWithForParameters): StreamableMethod; +} + +export declare interface ParametersWithFor204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithForParameters = ParametersWithForQueryParam & RequestParameters; + +export declare interface ParametersWithForQueryParam { + queryParameters: ParametersWithForQueryParamProperties; +} + +export declare interface ParametersWithForQueryParamProperties { + for: string; +} + +export declare interface ParametersWithFrom { + get(options: ParametersWithFromParameters): StreamableMethod; +} + +export declare interface ParametersWithFrom204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithFromParameters = ParametersWithFromQueryParam & RequestParameters; + +export declare interface ParametersWithFromQueryParam { + queryParameters: ParametersWithFromQueryParamProperties; +} + +export declare interface ParametersWithFromQueryParamProperties { + from: string; +} + +export declare interface ParametersWithGlobal { + get(options: ParametersWithGlobalParameters): StreamableMethod; +} + +export declare interface ParametersWithGlobal204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithGlobalParameters = ParametersWithGlobalQueryParam & RequestParameters; + +export declare interface ParametersWithGlobalQueryParam { + queryParameters: ParametersWithGlobalQueryParamProperties; +} + +export declare interface ParametersWithGlobalQueryParamProperties { + global: string; +} + +export declare interface ParametersWithIf { + get(options: ParametersWithIfParameters): StreamableMethod; +} + +export declare interface ParametersWithIf204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithIfParameters = ParametersWithIfQueryParam & RequestParameters; + +export declare interface ParametersWithIfQueryParam { + queryParameters: ParametersWithIfQueryParamProperties; +} + +export declare interface ParametersWithIfQueryParamProperties { + if: string; +} + +export declare interface ParametersWithImport { + get(options: ParametersWithImportParameters): StreamableMethod; +} + +export declare interface ParametersWithImport204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithImportParameters = ParametersWithImportQueryParam & RequestParameters; + +export declare interface ParametersWithImportQueryParam { + queryParameters: ParametersWithImportQueryParamProperties; +} + +export declare interface ParametersWithImportQueryParamProperties { + import: string; +} + +export declare interface ParametersWithIn { + get(options: ParametersWithInParameters): StreamableMethod; +} + +export declare interface ParametersWithIn204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithInParameters = ParametersWithInQueryParam & RequestParameters; + +export declare interface ParametersWithInQueryParam { + queryParameters: ParametersWithInQueryParamProperties; +} + +export declare interface ParametersWithInQueryParamProperties { + in: string; +} + +export declare interface ParametersWithIs { + get(options: ParametersWithIsParameters): StreamableMethod; +} + +export declare interface ParametersWithIs204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithIsParameters = ParametersWithIsQueryParam & RequestParameters; + +export declare interface ParametersWithIsQueryParam { + queryParameters: ParametersWithIsQueryParamProperties; +} + +export declare interface ParametersWithIsQueryParamProperties { + is: string; +} + +export declare interface ParametersWithLambda { + get(options: ParametersWithLambdaParameters): StreamableMethod; +} + +export declare interface ParametersWithLambda204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithLambdaParameters = ParametersWithLambdaQueryParam & RequestParameters; + +export declare interface ParametersWithLambdaQueryParam { + queryParameters: ParametersWithLambdaQueryParamProperties; +} + +export declare interface ParametersWithLambdaQueryParamProperties { + lambda: string; +} + +export declare interface ParametersWithNot { + get(options: ParametersWithNotParameters): StreamableMethod; +} + +export declare interface ParametersWithNot204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithNotParameters = ParametersWithNotQueryParam & RequestParameters; + +export declare interface ParametersWithNotQueryParam { + queryParameters: ParametersWithNotQueryParamProperties; +} + +export declare interface ParametersWithNotQueryParamProperties { + not: string; +} + +export declare interface ParametersWithOr { + get(options: ParametersWithOrParameters): StreamableMethod; +} + +export declare interface ParametersWithOr204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithOrParameters = ParametersWithOrQueryParam & RequestParameters; + +export declare interface ParametersWithOrQueryParam { + queryParameters: ParametersWithOrQueryParamProperties; +} + +export declare interface ParametersWithOrQueryParamProperties { + or: string; +} + +export declare interface ParametersWithPass { + get(options: ParametersWithPassParameters): StreamableMethod; +} + +export declare interface ParametersWithPass204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithPassParameters = ParametersWithPassQueryParam & RequestParameters; + +export declare interface ParametersWithPassQueryParam { + queryParameters: ParametersWithPassQueryParamProperties; +} + +export declare interface ParametersWithPassQueryParamProperties { + pass: string; +} + +export declare interface ParametersWithRaise { + get(options: ParametersWithRaiseParameters): StreamableMethod; +} + +export declare interface ParametersWithRaise204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithRaiseParameters = ParametersWithRaiseQueryParam & RequestParameters; + +export declare interface ParametersWithRaiseQueryParam { + queryParameters: ParametersWithRaiseQueryParamProperties; +} + +export declare interface ParametersWithRaiseQueryParamProperties { + raise: string; +} + +export declare interface ParametersWithReturn { + get(options: ParametersWithReturnParameters): StreamableMethod; +} + +export declare interface ParametersWithReturn204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithReturnParameters = ParametersWithReturnQueryParam & RequestParameters; + +export declare interface ParametersWithReturnQueryParam { + queryParameters: ParametersWithReturnQueryParamProperties; +} + +export declare interface ParametersWithReturnQueryParamProperties { + return: string; +} + +export declare interface ParametersWithTry { + get(options: ParametersWithTryParameters): StreamableMethod; +} + +export declare interface ParametersWithTry204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithTryParameters = ParametersWithTryQueryParam & RequestParameters; + +export declare interface ParametersWithTryQueryParam { + queryParameters: ParametersWithTryQueryParamProperties; +} + +export declare interface ParametersWithTryQueryParamProperties { + try: string; +} + +export declare interface ParametersWithWhile { + get(options: ParametersWithWhileParameters): StreamableMethod; +} + +export declare interface ParametersWithWhile204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithWhileParameters = ParametersWithWhileQueryParam & RequestParameters; + +export declare interface ParametersWithWhileQueryParam { + queryParameters: ParametersWithWhileQueryParamProperties; +} + +export declare interface ParametersWithWhileQueryParamProperties { + while: string; +} + +export declare interface ParametersWithWith { + get(options: ParametersWithWithParameters): StreamableMethod; +} + +export declare interface ParametersWithWith204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithWithParameters = ParametersWithWithQueryParam & RequestParameters; + +export declare interface ParametersWithWithQueryParam { + queryParameters: ParametersWithWithQueryParamProperties; +} + +export declare interface ParametersWithWithQueryParamProperties { + with: string; +} + +export declare interface ParametersWithYield { + get(options: ParametersWithYieldParameters): StreamableMethod; +} + +export declare interface ParametersWithYield204Response extends HttpResponse { + status: "204"; +} + +export declare type ParametersWithYieldParameters = ParametersWithYieldQueryParam & RequestParameters; + +export declare interface ParametersWithYieldQueryParam { + queryParameters: ParametersWithYieldQueryParamProperties; +} + +export declare interface ParametersWithYieldQueryParamProperties { + yield: string; +} + +export declare interface Pass { + name: string; +} + +export declare interface Raise { + name: string; +} + +export declare interface Return { + name: string; +} + +export declare interface Routes { + (path: "/special-words/models/and"): ModelsWithAnd; + (path: "/special-words/models/as"): ModelsWithAs; + (path: "/special-words/models/assert"): ModelsWithAssert; + (path: "/special-words/models/async"): ModelsWithAsync; + (path: "/special-words/models/await"): ModelsWithAwait; + (path: "/special-words/models/break"): ModelsWithBreak; + (path: "/special-words/models/class"): ModelsWithClass; + (path: "/special-words/models/constructor"): ModelsWithConstructor; + (path: "/special-words/models/continue"): ModelsWithContinue; + (path: "/special-words/models/def"): ModelsWithDef; + (path: "/special-words/models/del"): ModelsWithDel; + (path: "/special-words/models/elif"): ModelsWithElif; + (path: "/special-words/models/else"): ModelsWithElse; + (path: "/special-words/models/except"): ModelsWithExcept; + (path: "/special-words/models/exec"): ModelsWithExec; + (path: "/special-words/models/finally"): ModelsWithFinally; + (path: "/special-words/models/for"): ModelsWithFor; + (path: "/special-words/models/from"): ModelsWithFrom; + (path: "/special-words/models/global"): ModelsWithGlobal; + (path: "/special-words/models/if"): ModelsWithIf; + (path: "/special-words/models/import"): ModelsWithImport; + (path: "/special-words/models/in"): ModelsWithIn; + (path: "/special-words/models/is"): ModelsWithIs; + (path: "/special-words/models/lambda"): ModelsWithLambda; + (path: "/special-words/models/not"): ModelsWithNot; + (path: "/special-words/models/or"): ModelsWithOr; + (path: "/special-words/models/pass"): ModelsWithPass; + (path: "/special-words/models/raise"): ModelsWithRaise; + (path: "/special-words/models/return"): ModelsWithReturn; + (path: "/special-words/models/try"): ModelsWithTry; + (path: "/special-words/models/while"): ModelsWithWhile; + (path: "/special-words/models/with"): ModelsWithWith; + (path: "/special-words/models/yield"): ModelsWithYield; + (path: "/special-words/model-properties/same-as-model"): ModelPropertiesSameAsModel; + (path: "/special-words/operations/and"): OperationsAnd; + (path: "/special-words/operations/as"): OperationsAs; + (path: "/special-words/operations/assert"): OperationsAssert; + (path: "/special-words/operations/async"): OperationsAsync; + (path: "/special-words/operations/await"): OperationsAwait; + (path: "/special-words/operations/break"): OperationsBreak; + (path: "/special-words/operations/class"): OperationsClass; + (path: "/special-words/operations/constructor"): OperationsConstructor; + (path: "/special-words/operations/continue"): OperationsContinue; + (path: "/special-words/operations/def"): OperationsDef; + (path: "/special-words/operations/del"): OperationsDel; + (path: "/special-words/operations/elif"): OperationsElif; + (path: "/special-words/operations/else"): OperationsElse; + (path: "/special-words/operations/except"): OperationsExcept; + (path: "/special-words/operations/exec"): OperationsExec; + (path: "/special-words/operations/finally"): OperationsFinally; + (path: "/special-words/operations/for"): OperationsFor; + (path: "/special-words/operations/from"): OperationsFrom; + (path: "/special-words/operations/global"): OperationsGlobalModel; + (path: "/special-words/operations/if"): OperationsIf; + (path: "/special-words/operations/import"): OperationsImport; + (path: "/special-words/operations/in"): OperationsIn; + (path: "/special-words/operations/is"): OperationsIs; + (path: "/special-words/operations/lambda"): OperationsLambda; + (path: "/special-words/operations/not"): OperationsNot; + (path: "/special-words/operations/or"): OperationsOr; + (path: "/special-words/operations/pass"): OperationsPass; + (path: "/special-words/operations/raise"): OperationsRaise; + (path: "/special-words/operations/return"): OperationsReturn; + (path: "/special-words/operations/try"): OperationsTry; + (path: "/special-words/operations/while"): OperationsWhile; + (path: "/special-words/operations/with"): OperationsWith; + (path: "/special-words/operations/yield"): OperationsYield; + (path: "/special-words/parameters/and"): ParametersWithAnd; + (path: "/special-words/parameters/as"): ParametersWithAs; + (path: "/special-words/parameters/assert"): ParametersWithAssert; + (path: "/special-words/parameters/async"): ParametersWithAsync; + (path: "/special-words/parameters/await"): ParametersWithAwait; + (path: "/special-words/parameters/break"): ParametersWithBreak; + (path: "/special-words/parameters/class"): ParametersWithClass; + (path: "/special-words/parameters/constructor"): ParametersWithConstructor; + (path: "/special-words/parameters/continue"): ParametersWithContinue; + (path: "/special-words/parameters/def"): ParametersWithDef; + (path: "/special-words/parameters/del"): ParametersWithDel; + (path: "/special-words/parameters/elif"): ParametersWithElif; + (path: "/special-words/parameters/else"): ParametersWithElse; + (path: "/special-words/parameters/except"): ParametersWithExcept; + (path: "/special-words/parameters/exec"): ParametersWithExec; + (path: "/special-words/parameters/finally"): ParametersWithFinally; + (path: "/special-words/parameters/for"): ParametersWithFor; + (path: "/special-words/parameters/from"): ParametersWithFrom; + (path: "/special-words/parameters/global"): ParametersWithGlobal; + (path: "/special-words/parameters/if"): ParametersWithIf; + (path: "/special-words/parameters/import"): ParametersWithImport; + (path: "/special-words/parameters/in"): ParametersWithIn; + (path: "/special-words/parameters/is"): ParametersWithIs; + (path: "/special-words/parameters/lambda"): ParametersWithLambda; + (path: "/special-words/parameters/not"): ParametersWithNot; + (path: "/special-words/parameters/or"): ParametersWithOr; + (path: "/special-words/parameters/pass"): ParametersWithPass; + (path: "/special-words/parameters/raise"): ParametersWithRaise; + (path: "/special-words/parameters/return"): ParametersWithReturn; + (path: "/special-words/parameters/try"): ParametersWithTry; + (path: "/special-words/parameters/while"): ParametersWithWhile; + (path: "/special-words/parameters/with"): ParametersWithWith; + (path: "/special-words/parameters/yield"): ParametersWithYield; + (path: "/special-words/parameters/cancellationToken"): ParametersWithCancellationToken; +} + +export declare interface SameAsModel { + SameAsModel: string; +} + +export declare type SpecialWordsClient = Client & { + path: Routes; +}; + +export declare interface SpecialWordsClientOptions extends ClientOptions { +} + +export declare interface Try { + name: string; +} + +export declare interface While { + name: string; +} + +export declare interface With { + name: string; +} + +export declare interface Yield { + name: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/special-words/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/special-words/tspconfig.yaml new file mode 100644 index 0000000000..20f8c0781c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/special-words/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + title: SpecialWordsClient + packageDetails: + name: "@msinternal/special-words" + description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/array/.gitignore similarity index 100% rename from packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/.gitignore rename to packages/typespec-ts/test/azureIntegration/generated/type/array/.gitignore diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/array/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/array/src/index.d.ts new file mode 100644 index 0000000000..bf8e197caa --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/array/src/index.d.ts @@ -0,0 +1,352 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare type ArrayItemTypesClient = Client & { + path: Routes; +}; + +export declare interface ArrayItemTypesClientOptions extends ClientOptions { +} + +export declare interface BooleanValueGet { + get(options?: BooleanValueGetParameters): StreamableMethod; + put(options: BooleanValuePutParameters): StreamableMethod; +} + +export declare interface BooleanValueGet200Response extends HttpResponse { + status: "200"; + body: boolean[]; +} + +export declare type BooleanValueGetParameters = RequestParameters; + +export declare interface BooleanValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanValuePutBodyParam { + body: boolean[]; +} + +export declare type BooleanValuePutParameters = BooleanValuePutBodyParam & RequestParameters; + +declare function createClient(options?: ArrayItemTypesClientOptions): ArrayItemTypesClient; +export default createClient; + +export declare interface DatetimeValueGet { + get(options?: DatetimeValueGetParameters): StreamableMethod; + put(options: DatetimeValuePutParameters): StreamableMethod; +} + +export declare interface DatetimeValueGet200Response extends HttpResponse { + status: "200"; + body: string[]; +} + +export declare type DatetimeValueGetParameters = RequestParameters; + +export declare interface DatetimeValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimeValuePutBodyParam { + body: Date[] | string[]; +} + +export declare type DatetimeValuePutParameters = DatetimeValuePutBodyParam & RequestParameters; + +export declare interface DurationValueGet { + get(options?: DurationValueGetParameters): StreamableMethod; + put(options: DurationValuePutParameters): StreamableMethod; +} + +export declare interface DurationValueGet200Response extends HttpResponse { + status: "200"; + body: string[]; +} + +export declare type DurationValueGetParameters = RequestParameters; + +export declare interface DurationValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationValuePutBodyParam { + body: string[]; +} + +export declare type DurationValuePutParameters = DurationValuePutBodyParam & RequestParameters; + +export declare interface Float32ValueGet { + get(options?: Float32ValueGetParameters): StreamableMethod; + put(options: Float32ValuePutParameters): StreamableMethod; +} + +export declare interface Float32ValueGet200Response extends HttpResponse { + status: "200"; + body: number[]; +} + +export declare type Float32ValueGetParameters = RequestParameters; + +export declare interface Float32ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface Float32ValuePutBodyParam { + body: number[]; +} + +export declare type Float32ValuePutParameters = Float32ValuePutBodyParam & RequestParameters; + +export declare interface InnerModel { + property: string; + children?: Array; +} + +export declare interface InnerModelOutput { + property: string; + children?: Array; +} + +export declare interface Int32ValueGet { + get(options?: Int32ValueGetParameters): StreamableMethod; + put(options: Int32ValuePutParameters): StreamableMethod; +} + +export declare interface Int32ValueGet200Response extends HttpResponse { + status: "200"; + body: number[]; +} + +export declare type Int32ValueGetParameters = RequestParameters; + +export declare interface Int32ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface Int32ValuePutBodyParam { + body: number[]; +} + +export declare type Int32ValuePutParameters = Int32ValuePutBodyParam & RequestParameters; + +export declare interface Int64ValueGet { + get(options?: Int64ValueGetParameters): StreamableMethod; + put(options: Int64ValuePutParameters): StreamableMethod; +} + +export declare interface Int64ValueGet200Response extends HttpResponse { + status: "200"; + body: number[]; +} + +export declare type Int64ValueGetParameters = RequestParameters; + +export declare interface Int64ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface Int64ValuePutBodyParam { + body: number[]; +} + +export declare type Int64ValuePutParameters = Int64ValuePutBodyParam & RequestParameters; + +export declare interface ModelValueGet { + get(options?: ModelValueGetParameters): StreamableMethod; + put(options: ModelValuePutParameters): StreamableMethod; +} + +export declare interface ModelValueGet200Response extends HttpResponse { + status: "200"; + body: Array; +} + +export declare type ModelValueGetParameters = RequestParameters; + +export declare interface ModelValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelValuePutBodyParam { + body: Array; +} + +export declare type ModelValuePutParameters = ModelValuePutBodyParam & RequestParameters; + +export declare interface NullableBooleanValueGet { + get(options?: NullableBooleanValueGetParameters): StreamableMethod; + put(options: NullableBooleanValuePutParameters): StreamableMethod; +} + +export declare interface NullableBooleanValueGet200Response extends HttpResponse { + status: "200"; + body: (boolean | null)[]; +} + +export declare type NullableBooleanValueGetParameters = RequestParameters; + +export declare interface NullableBooleanValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NullableBooleanValuePutBodyParam { + body: (boolean | null)[]; +} + +export declare type NullableBooleanValuePutParameters = NullableBooleanValuePutBodyParam & RequestParameters; + +export declare interface NullableFloatValueGet { + get(options?: NullableFloatValueGetParameters): StreamableMethod; + put(options: NullableFloatValuePutParameters): StreamableMethod; +} + +export declare interface NullableFloatValueGet200Response extends HttpResponse { + status: "200"; + body: (number | null)[]; +} + +export declare type NullableFloatValueGetParameters = RequestParameters; + +export declare interface NullableFloatValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NullableFloatValuePutBodyParam { + body: (number | null)[]; +} + +export declare type NullableFloatValuePutParameters = NullableFloatValuePutBodyParam & RequestParameters; + +export declare interface NullableInt32ValueGet { + get(options?: NullableInt32ValueGetParameters): StreamableMethod; + put(options: NullableInt32ValuePutParameters): StreamableMethod; +} + +export declare interface NullableInt32ValueGet200Response extends HttpResponse { + status: "200"; + body: (number | null)[]; +} + +export declare type NullableInt32ValueGetParameters = RequestParameters; + +export declare interface NullableInt32ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NullableInt32ValuePutBodyParam { + body: (number | null)[]; +} + +export declare type NullableInt32ValuePutParameters = NullableInt32ValuePutBodyParam & RequestParameters; + +export declare interface NullableModelValueGet { + get(options?: NullableModelValueGetParameters): StreamableMethod; + put(options: NullableModelValuePutParameters): StreamableMethod; +} + +export declare interface NullableModelValueGet200Response extends HttpResponse { + status: "200"; + body: (InnerModelOutput | null)[]; +} + +export declare type NullableModelValueGetParameters = RequestParameters; + +export declare interface NullableModelValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NullableModelValuePutBodyParam { + body: (InnerModel | null)[]; +} + +export declare type NullableModelValuePutParameters = NullableModelValuePutBodyParam & RequestParameters; + +export declare interface NullableStringValueGet { + get(options?: NullableStringValueGetParameters): StreamableMethod; + put(options: NullableStringValuePutParameters): StreamableMethod; +} + +export declare interface NullableStringValueGet200Response extends HttpResponse { + status: "200"; + body: (string | null)[]; +} + +export declare type NullableStringValueGetParameters = RequestParameters; + +export declare interface NullableStringValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NullableStringValuePutBodyParam { + body: (string | null)[]; +} + +export declare type NullableStringValuePutParameters = NullableStringValuePutBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/array/int32"): Int32ValueGet; + (path: "/type/array/int64"): Int64ValueGet; + (path: "/type/array/boolean"): BooleanValueGet; + (path: "/type/array/string"): StringValueGet; + (path: "/type/array/float32"): Float32ValueGet; + (path: "/type/array/datetime"): DatetimeValueGet; + (path: "/type/array/duration"): DurationValueGet; + (path: "/type/array/unknown"): UnknownValueGet; + (path: "/type/array/model"): ModelValueGet; + (path: "/type/array/nullable-float"): NullableFloatValueGet; + (path: "/type/array/nullable-int32"): NullableInt32ValueGet; + (path: "/type/array/nullable-boolean"): NullableBooleanValueGet; + (path: "/type/array/nullable-string"): NullableStringValueGet; + (path: "/type/array/nullable-model"): NullableModelValueGet; +} + +export declare interface StringValueGet { + get(options?: StringValueGetParameters): StreamableMethod; + put(options: StringValuePutParameters): StreamableMethod; +} + +export declare interface StringValueGet200Response extends HttpResponse { + status: "200"; + body: string[]; +} + +export declare type StringValueGetParameters = RequestParameters; + +export declare interface StringValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringValuePutBodyParam { + body: string[]; +} + +export declare type StringValuePutParameters = StringValuePutBodyParam & RequestParameters; + +export declare interface UnknownValueGet { + get(options?: UnknownValueGetParameters): StreamableMethod; + put(options: UnknownValuePutParameters): StreamableMethod; +} + +export declare interface UnknownValueGet200Response extends HttpResponse { + status: "200"; + body: any[]; +} + +export declare type UnknownValueGetParameters = RequestParameters; + +export declare interface UnknownValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownValuePutBodyParam { + body: unknown[]; +} + +export declare type UnknownValuePutParameters = UnknownValuePutBodyParam & RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/array/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/array/tspconfig.yaml new file mode 100644 index 0000000000..591523964a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/array/tspconfig.yaml @@ -0,0 +1,18 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: ArrayItemTypesClient + enableOperationGroup: true + packageDetails: + name: "@msinternal/array-itemtypes" + description: "Array item-types Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/src/index.d.ts new file mode 100644 index 0000000000..4a9686f097 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/src/index.d.ts @@ -0,0 +1,283 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface BooleanValueGet { + get(options?: BooleanValueGetParameters): StreamableMethod; + put(options: BooleanValuePutParameters): StreamableMethod; +} + +export declare interface BooleanValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type BooleanValueGetParameters = RequestParameters; + +export declare interface BooleanValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanValuePutBodyParam { + body: Record; +} + +export declare type BooleanValuePutParameters = BooleanValuePutBodyParam & RequestParameters; + +declare function createClient(options?: DictClientOptions): DictClient; +export default createClient; + +export declare interface DatetimeValueGet { + get(options?: DatetimeValueGetParameters): StreamableMethod; + put(options: DatetimeValuePutParameters): StreamableMethod; +} + +export declare interface DatetimeValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type DatetimeValueGetParameters = RequestParameters; + +export declare interface DatetimeValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimeValuePutBodyParam { + body: Record; +} + +export declare type DatetimeValuePutParameters = DatetimeValuePutBodyParam & RequestParameters; + +export declare type DictClient = Client & { + path: Routes; +}; + +export declare interface DictClientOptions extends ClientOptions { +} + +export declare interface DurationValueGet { + get(options?: DurationValueGetParameters): StreamableMethod; + put(options: DurationValuePutParameters): StreamableMethod; +} + +export declare interface DurationValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type DurationValueGetParameters = RequestParameters; + +export declare interface DurationValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationValuePutBodyParam { + body: Record; +} + +export declare type DurationValuePutParameters = DurationValuePutBodyParam & RequestParameters; + +export declare interface Float32ValueGet { + get(options?: Float32ValueGetParameters): StreamableMethod; + put(options: Float32ValuePutParameters): StreamableMethod; +} + +export declare interface Float32ValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type Float32ValueGetParameters = RequestParameters; + +export declare interface Float32ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface Float32ValuePutBodyParam { + body: Record; +} + +export declare type Float32ValuePutParameters = Float32ValuePutBodyParam & RequestParameters; + +export declare interface InnerModel { + property: string; + children?: Record; +} + +export declare interface InnerModelOutput { + property: string; + children?: Record; +} + +export declare interface Int32ValueGet { + get(options?: Int32ValueGetParameters): StreamableMethod; + put(options: Int32ValuePutParameters): StreamableMethod; +} + +export declare interface Int32ValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type Int32ValueGetParameters = RequestParameters; + +export declare interface Int32ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface Int32ValuePutBodyParam { + body: Record; +} + +export declare type Int32ValuePutParameters = Int32ValuePutBodyParam & RequestParameters; + +export declare interface Int64ValueGet { + get(options?: Int64ValueGetParameters): StreamableMethod; + put(options: Int64ValuePutParameters): StreamableMethod; +} + +export declare interface Int64ValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type Int64ValueGetParameters = RequestParameters; + +export declare interface Int64ValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface Int64ValuePutBodyParam { + body: Record; +} + +export declare type Int64ValuePutParameters = Int64ValuePutBodyParam & RequestParameters; + +export declare interface ModelValueGet { + get(options?: ModelValueGetParameters): StreamableMethod; + put(options: ModelValuePutParameters): StreamableMethod; +} + +export declare interface ModelValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type ModelValueGetParameters = RequestParameters; + +export declare interface ModelValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelValuePutBodyParam { + body: Record; +} + +export declare type ModelValuePutParameters = ModelValuePutBodyParam & RequestParameters; + +export declare interface NullableFloatValueGet { + get(options?: NullableFloatValueGetParameters): StreamableMethod; + put(options: NullableFloatValuePutParameters): StreamableMethod; +} + +export declare interface NullableFloatValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type NullableFloatValueGetParameters = RequestParameters; + +export declare interface NullableFloatValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NullableFloatValuePutBodyParam { + body: Record; +} + +export declare type NullableFloatValuePutParameters = NullableFloatValuePutBodyParam & RequestParameters; + +export declare interface RecursiveModelValueGet { + get(options?: RecursiveModelValueGetParameters): StreamableMethod; + put(options: RecursiveModelValuePutParameters): StreamableMethod; +} + +export declare interface RecursiveModelValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type RecursiveModelValueGetParameters = RequestParameters; + +export declare interface RecursiveModelValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface RecursiveModelValuePutBodyParam { + body: Record; +} + +export declare type RecursiveModelValuePutParameters = RecursiveModelValuePutBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/dictionary/int32"): Int32ValueGet; + (path: "/type/dictionary/int64"): Int64ValueGet; + (path: "/type/dictionary/boolean"): BooleanValueGet; + (path: "/type/dictionary/string"): StringValueGet; + (path: "/type/dictionary/float32"): Float32ValueGet; + (path: "/type/dictionary/datetime"): DatetimeValueGet; + (path: "/type/dictionary/duration"): DurationValueGet; + (path: "/type/dictionary/unknown"): UnknownValueGet; + (path: "/type/dictionary/model"): ModelValueGet; + (path: "/type/dictionary/model/recursive"): RecursiveModelValueGet; + (path: "/type/dictionary/nullable-float"): NullableFloatValueGet; +} + +export declare interface StringValueGet { + get(options?: StringValueGetParameters): StreamableMethod; + put(options: StringValuePutParameters): StreamableMethod; +} + +export declare interface StringValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type StringValueGetParameters = RequestParameters; + +export declare interface StringValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringValuePutBodyParam { + body: Record; +} + +export declare type StringValuePutParameters = StringValuePutBodyParam & RequestParameters; + +export declare interface UnknownValueGet { + get(options?: UnknownValueGetParameters): StreamableMethod; + put(options: UnknownValuePutParameters): StreamableMethod; +} + +export declare interface UnknownValueGet200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare type UnknownValueGetParameters = RequestParameters; + +export declare interface UnknownValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownValuePutBodyParam { + body: Record; +} + +export declare type UnknownValuePutParameters = UnknownValuePutBodyParam & RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/tspconfig.yaml new file mode 100644 index 0000000000..a4b6537037 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/dictionary/tspconfig.yaml @@ -0,0 +1,18 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: DictClient + enableOperationGroup: true + packageDetails: + name: "@msinternal/dictionary" + description: "Dictionary Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/src/index.d.ts new file mode 100644 index 0000000000..50cb50ba2a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/src/index.d.ts @@ -0,0 +1,70 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: ExtensibleClientOptions): ExtensibleClient; +export default createClient; + +export declare type DaysOfWeekExtensibleEnum = string; + +export declare type DaysOfWeekExtensibleEnumOutput = string; + +export declare type ExtensibleClient = Client & { + path: Routes; +}; + +export declare interface ExtensibleClientOptions extends ClientOptions { +} + +export declare interface GetKnownValue { + get(options?: GetKnownValueParameters): StreamableMethod; + put(options: PutKnownValueParameters): StreamableMethod; +} + +export declare interface GetKnownValue200Response extends HttpResponse { + status: "200"; + body: DaysOfWeekExtensibleEnumOutput; +} + +export declare type GetKnownValueParameters = RequestParameters; + +export declare interface GetUnknownValue { + get(options?: GetUnknownValueParameters): StreamableMethod; + put(options: PutUnknownValueParameters): StreamableMethod; +} + +export declare interface GetUnknownValue200Response extends HttpResponse { + status: "200"; + body: DaysOfWeekExtensibleEnumOutput; +} + +export declare type GetUnknownValueParameters = RequestParameters; + +export declare interface PutKnownValue204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutKnownValueBodyParam { + body: DaysOfWeekExtensibleEnum; +} + +export declare type PutKnownValueParameters = PutKnownValueBodyParam & RequestParameters; + +export declare interface PutUnknownValue204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutUnknownValueBodyParam { + body: DaysOfWeekExtensibleEnum; +} + +export declare type PutUnknownValueParameters = PutUnknownValueBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/enum/extensible/string/known-value"): GetKnownValue; + (path: "/type/enum/extensible/string/unknown-value"): GetUnknownValue; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/tspconfig.yaml new file mode 100644 index 0000000000..5d03d0c7b2 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/enum/extensible/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/extensible-enums" + description: "Extensible Enums Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/src/index.d.ts new file mode 100644 index 0000000000..489b419611 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/src/index.d.ts @@ -0,0 +1,62 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: FixedClientOptions): FixedClient; +export default createClient; + +export declare type DaysOfWeekEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; + +export declare type DaysOfWeekEnumOutput = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; + +export declare type FixedClient = Client & { + path: Routes; +}; + +export declare interface FixedClientOptions extends ClientOptions { +} + +export declare interface GetKnownValue { + get(options?: GetKnownValueParameters): StreamableMethod; + put(options: PutKnownValueParameters): StreamableMethod; +} + +export declare interface GetKnownValue200Response extends HttpResponse { + status: "200"; + body: DaysOfWeekEnumOutput; +} + +export declare type GetKnownValueParameters = RequestParameters; + +export declare interface PutKnownValue204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutKnownValueBodyParam { + body: DaysOfWeekEnum; +} + +export declare type PutKnownValueParameters = PutKnownValueBodyParam & RequestParameters; + +export declare interface PutUnknownValue { + put(options: PutUnknownValueParameters): StreamableMethod; +} + +export declare interface PutUnknownValue204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutUnknownValueBodyParam { + body: DaysOfWeekEnum; +} + +export declare type PutUnknownValueParameters = PutUnknownValueBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/enum/fixed/string/known-value"): GetKnownValue; + (path: "/type/enum/fixed/string/unknown-value"): PutUnknownValue; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/tspconfig.yaml new file mode 100644 index 0000000000..c706b7105a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/enum/fixed/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/extensible-fixed" + description: "Fixed Enums Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/src/index.d.ts new file mode 100644 index 0000000000..5643f7d3e5 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/src/index.d.ts @@ -0,0 +1,71 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: EmptyClientOptions): EmptyClient; +export default createClient; + +export declare type EmptyClient = Client & { + path: Routes; +}; + +export declare interface EmptyClientOptions extends ClientOptions { +} + +export declare interface EmptyInput { +} + +export declare interface EmptyInputOutput { +} + +export declare interface EmptyInputOutputOutput { +} + +export declare interface EmptyOutputOutput { +} + +export declare interface GetEmpty200Response extends HttpResponse { + status: "200"; + body: EmptyOutputOutput; +} + +export declare type GetEmptyParameters = RequestParameters; + +export declare interface PostRoundTripEmpty { + post(options: PostRoundTripEmptyParameters): StreamableMethod; +} + +export declare interface PostRoundTripEmpty200Response extends HttpResponse { + status: "200"; + body: EmptyInputOutputOutput; +} + +export declare interface PostRoundTripEmptyBodyParam { + body: EmptyInputOutput; +} + +export declare type PostRoundTripEmptyParameters = PostRoundTripEmptyBodyParam & RequestParameters; + +export declare interface PutEmpty { + put(options: PutEmptyParameters): StreamableMethod; + get(options?: GetEmptyParameters): StreamableMethod; +} + +export declare interface PutEmpty204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutEmptyBodyParam { + body: EmptyInput; +} + +export declare type PutEmptyParameters = PutEmptyBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/model/empty/alone"): PutEmpty; + (path: "/type/model/empty/round-trip"): PostRoundTripEmpty; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/tspconfig.yaml new file mode 100644 index 0000000000..be7d32c334 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/empty/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/empty-model" + description: "Empty model Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts new file mode 100644 index 0000000000..3b0565a66b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts @@ -0,0 +1,166 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface Cobra extends SnakeParent { + kind: "cobra"; +} + +export declare interface CobraOutput extends SnakeOutputParent { + kind: "cobra"; +} + +declare function createClient(options?: EnumDiscriminatorClientOptions): EnumDiscriminatorClient; +export default createClient; + +export declare type Dog = DogParent | Golden; + +export declare type DogKind = string; + +export declare type DogKindOutput = string; + +export declare type DogOutput = DogOutputParent | GoldenOutput; + +export declare interface DogOutputParent { + weight: number; + kind: DogKindOutput; +} + +export declare interface DogParent { + weight: number; + kind: DogKind; +} + +export declare type EnumDiscriminatorClient = Client & { + path: Routes; +}; + +export declare interface EnumDiscriminatorClientOptions extends ClientOptions { +} + +export declare interface GetExtensibleModel { + get(options?: GetExtensibleModelParameters): StreamableMethod; + put(options: PutExtensibleModelParameters): StreamableMethod; +} + +export declare interface GetExtensibleModel200Response extends HttpResponse { + status: "200"; + body: DogOutput; +} + +export declare interface GetExtensibleModelMissingDiscriminator { + get(options?: GetExtensibleModelMissingDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetExtensibleModelMissingDiscriminator200Response extends HttpResponse { + status: "200"; + body: DogOutput; +} + +export declare type GetExtensibleModelMissingDiscriminatorParameters = RequestParameters; + +export declare type GetExtensibleModelParameters = RequestParameters; + +export declare interface GetExtensibleModelWrongDiscriminator { + get(options?: GetExtensibleModelWrongDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetExtensibleModelWrongDiscriminator200Response extends HttpResponse { + status: "200"; + body: DogOutput; +} + +export declare type GetExtensibleModelWrongDiscriminatorParameters = RequestParameters; + +export declare interface GetFixedModel { + get(options?: GetFixedModelParameters): StreamableMethod; + put(options: PutFixedModelParameters): StreamableMethod; +} + +export declare interface GetFixedModel200Response extends HttpResponse { + status: "200"; + body: SnakeOutput; +} + +export declare interface GetFixedModelMissingDiscriminator { + get(options?: GetFixedModelMissingDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetFixedModelMissingDiscriminator200Response extends HttpResponse { + status: "200"; + body: SnakeOutput; +} + +export declare type GetFixedModelMissingDiscriminatorParameters = RequestParameters; + +export declare type GetFixedModelParameters = RequestParameters; + +export declare interface GetFixedModelWrongDiscriminator { + get(options?: GetFixedModelWrongDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetFixedModelWrongDiscriminator200Response extends HttpResponse { + status: "200"; + body: SnakeOutput; +} + +export declare type GetFixedModelWrongDiscriminatorParameters = RequestParameters; + +export declare interface Golden extends DogParent { + kind: "golden"; +} + +export declare interface GoldenOutput extends DogOutputParent { + kind: "golden"; +} + +export declare interface PutExtensibleModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutExtensibleModelBodyParam { + body: Dog; +} + +export declare type PutExtensibleModelParameters = PutExtensibleModelBodyParam & RequestParameters; + +export declare interface PutFixedModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutFixedModelBodyParam { + body: Snake; +} + +export declare type PutFixedModelParameters = PutFixedModelBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/model/inheritance/enum-discriminator/extensible-enum"): GetExtensibleModel; + (path: "/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator"): GetExtensibleModelMissingDiscriminator; + (path: "/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator"): GetExtensibleModelWrongDiscriminator; + (path: "/type/model/inheritance/enum-discriminator/fixed-enum"): GetFixedModel; + (path: "/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator"): GetFixedModelMissingDiscriminator; + (path: "/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator"): GetFixedModelWrongDiscriminator; +} + +export declare type Snake = SnakeParent | Cobra; + +export declare type SnakeKind = "cobra"; + +export declare type SnakeKindOutput = "cobra"; + +export declare type SnakeOutput = SnakeOutputParent | CobraOutput; + +export declare interface SnakeOutputParent { + length: number; + kind: SnakeKindOutput; +} + +export declare interface SnakeParent { + length: number; + kind: SnakeKind; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml new file mode 100644 index 0000000000..b26f26883a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/model-inheritance-enum-discriminator" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts new file mode 100644 index 0000000000..cdb3189d1d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts @@ -0,0 +1,148 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: NestedDiscriminatorClientOptions): NestedDiscriminatorClient; +export default createClient; + +export declare type Fish = FishParent | Shark | Salmon; + +export declare type FishOutput = FishOutputParent | SharkOutput | SalmonOutput; + +export declare interface FishOutputParent { + age: number; + kind: string; +} + +export declare interface FishParent { + age: number; + kind: string; +} + +export declare interface GetMissingDiscriminator { + get(options?: GetMissingDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetMissingDiscriminator200Response extends HttpResponse { + status: "200"; + body: FishOutput; +} + +export declare type GetMissingDiscriminatorParameters = RequestParameters; + +export declare interface GetModel { + get(options?: GetModelParameters): StreamableMethod; + put(options: PutModelParameters): StreamableMethod; +} + +export declare interface GetModel200Response extends HttpResponse { + status: "200"; + body: FishOutput; +} + +export declare type GetModelParameters = RequestParameters; + +export declare interface GetRecursiveModel { + get(options?: GetRecursiveModelParameters): StreamableMethod; + put(options: PutRecursiveModelParameters): StreamableMethod; +} + +export declare interface GetRecursiveModel200Response extends HttpResponse { + status: "200"; + body: FishOutput; +} + +export declare type GetRecursiveModelParameters = RequestParameters; + +export declare interface GetWrongDiscriminator { + get(options?: GetWrongDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetWrongDiscriminator200Response extends HttpResponse { + status: "200"; + body: FishOutput; +} + +export declare type GetWrongDiscriminatorParameters = RequestParameters; + +export declare interface GoblinShark extends SharkParent { + sharktype: "goblin"; +} + +export declare interface GoblinSharkOutput extends SharkOutputParent { + sharktype: "goblin"; +} + +export declare type NestedDiscriminatorClient = Client & { + path: Routes; +}; + +export declare interface NestedDiscriminatorClientOptions extends ClientOptions { +} + +export declare interface PutModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutModelBodyParam { + body: Fish; +} + +export declare type PutModelParameters = PutModelBodyParam & RequestParameters; + +export declare interface PutRecursiveModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutRecursiveModelBodyParam { + body: Fish; +} + +export declare type PutRecursiveModelParameters = PutRecursiveModelBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/model/inheritance/nested-discriminator/model"): GetModel; + (path: "/type/model/inheritance/nested-discriminator/recursivemodel"): GetRecursiveModel; + (path: "/type/model/inheritance/nested-discriminator/missingdiscriminator"): GetMissingDiscriminator; + (path: "/type/model/inheritance/nested-discriminator/wrongdiscriminator"): GetWrongDiscriminator; +} + +export declare interface Salmon extends FishParent { + kind: "salmon"; + friends?: Array; + hate?: Record; + partner?: Fish; +} + +export declare interface SalmonOutput extends FishOutputParent { + kind: "salmon"; + friends?: Array; + hate?: Record; + partner?: FishOutput; +} + +export declare interface SawShark extends SharkParent { + sharktype: "saw"; +} + +export declare interface SawSharkOutput extends SharkOutputParent { + sharktype: "saw"; +} + +export declare type Shark = SharkParent | SawShark | GoblinShark; + +export declare type SharkOutput = SharkOutputParent | SawSharkOutput | GoblinSharkOutput; + +export declare interface SharkOutputParent extends FishOutputParent { + kind: "shark"; + sharktype: string; +} + +export declare interface SharkParent extends FishParent { + kind: "shark"; + sharktype: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml new file mode 100644 index 0000000000..cb969320a8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/model-inheritance" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts new file mode 100644 index 0000000000..4476baeabb --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts @@ -0,0 +1,79 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface Cat extends Pet { + age: number; +} + +export declare interface CatOutput extends PetOutput { + age: number; +} + +declare function createClient(options?: NotDiscriminatedClientOptions): NotDiscriminatedClient; +export default createClient; + +export declare interface GetValid200Response extends HttpResponse { + status: "200"; + body: SiameseOutput; +} + +export declare type GetValidParameters = RequestParameters; + +export declare type NotDiscriminatedClient = Client & { + path: Routes; +}; + +export declare interface NotDiscriminatedClientOptions extends ClientOptions { +} + +export declare interface Pet { + name: string; +} + +export declare interface PetOutput { + name: string; +} + +export declare interface PostValid { + post(options: PostValidParameters): StreamableMethod; + get(options?: GetValidParameters): StreamableMethod; + put(options: PutValidParameters): StreamableMethod; +} + +export declare interface PostValid204Response extends HttpResponse { + status: "204"; +} + +export declare interface PostValidBodyParam { + body: Siamese; +} + +export declare type PostValidParameters = PostValidBodyParam & RequestParameters; + +export declare interface PutValid200Response extends HttpResponse { + status: "200"; + body: SiameseOutput; +} + +export declare interface PutValidBodyParam { + body: Siamese; +} + +export declare type PutValidParameters = PutValidBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/model/inheritance/not-discriminated/valid"): PostValid; +} + +export declare interface Siamese extends Cat { + smart: boolean; +} + +export declare interface SiameseOutput extends CatOutput { + smart: boolean; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml new file mode 100644 index 0000000000..1e5698963b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/model-inheritance-not-discriminated" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/src/index.d.ts new file mode 100644 index 0000000000..977a95016b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/src/index.d.ts @@ -0,0 +1,60 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: RecursiveClientOptions): RecursiveClient; +export default createClient; + +declare interface Element_2 { + extension?: Array; +} +export { Element_2 as Element } + +export declare interface ElementOutput { + extension?: Array; +} + +export declare interface Extension extends Element_2 { + level: number; +} + +export declare interface ExtensionOutput extends ElementOutput { + level: number; +} + +export declare interface Get200Response extends HttpResponse { + status: "200"; + body: ExtensionOutput; +} + +export declare type GetParameters = RequestParameters; + +export declare interface Put { + put(options: PutParameters): StreamableMethod; + get(options?: GetParameters): StreamableMethod; +} + +export declare interface Put204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutBodyParam { + body: Extension; +} + +export declare type PutParameters = PutBodyParam & RequestParameters; + +export declare type RecursiveClient = Client & { + path: Routes; +}; + +export declare interface RecursiveClientOptions extends ClientOptions { +} + +export declare interface Routes { + (path: "/type/model/inheritance/recursive"): Put; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml new file mode 100644 index 0000000000..e43ba65e21 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/inheritance-recursive" + description: "recursive Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts new file mode 100644 index 0000000000..9fd72ef0b2 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts @@ -0,0 +1,165 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare type Bird = BirdParent | SeaGull | Sparrow | Goose | Eagle; + +export declare type BirdOutput = BirdOutputParent | SeaGullOutput | SparrowOutput | GooseOutput | EagleOutput; + +export declare interface BirdOutputParent { + wingspan: number; + kind: string; +} + +export declare interface BirdParent { + wingspan: number; + kind: string; +} + +declare function createClient(options?: SingleDiscriminatorClientOptions): SingleDiscriminatorClient; +export default createClient; + +export declare type DinosaurOutput = DinosaurOutputParent | TRexOutput; + +export declare interface DinosaurOutputParent { + size: number; + kind: string; +} + +export declare interface Eagle extends BirdParent { + kind: "eagle"; + friends?: Array; + hate?: Record; + partner?: Bird; +} + +export declare interface EagleOutput extends BirdOutputParent { + kind: "eagle"; + friends?: Array; + hate?: Record; + partner?: BirdOutput; +} + +export declare interface GetLegacyModel { + get(options?: GetLegacyModelParameters): StreamableMethod; +} + +export declare interface GetLegacyModel200Response extends HttpResponse { + status: "200"; + body: DinosaurOutput; +} + +export declare type GetLegacyModelParameters = RequestParameters; + +export declare interface GetMissingDiscriminator { + get(options?: GetMissingDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetMissingDiscriminator200Response extends HttpResponse { + status: "200"; + body: BirdOutput; +} + +export declare type GetMissingDiscriminatorParameters = RequestParameters; + +export declare interface GetModel { + get(options?: GetModelParameters): StreamableMethod; + put(options: PutModelParameters): StreamableMethod; +} + +export declare interface GetModel200Response extends HttpResponse { + status: "200"; + body: BirdOutput; +} + +export declare type GetModelParameters = RequestParameters; + +export declare interface GetRecursiveModel { + get(options?: GetRecursiveModelParameters): StreamableMethod; + put(options: PutRecursiveModelParameters): StreamableMethod; +} + +export declare interface GetRecursiveModel200Response extends HttpResponse { + status: "200"; + body: BirdOutput; +} + +export declare type GetRecursiveModelParameters = RequestParameters; + +export declare interface GetWrongDiscriminator { + get(options?: GetWrongDiscriminatorParameters): StreamableMethod; +} + +export declare interface GetWrongDiscriminator200Response extends HttpResponse { + status: "200"; + body: BirdOutput; +} + +export declare type GetWrongDiscriminatorParameters = RequestParameters; + +export declare interface Goose extends BirdParent { + kind: "goose"; +} + +export declare interface GooseOutput extends BirdOutputParent { + kind: "goose"; +} + +export declare interface PutModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutModelBodyParam { + body: Bird; +} + +export declare type PutModelParameters = PutModelBodyParam & RequestParameters; + +export declare interface PutRecursiveModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutRecursiveModelBodyParam { + body: Bird; +} + +export declare type PutRecursiveModelParameters = PutRecursiveModelBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/model/inheritance/single-discriminator/model"): GetModel; + (path: "/type/model/inheritance/single-discriminator/recursivemodel"): GetRecursiveModel; + (path: "/type/model/inheritance/single-discriminator/missingdiscriminator"): GetMissingDiscriminator; + (path: "/type/model/inheritance/single-discriminator/wrongdiscriminator"): GetWrongDiscriminator; + (path: "/type/model/inheritance/single-discriminator/legacy-model"): GetLegacyModel; +} + +export declare interface SeaGull extends BirdParent { + kind: "seagull"; +} + +export declare interface SeaGullOutput extends BirdOutputParent { + kind: "seagull"; +} + +export declare type SingleDiscriminatorClient = Client & { + path: Routes; +}; + +export declare interface SingleDiscriminatorClientOptions extends ClientOptions { +} + +export declare interface Sparrow extends BirdParent { + kind: "sparrow"; +} + +export declare interface SparrowOutput extends BirdOutputParent { + kind: "sparrow"; +} + +export declare interface TRexOutput extends DinosaurOutputParent { + kind: "t-rex"; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml new file mode 100644 index 0000000000..1f02ab28d6 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/model-inheritance-single-discriminator" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/src/index.d.ts similarity index 85% rename from packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/type/model/usage/src/index.d.ts index add3437667..58fad35d47 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/src/index.d.ts +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@typespec/ts-http-runtime'; -import type { ClientOptions } from '@typespec/ts-http-runtime'; -import type { HttpResponse } from '@typespec/ts-http-runtime'; -import type { RequestParameters } from '@typespec/ts-http-runtime'; -import type { StreamableMethod } from '@typespec/ts-http-runtime'; +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; declare function createClient(options?: UsageClientOptions): UsageClient; export default createClient; diff --git a/packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/type/model/usage/tspconfig.yaml index 379df425ca..67ac049162 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/rlc/generated/models/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/usage/tspconfig.yaml @@ -7,7 +7,6 @@ options: generateTest: false addCredentials: false isTypeSpecTest: true - branded: false isModularLibrary: false packageDetails: name: "@msinternal/usage" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/src/index.d.ts new file mode 100644 index 0000000000..bf798db9a7 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/src/index.d.ts @@ -0,0 +1,130 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(options?: VisibilityClientOptions): VisibilityClient; +export default createClient; + +export declare interface DeleteModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface DeleteModelBodyParam { + body: VisibilityModel; +} + +export declare type DeleteModelParameters = DeleteModelBodyParam & RequestParameters; + +export declare interface GetModel { + get(options: GetModelParameters): StreamableMethod; + head(options: HeadModelParameters): StreamableMethod; + put(options: PutModelParameters): StreamableMethod; + patch(options: PatchModelParameters): StreamableMethod; + post(options: PostModelParameters): StreamableMethod; + delete(options: DeleteModelParameters): StreamableMethod; +} + +export declare interface GetModel200Response extends HttpResponse { + status: "200"; + body: VisibilityModelOutput; +} + +export declare interface GetModelBodyParam { + body: VisibilityModel; +} + +export declare type GetModelParameters = GetModelBodyParam & RequestParameters; + +export declare interface HeadModel200Response extends HttpResponse { + status: "200"; +} + +export declare interface HeadModelBodyParam { + body: VisibilityModel; +} + +export declare type HeadModelParameters = HeadModelBodyParam & RequestParameters; + +export declare interface PatchModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PatchModelBodyParam { + body: VisibilityModel; +} + +export declare type PatchModelParameters = PatchModelBodyParam & RequestParameters; + +export declare interface PostModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PostModelBodyParam { + body: VisibilityModel; +} + +export declare type PostModelParameters = PostModelBodyParam & RequestParameters; + +export declare interface PutModel204Response extends HttpResponse { + status: "204"; +} + +export declare interface PutModelBodyParam { + body: VisibilityModel; +} + +export declare type PutModelParameters = PutModelBodyParam & RequestParameters; + +export declare interface PutReadOnlyModel { + put(options: PutReadOnlyModelParameters): StreamableMethod; +} + +export declare interface PutReadOnlyModel200Response extends HttpResponse { + status: "200"; + body: ReadOnlyModelOutput; +} + +export declare interface PutReadOnlyModelBodyParam { + body: ReadOnlyModel; +} + +export declare type PutReadOnlyModelParameters = PutReadOnlyModelBodyParam & RequestParameters; + +export declare interface ReadOnlyModel { +} + +export declare interface ReadOnlyModelOutput { + readonly optionalNullableIntList?: number[] | null; + readonly optionalStringRecord?: Record; +} + +export declare interface Routes { + (path: "/type/model/visibility"): GetModel; + (path: "/type/model/visibility/readonlyroundtrip"): PutReadOnlyModel; +} + +export declare type VisibilityClient = Client & { + path: Routes; +}; + +export declare interface VisibilityClientOptions extends ClientOptions { +} + +export declare interface VisibilityModel { + queryProp: number; + createProp: string[]; + updateProp: number[]; + deleteProp: boolean; +} + +export declare interface VisibilityModelOutput { + readonly readProp: string; + queryProp: number; + createProp: string[]; + updateProp: number[]; + deleteProp: boolean; +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/tspconfig.yaml new file mode 100644 index 0000000000..67ad2f03ca --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/model/visibility/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + packageDetails: + name: "@msinternal/visibility" + description: "Visibility Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/type/property/additional-properties/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/type/property/additional-properties/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/tspconfig.yaml index b8f9402d65..a8b006de94 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/additional-properties/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/additional-properties/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/src/index.d.ts new file mode 100644 index 0000000000..7d82ace333 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/src/index.d.ts @@ -0,0 +1,490 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface BytesGetNonNull { + get(options?: BytesGetNonNullParameters): StreamableMethod; + patch(options: BytesPatchNonNullParameters): StreamableMethod; +} + +export declare interface BytesGetNonNull200Response extends HttpResponse { + status: "200"; + body: BytesPropertyOutput; +} + +export declare type BytesGetNonNullParameters = RequestParameters; + +export declare interface BytesGetNull { + get(options?: BytesGetNullParameters): StreamableMethod; + patch(options: BytesPatchNullParameters): StreamableMethod; +} + +export declare interface BytesGetNull200Response extends HttpResponse { + status: "200"; + body: BytesPropertyOutput; +} + +export declare type BytesGetNullParameters = RequestParameters; + +export declare interface BytesPatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface BytesPatchNonNullBodyParam { + body: BytesPropertyResourceMergeAndPatch; +} + +export declare interface BytesPatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type BytesPatchNonNullParameters = BytesPatchNonNullMediaTypesParam & BytesPatchNonNullBodyParam & RequestParameters; + +export declare interface BytesPatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface BytesPatchNullBodyParam { + body: BytesPropertyResourceMergeAndPatch; +} + +export declare interface BytesPatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type BytesPatchNullParameters = BytesPatchNullMediaTypesParam & BytesPatchNullBodyParam & RequestParameters; + +export declare interface BytesProperty { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare interface BytesPropertyOutput { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare type BytesPropertyResourceMergeAndPatch = Partial; + +export declare interface CollectionsByteGetNonNull { + get(options?: CollectionsByteGetNonNullParameters): StreamableMethod; + patch(options: CollectionsBytePatchNonNullParameters): StreamableMethod; +} + +export declare interface CollectionsByteGetNonNull200Response extends HttpResponse { + status: "200"; + body: CollectionsBytePropertyOutput; +} + +export declare type CollectionsByteGetNonNullParameters = RequestParameters; + +export declare interface CollectionsByteGetNull { + get(options?: CollectionsByteGetNullParameters): StreamableMethod; + patch(options: CollectionsBytePatchNullParameters): StreamableMethod; +} + +export declare interface CollectionsByteGetNull200Response extends HttpResponse { + status: "200"; + body: CollectionsBytePropertyOutput; +} + +export declare type CollectionsByteGetNullParameters = RequestParameters; + +export declare interface CollectionsBytePatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsBytePatchNonNullBodyParam { + body: CollectionsBytePropertyResourceMergeAndPatch; +} + +export declare interface CollectionsBytePatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type CollectionsBytePatchNonNullParameters = CollectionsBytePatchNonNullMediaTypesParam & CollectionsBytePatchNonNullBodyParam & RequestParameters; + +export declare interface CollectionsBytePatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsBytePatchNullBodyParam { + body: CollectionsBytePropertyResourceMergeAndPatch; +} + +export declare interface CollectionsBytePatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type CollectionsBytePatchNullParameters = CollectionsBytePatchNullMediaTypesParam & CollectionsBytePatchNullBodyParam & RequestParameters; + +export declare interface CollectionsByteProperty { + requiredProperty: string; + nullableProperty: string[] | null; +} + +export declare interface CollectionsBytePropertyOutput { + requiredProperty: string; + nullableProperty: string[] | null; +} + +export declare type CollectionsBytePropertyResourceMergeAndPatch = Partial; + +export declare interface CollectionsModelGetNonNull { + get(options?: CollectionsModelGetNonNullParameters): StreamableMethod; + patch(options: CollectionsModelPatchNonNullParameters): StreamableMethod; +} + +export declare interface CollectionsModelGetNonNull200Response extends HttpResponse { + status: "200"; + body: CollectionsModelPropertyOutput; +} + +export declare type CollectionsModelGetNonNullParameters = RequestParameters; + +export declare interface CollectionsModelGetNull { + get(options?: CollectionsModelGetNullParameters): StreamableMethod; + patch(options: CollectionsModelPatchNullParameters): StreamableMethod; +} + +export declare interface CollectionsModelGetNull200Response extends HttpResponse { + status: "200"; + body: CollectionsModelPropertyOutput; +} + +export declare type CollectionsModelGetNullParameters = RequestParameters; + +export declare interface CollectionsModelPatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsModelPatchNonNullBodyParam { + body: CollectionsModelPropertyResourceMergeAndPatch; +} + +export declare interface CollectionsModelPatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type CollectionsModelPatchNonNullParameters = CollectionsModelPatchNonNullMediaTypesParam & CollectionsModelPatchNonNullBodyParam & RequestParameters; + +export declare interface CollectionsModelPatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsModelPatchNullBodyParam { + body: CollectionsModelPropertyResourceMergeAndPatch; +} + +export declare interface CollectionsModelPatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type CollectionsModelPatchNullParameters = CollectionsModelPatchNullMediaTypesParam & CollectionsModelPatchNullBodyParam & RequestParameters; + +export declare interface CollectionsModelProperty { + requiredProperty: string; + nullableProperty: Array | null; +} + +export declare interface CollectionsModelPropertyOutput { + requiredProperty: string; + nullableProperty: Array | null; +} + +export declare type CollectionsModelPropertyResourceMergeAndPatch = Partial; + +export declare interface CollectionsStringGetNonNull { + get(options?: CollectionsStringGetNonNullParameters): StreamableMethod; + patch(options: CollectionsStringPatchNonNullParameters): StreamableMethod; +} + +export declare interface CollectionsStringGetNonNull200Response extends HttpResponse { + status: "200"; + body: CollectionsStringPropertyOutput; +} + +export declare type CollectionsStringGetNonNullParameters = RequestParameters; + +export declare interface CollectionsStringGetNull { + get(options?: CollectionsStringGetNullParameters): StreamableMethod; + patch(options: CollectionsStringPatchNullParameters): StreamableMethod; +} + +export declare interface CollectionsStringGetNull200Response extends HttpResponse { + status: "200"; + body: CollectionsStringPropertyOutput; +} + +export declare type CollectionsStringGetNullParameters = RequestParameters; + +export declare interface CollectionsStringPatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsStringPatchNonNullBodyParam { + body: CollectionsStringPropertyResourceMergeAndPatch; +} + +export declare interface CollectionsStringPatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type CollectionsStringPatchNonNullParameters = CollectionsStringPatchNonNullMediaTypesParam & CollectionsStringPatchNonNullBodyParam & RequestParameters; + +export declare interface CollectionsStringPatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsStringPatchNullBodyParam { + body: CollectionsStringPropertyResourceMergeAndPatch; +} + +export declare interface CollectionsStringPatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type CollectionsStringPatchNullParameters = CollectionsStringPatchNullMediaTypesParam & CollectionsStringPatchNullBodyParam & RequestParameters; + +export declare interface CollectionsStringProperty { + requiredProperty: string; + nullableProperty: string[] | null; +} + +export declare interface CollectionsStringPropertyOutput { + requiredProperty: string; + nullableProperty: string[] | null; +} + +export declare type CollectionsStringPropertyResourceMergeAndPatch = Partial; + +declare function createClient(options?: NullableClientOptions): NullableClient; +export default createClient; + +export declare interface DatetimeGetNonNull { + get(options?: DatetimeGetNonNullParameters): StreamableMethod; + patch(options: DatetimePatchNonNullParameters): StreamableMethod; +} + +export declare interface DatetimeGetNonNull200Response extends HttpResponse { + status: "200"; + body: DatetimePropertyOutput; +} + +export declare type DatetimeGetNonNullParameters = RequestParameters; + +export declare interface DatetimeGetNull { + get(options?: DatetimeGetNullParameters): StreamableMethod; + patch(options: DatetimePatchNullParameters): StreamableMethod; +} + +export declare interface DatetimeGetNull200Response extends HttpResponse { + status: "200"; + body: DatetimePropertyOutput; +} + +export declare type DatetimeGetNullParameters = RequestParameters; + +export declare interface DatetimePatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimePatchNonNullBodyParam { + body: DatetimePropertyResourceMergeAndPatch; +} + +export declare interface DatetimePatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type DatetimePatchNonNullParameters = DatetimePatchNonNullMediaTypesParam & DatetimePatchNonNullBodyParam & RequestParameters; + +export declare interface DatetimePatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimePatchNullBodyParam { + body: DatetimePropertyResourceMergeAndPatch; +} + +export declare interface DatetimePatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type DatetimePatchNullParameters = DatetimePatchNullMediaTypesParam & DatetimePatchNullBodyParam & RequestParameters; + +export declare interface DatetimeProperty { + requiredProperty: string; + nullableProperty: Date | string | null; +} + +export declare interface DatetimePropertyOutput { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare type DatetimePropertyResourceMergeAndPatch = Partial; + +export declare interface DurationGetNonNull { + get(options?: DurationGetNonNullParameters): StreamableMethod; + patch(options: DurationPatchNonNullParameters): StreamableMethod; +} + +export declare interface DurationGetNonNull200Response extends HttpResponse { + status: "200"; + body: DurationPropertyOutput; +} + +export declare type DurationGetNonNullParameters = RequestParameters; + +export declare interface DurationGetNull { + get(options?: DurationGetNullParameters): StreamableMethod; + patch(options: DurationPatchNullParameters): StreamableMethod; +} + +export declare interface DurationGetNull200Response extends HttpResponse { + status: "200"; + body: DurationPropertyOutput; +} + +export declare type DurationGetNullParameters = RequestParameters; + +export declare interface DurationPatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationPatchNonNullBodyParam { + body: DurationPropertyResourceMergeAndPatch; +} + +export declare interface DurationPatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type DurationPatchNonNullParameters = DurationPatchNonNullMediaTypesParam & DurationPatchNonNullBodyParam & RequestParameters; + +export declare interface DurationPatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationPatchNullBodyParam { + body: DurationPropertyResourceMergeAndPatch; +} + +export declare interface DurationPatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type DurationPatchNullParameters = DurationPatchNullMediaTypesParam & DurationPatchNullBodyParam & RequestParameters; + +export declare interface DurationProperty { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare interface DurationPropertyOutput { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare type DurationPropertyResourceMergeAndPatch = Partial; + +export declare interface InnerModel { + property: string; +} + +export declare interface InnerModelOutput { + property: string; +} + +export declare type NullableClient = Client & { + path: Routes; +}; + +export declare interface NullableClientOptions extends ClientOptions { +} + +export declare interface Routes { + (path: "/type/property/nullable/string/non-null"): StringModelGetNonNull; + (path: "/type/property/nullable/string/null"): StringModelGetNull; + (path: "/type/property/nullable/bytes/non-null"): BytesGetNonNull; + (path: "/type/property/nullable/bytes/null"): BytesGetNull; + (path: "/type/property/nullable/datetime/non-null"): DatetimeGetNonNull; + (path: "/type/property/nullable/datetime/null"): DatetimeGetNull; + (path: "/type/property/nullable/duration/non-null"): DurationGetNonNull; + (path: "/type/property/nullable/duration/null"): DurationGetNull; + (path: "/type/property/nullable/collections/bytes/non-null"): CollectionsByteGetNonNull; + (path: "/type/property/nullable/collections/bytes/null"): CollectionsByteGetNull; + (path: "/type/property/nullable/collections/model/non-null"): CollectionsModelGetNonNull; + (path: "/type/property/nullable/collections/model/null"): CollectionsModelGetNull; + (path: "/type/property/nullable/collections/string/non-null"): CollectionsStringGetNonNull; + (path: "/type/property/nullable/collections/string/null"): CollectionsStringGetNull; +} + +export declare interface StringModelGetNonNull { + get(options?: StringModelGetNonNullParameters): StreamableMethod; + patch(options: StringModelPatchNonNullParameters): StreamableMethod; +} + +export declare interface StringModelGetNonNull200Response extends HttpResponse { + status: "200"; + body: StringPropertyOutput; +} + +export declare type StringModelGetNonNullParameters = RequestParameters; + +export declare interface StringModelGetNull { + get(options?: StringModelGetNullParameters): StreamableMethod; + patch(options: StringModelPatchNullParameters): StreamableMethod; +} + +export declare interface StringModelGetNull200Response extends HttpResponse { + status: "200"; + body: StringPropertyOutput; +} + +export declare type StringModelGetNullParameters = RequestParameters; + +export declare interface StringModelPatchNonNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringModelPatchNonNullBodyParam { + body: StringPropertyResourceMergeAndPatch; +} + +export declare interface StringModelPatchNonNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type StringModelPatchNonNullParameters = StringModelPatchNonNullMediaTypesParam & StringModelPatchNonNullBodyParam & RequestParameters; + +export declare interface StringModelPatchNull204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringModelPatchNullBodyParam { + body: StringPropertyResourceMergeAndPatch; +} + +export declare interface StringModelPatchNullMediaTypesParam { + contentType: "application/merge-patch+json"; +} + +export declare type StringModelPatchNullParameters = StringModelPatchNullMediaTypesParam & StringModelPatchNullBodyParam & RequestParameters; + +export declare interface StringProperty { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare interface StringPropertyOutput { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare type StringPropertyResourceMergeAndPatch = Partial; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/tspconfig.yaml new file mode 100644 index 0000000000..dfb89d0cdd --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/nullable/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/nullable-property" + description: "Nullable Property Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/src/index.d.ts new file mode 100644 index 0000000000..375f882bef --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/src/index.d.ts @@ -0,0 +1,886 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface BooleanLiteralGetAll { + get(options?: BooleanLiteralGetAllParameters): StreamableMethod; + put(options: BooleanLiteralPutAllParameters): StreamableMethod; +} + +export declare interface BooleanLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: BooleanLiteralPropertyOutput; +} + +export declare type BooleanLiteralGetAllParameters = RequestParameters; + +export declare interface BooleanLiteralGetDefault { + get(options?: BooleanLiteralGetDefaultParameters): StreamableMethod; + put(options: BooleanLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface BooleanLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: BooleanLiteralPropertyOutput; +} + +export declare type BooleanLiteralGetDefaultParameters = RequestParameters; + +export declare interface BooleanLiteralProperty { + property?: true; +} + +export declare interface BooleanLiteralPropertyOutput { + property?: true; +} + +export declare interface BooleanLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanLiteralPutAllBodyParam { + body: BooleanLiteralProperty; +} + +export declare type BooleanLiteralPutAllParameters = BooleanLiteralPutAllBodyParam & RequestParameters; + +export declare interface BooleanLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanLiteralPutDefaultBodyParam { + body: BooleanLiteralProperty; +} + +export declare type BooleanLiteralPutDefaultParameters = BooleanLiteralPutDefaultBodyParam & RequestParameters; + +export declare interface BytesGetAll { + get(options?: BytesGetAllParameters): StreamableMethod; + put(options: BytesPutAllParameters): StreamableMethod; +} + +export declare interface BytesGetAll200Response extends HttpResponse { + status: "200"; + body: BytesPropertyOutput; +} + +export declare type BytesGetAllParameters = RequestParameters; + +export declare interface BytesGetDefault { + get(options?: BytesGetDefaultParameters): StreamableMethod; + put(options: BytesPutDefaultParameters): StreamableMethod; +} + +export declare interface BytesGetDefault200Response extends HttpResponse { + status: "200"; + body: BytesPropertyOutput; +} + +export declare type BytesGetDefaultParameters = RequestParameters; + +export declare interface BytesProperty { + property?: string; +} + +export declare interface BytesPropertyOutput { + property?: string; +} + +export declare interface BytesPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface BytesPutAllBodyParam { + body: BytesProperty; +} + +export declare type BytesPutAllParameters = BytesPutAllBodyParam & RequestParameters; + +export declare interface BytesPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface BytesPutDefaultBodyParam { + body: BytesProperty; +} + +export declare type BytesPutDefaultParameters = BytesPutDefaultBodyParam & RequestParameters; + +export declare interface CollectionsByteGetAll { + get(options?: CollectionsByteGetAllParameters): StreamableMethod; + put(options: CollectionsBytePutAllParameters): StreamableMethod; +} + +export declare interface CollectionsByteGetAll200Response extends HttpResponse { + status: "200"; + body: CollectionsBytePropertyOutput; +} + +export declare type CollectionsByteGetAllParameters = RequestParameters; + +export declare interface CollectionsByteGetDefault { + get(options?: CollectionsByteGetDefaultParameters): StreamableMethod; + put(options: CollectionsBytePutDefaultParameters): StreamableMethod; +} + +export declare interface CollectionsByteGetDefault200Response extends HttpResponse { + status: "200"; + body: CollectionsBytePropertyOutput; +} + +export declare type CollectionsByteGetDefaultParameters = RequestParameters; + +export declare interface CollectionsByteProperty { + property?: string[]; +} + +export declare interface CollectionsBytePropertyOutput { + property?: string[]; +} + +export declare interface CollectionsBytePutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsBytePutAllBodyParam { + body: CollectionsByteProperty; +} + +export declare type CollectionsBytePutAllParameters = CollectionsBytePutAllBodyParam & RequestParameters; + +export declare interface CollectionsBytePutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsBytePutDefaultBodyParam { + body: CollectionsByteProperty; +} + +export declare type CollectionsBytePutDefaultParameters = CollectionsBytePutDefaultBodyParam & RequestParameters; + +export declare interface CollectionsModelGetAll { + get(options?: CollectionsModelGetAllParameters): StreamableMethod; + put(options: CollectionsModelPutAllParameters): StreamableMethod; +} + +export declare interface CollectionsModelGetAll200Response extends HttpResponse { + status: "200"; + body: CollectionsModelPropertyOutput; +} + +export declare type CollectionsModelGetAllParameters = RequestParameters; + +export declare interface CollectionsModelGetDefault { + get(options?: CollectionsModelGetDefaultParameters): StreamableMethod; + put(options: CollectionsModelPutDefaultParameters): StreamableMethod; +} + +export declare interface CollectionsModelGetDefault200Response extends HttpResponse { + status: "200"; + body: CollectionsModelPropertyOutput; +} + +export declare type CollectionsModelGetDefaultParameters = RequestParameters; + +export declare interface CollectionsModelProperty { + property?: Array; +} + +export declare interface CollectionsModelPropertyOutput { + property?: Array; +} + +export declare interface CollectionsModelPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsModelPutAllBodyParam { + body: CollectionsModelProperty; +} + +export declare type CollectionsModelPutAllParameters = CollectionsModelPutAllBodyParam & RequestParameters; + +export declare interface CollectionsModelPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsModelPutDefaultBodyParam { + body: CollectionsModelProperty; +} + +export declare type CollectionsModelPutDefaultParameters = CollectionsModelPutDefaultBodyParam & RequestParameters; + +declare function createClient(options?: OptionalClientOptions): OptionalClient; +export default createClient; + +export declare interface DatetimeGetAll { + get(options?: DatetimeGetAllParameters): StreamableMethod; + put(options: DatetimePutAllParameters): StreamableMethod; +} + +export declare interface DatetimeGetAll200Response extends HttpResponse { + status: "200"; + body: DatetimePropertyOutput; +} + +export declare type DatetimeGetAllParameters = RequestParameters; + +export declare interface DatetimeGetDefault { + get(options?: DatetimeGetDefaultParameters): StreamableMethod; + put(options: DatetimePutDefaultParameters): StreamableMethod; +} + +export declare interface DatetimeGetDefault200Response extends HttpResponse { + status: "200"; + body: DatetimePropertyOutput; +} + +export declare type DatetimeGetDefaultParameters = RequestParameters; + +export declare interface DatetimeProperty { + property?: Date | string; +} + +export declare interface DatetimePropertyOutput { + property?: string; +} + +export declare interface DatetimePutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimePutAllBodyParam { + body: DatetimeProperty; +} + +export declare type DatetimePutAllParameters = DatetimePutAllBodyParam & RequestParameters; + +export declare interface DatetimePutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimePutDefaultBodyParam { + body: DatetimeProperty; +} + +export declare type DatetimePutDefaultParameters = DatetimePutDefaultBodyParam & RequestParameters; + +export declare interface DurationGetAll { + get(options?: DurationGetAllParameters): StreamableMethod; + put(options: DurationPutAllParameters): StreamableMethod; +} + +export declare interface DurationGetAll200Response extends HttpResponse { + status: "200"; + body: DurationPropertyOutput; +} + +export declare type DurationGetAllParameters = RequestParameters; + +export declare interface DurationGetDefault { + get(options?: DurationGetDefaultParameters): StreamableMethod; + put(options: DurationPutDefaultParameters): StreamableMethod; +} + +export declare interface DurationGetDefault200Response extends HttpResponse { + status: "200"; + body: DurationPropertyOutput; +} + +export declare type DurationGetDefaultParameters = RequestParameters; + +export declare interface DurationProperty { + property?: string; +} + +export declare interface DurationPropertyOutput { + property?: string; +} + +export declare interface DurationPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationPutAllBodyParam { + body: DurationProperty; +} + +export declare type DurationPutAllParameters = DurationPutAllBodyParam & RequestParameters; + +export declare interface DurationPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationPutDefaultBodyParam { + body: DurationProperty; +} + +export declare type DurationPutDefaultParameters = DurationPutDefaultBodyParam & RequestParameters; + +export declare interface FloatLiteralGetAll { + get(options?: FloatLiteralGetAllParameters): StreamableMethod; + put(options: FloatLiteralPutAllParameters): StreamableMethod; +} + +export declare interface FloatLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: FloatLiteralPropertyOutput; +} + +export declare type FloatLiteralGetAllParameters = RequestParameters; + +export declare interface FloatLiteralGetDefault { + get(options?: FloatLiteralGetDefaultParameters): StreamableMethod; + put(options: FloatLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface FloatLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: FloatLiteralPropertyOutput; +} + +export declare type FloatLiteralGetDefaultParameters = RequestParameters; + +export declare interface FloatLiteralProperty { + property?: 1.25; +} + +export declare interface FloatLiteralPropertyOutput { + property?: 1.25; +} + +export declare interface FloatLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface FloatLiteralPutAllBodyParam { + body: FloatLiteralProperty; +} + +export declare type FloatLiteralPutAllParameters = FloatLiteralPutAllBodyParam & RequestParameters; + +export declare interface FloatLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface FloatLiteralPutDefaultBodyParam { + body: FloatLiteralProperty; +} + +export declare type FloatLiteralPutDefaultParameters = FloatLiteralPutDefaultBodyParam & RequestParameters; + +export declare interface IntLiteralGetAll { + get(options?: IntLiteralGetAllParameters): StreamableMethod; + put(options: IntLiteralPutAllParameters): StreamableMethod; +} + +export declare interface IntLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: IntLiteralPropertyOutput; +} + +export declare type IntLiteralGetAllParameters = RequestParameters; + +export declare interface IntLiteralGetDefault { + get(options?: IntLiteralGetDefaultParameters): StreamableMethod; + put(options: IntLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface IntLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: IntLiteralPropertyOutput; +} + +export declare type IntLiteralGetDefaultParameters = RequestParameters; + +export declare interface IntLiteralProperty { + property?: 1; +} + +export declare interface IntLiteralPropertyOutput { + property?: 1; +} + +export declare interface IntLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface IntLiteralPutAllBodyParam { + body: IntLiteralProperty; +} + +export declare type IntLiteralPutAllParameters = IntLiteralPutAllBodyParam & RequestParameters; + +export declare interface IntLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface IntLiteralPutDefaultBodyParam { + body: IntLiteralProperty; +} + +export declare type IntLiteralPutDefaultParameters = IntLiteralPutDefaultBodyParam & RequestParameters; + +export declare type OptionalClient = Client & { + path: Routes; +}; + +export declare interface OptionalClientOptions extends ClientOptions { +} + +export declare interface PlainDateGetAll { + get(options?: PlainDateGetAllParameters): StreamableMethod; + put(options: PlainDatePutAllParameters): StreamableMethod; +} + +export declare interface PlainDateGetAll200Response extends HttpResponse { + status: "200"; + body: PlainDatePropertyOutput; +} + +export declare type PlainDateGetAllParameters = RequestParameters; + +export declare interface PlainDateGetDefault { + get(options?: PlainDateGetDefaultParameters): StreamableMethod; + put(options: PlainDatePutDefaultParameters): StreamableMethod; +} + +export declare interface PlainDateGetDefault200Response extends HttpResponse { + status: "200"; + body: PlainDatePropertyOutput; +} + +export declare type PlainDateGetDefaultParameters = RequestParameters; + +export declare interface PlainDateProperty { + property?: string; +} + +export declare interface PlainDatePropertyOutput { + property?: string; +} + +export declare interface PlainDatePutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface PlainDatePutAllBodyParam { + body: PlainDateProperty; +} + +export declare type PlainDatePutAllParameters = PlainDatePutAllBodyParam & RequestParameters; + +export declare interface PlainDatePutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface PlainDatePutDefaultBodyParam { + body: PlainDateProperty; +} + +export declare type PlainDatePutDefaultParameters = PlainDatePutDefaultBodyParam & RequestParameters; + +export declare interface PlainTimeGetAll { + get(options?: PlainTimeGetAllParameters): StreamableMethod; + put(options: PlainTimePutAllParameters): StreamableMethod; +} + +export declare interface PlainTimeGetAll200Response extends HttpResponse { + status: "200"; + body: PlainTimePropertyOutput; +} + +export declare type PlainTimeGetAllParameters = RequestParameters; + +export declare interface PlainTimeGetDefault { + get(options?: PlainTimeGetDefaultParameters): StreamableMethod; + put(options: PlainTimePutDefaultParameters): StreamableMethod; +} + +export declare interface PlainTimeGetDefault200Response extends HttpResponse { + status: "200"; + body: PlainTimePropertyOutput; +} + +export declare type PlainTimeGetDefaultParameters = RequestParameters; + +export declare interface PlainTimeProperty { + property?: string; +} + +export declare interface PlainTimePropertyOutput { + property?: string; +} + +export declare interface PlainTimePutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface PlainTimePutAllBodyParam { + body: PlainTimeProperty; +} + +export declare type PlainTimePutAllParameters = PlainTimePutAllBodyParam & RequestParameters; + +export declare interface PlainTimePutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface PlainTimePutDefaultBodyParam { + body: PlainTimeProperty; +} + +export declare type PlainTimePutDefaultParameters = PlainTimePutDefaultBodyParam & RequestParameters; + +export declare interface RequiredAndOptionalGetAll { + get(options?: RequiredAndOptionalGetAllParameters): StreamableMethod; + put(options: RequiredAndOptionalPutAllParameters): StreamableMethod; +} + +export declare interface RequiredAndOptionalGetAll200Response extends HttpResponse { + status: "200"; + body: RequiredAndOptionalPropertyOutput; +} + +export declare type RequiredAndOptionalGetAllParameters = RequestParameters; + +export declare interface RequiredAndOptionalGetRequiredOnly { + get(options?: RequiredAndOptionalGetRequiredOnlyParameters): StreamableMethod; + put(options: RequiredAndOptionalPutRequiredOnlyParameters): StreamableMethod; +} + +export declare interface RequiredAndOptionalGetRequiredOnly200Response extends HttpResponse { + status: "200"; + body: RequiredAndOptionalPropertyOutput; +} + +export declare type RequiredAndOptionalGetRequiredOnlyParameters = RequestParameters; + +export declare interface RequiredAndOptionalProperty { + optionalProperty?: string; + requiredProperty: number; +} + +export declare interface RequiredAndOptionalPropertyOutput { + optionalProperty?: string; + requiredProperty: number; +} + +export declare interface RequiredAndOptionalPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequiredAndOptionalPutAllBodyParam { + body: RequiredAndOptionalProperty; +} + +export declare type RequiredAndOptionalPutAllParameters = RequiredAndOptionalPutAllBodyParam & RequestParameters; + +export declare interface RequiredAndOptionalPutRequiredOnly204Response extends HttpResponse { + status: "204"; +} + +export declare interface RequiredAndOptionalPutRequiredOnlyBodyParam { + body: RequiredAndOptionalProperty; +} + +export declare type RequiredAndOptionalPutRequiredOnlyParameters = RequiredAndOptionalPutRequiredOnlyBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/property/optional/string/all"): StringModelGetAll; + (path: "/type/property/optional/string/default"): StringModelGetDefault; + (path: "/type/property/optional/bytes/all"): BytesGetAll; + (path: "/type/property/optional/bytes/default"): BytesGetDefault; + (path: "/type/property/optional/datetime/all"): DatetimeGetAll; + (path: "/type/property/optional/datetime/default"): DatetimeGetDefault; + (path: "/type/property/optional/duration/all"): DurationGetAll; + (path: "/type/property/optional/duration/default"): DurationGetDefault; + (path: "/type/property/optional/plainDate/all"): PlainDateGetAll; + (path: "/type/property/optional/plainDate/default"): PlainDateGetDefault; + (path: "/type/property/optional/plainTime/all"): PlainTimeGetAll; + (path: "/type/property/optional/plainTime/default"): PlainTimeGetDefault; + (path: "/type/property/optional/collections/bytes/all"): CollectionsByteGetAll; + (path: "/type/property/optional/collections/bytes/default"): CollectionsByteGetDefault; + (path: "/type/property/optional/collections/model/all"): CollectionsModelGetAll; + (path: "/type/property/optional/collections/model/default"): CollectionsModelGetDefault; + (path: "/type/property/optional/string/literal/all"): StringLiteralGetAll; + (path: "/type/property/optional/string/literal/default"): StringLiteralGetDefault; + (path: "/type/property/optional/int/literal/all"): IntLiteralGetAll; + (path: "/type/property/optional/int/literal/default"): IntLiteralGetDefault; + (path: "/type/property/optional/float/literal/all"): FloatLiteralGetAll; + (path: "/type/property/optional/float/literal/default"): FloatLiteralGetDefault; + (path: "/type/property/optional/boolean/literal/all"): BooleanLiteralGetAll; + (path: "/type/property/optional/boolean/literal/default"): BooleanLiteralGetDefault; + (path: "/type/property/optional/union/string/literal/all"): UnionStringLiteralGetAll; + (path: "/type/property/optional/union/string/literal/default"): UnionStringLiteralGetDefault; + (path: "/type/property/optional/union/int/literal/all"): UnionIntLiteralGetAll; + (path: "/type/property/optional/union/int/literal/default"): UnionIntLiteralGetDefault; + (path: "/type/property/optional/union/float/literal/all"): UnionFloatLiteralGetAll; + (path: "/type/property/optional/union/float/literal/default"): UnionFloatLiteralGetDefault; + (path: "/type/property/optional/requiredAndOptional/all"): RequiredAndOptionalGetAll; + (path: "/type/property/optional/requiredAndOptional/requiredOnly"): RequiredAndOptionalGetRequiredOnly; +} + +export declare interface StringLiteralGetAll { + get(options?: StringLiteralGetAllParameters): StreamableMethod; + put(options: StringLiteralPutAllParameters): StreamableMethod; +} + +export declare interface StringLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: StringLiteralPropertyOutput; +} + +export declare type StringLiteralGetAllParameters = RequestParameters; + +export declare interface StringLiteralGetDefault { + get(options?: StringLiteralGetDefaultParameters): StreamableMethod; + put(options: StringLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface StringLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: StringLiteralPropertyOutput; +} + +export declare type StringLiteralGetDefaultParameters = RequestParameters; + +export declare interface StringLiteralProperty { + property?: "hello"; +} + +export declare interface StringLiteralPropertyOutput { + property?: "hello"; +} + +export declare interface StringLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringLiteralPutAllBodyParam { + body: StringLiteralProperty; +} + +export declare type StringLiteralPutAllParameters = StringLiteralPutAllBodyParam & RequestParameters; + +export declare interface StringLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringLiteralPutDefaultBodyParam { + body: StringLiteralProperty; +} + +export declare type StringLiteralPutDefaultParameters = StringLiteralPutDefaultBodyParam & RequestParameters; + +export declare interface StringModelGetAll { + get(options?: StringModelGetAllParameters): StreamableMethod; + put(options: StringModelPutAllParameters): StreamableMethod; +} + +export declare interface StringModelGetAll200Response extends HttpResponse { + status: "200"; + body: StringPropertyOutput; +} + +export declare type StringModelGetAllParameters = RequestParameters; + +export declare interface StringModelGetDefault { + get(options?: StringModelGetDefaultParameters): StreamableMethod; + put(options: StringModelPutDefaultParameters): StreamableMethod; +} + +export declare interface StringModelGetDefault200Response extends HttpResponse { + status: "200"; + body: StringPropertyOutput; +} + +export declare type StringModelGetDefaultParameters = RequestParameters; + +export declare interface StringModelPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringModelPutAllBodyParam { + body: StringProperty; +} + +export declare type StringModelPutAllParameters = StringModelPutAllBodyParam & RequestParameters; + +export declare interface StringModelPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringModelPutDefaultBodyParam { + body: StringProperty; +} + +export declare type StringModelPutDefaultParameters = StringModelPutDefaultBodyParam & RequestParameters; + +export declare interface StringProperty { + property?: string; +} + +export declare interface StringPropertyOutput { + property?: string; +} + +export declare interface UnionFloatLiteralGetAll { + get(options?: UnionFloatLiteralGetAllParameters): StreamableMethod; + put(options: UnionFloatLiteralPutAllParameters): StreamableMethod; +} + +export declare interface UnionFloatLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: UnionFloatLiteralPropertyOutput; +} + +export declare type UnionFloatLiteralGetAllParameters = RequestParameters; + +export declare interface UnionFloatLiteralGetDefault { + get(options?: UnionFloatLiteralGetDefaultParameters): StreamableMethod; + put(options: UnionFloatLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface UnionFloatLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: UnionFloatLiteralPropertyOutput; +} + +export declare type UnionFloatLiteralGetDefaultParameters = RequestParameters; + +export declare interface UnionFloatLiteralProperty { + property?: 1.25 | 2.375; +} + +export declare interface UnionFloatLiteralPropertyOutput { + property?: 1.25 | 2.375; +} + +export declare interface UnionFloatLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionFloatLiteralPutAllBodyParam { + body: UnionFloatLiteralProperty; +} + +export declare type UnionFloatLiteralPutAllParameters = UnionFloatLiteralPutAllBodyParam & RequestParameters; + +export declare interface UnionFloatLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionFloatLiteralPutDefaultBodyParam { + body: UnionFloatLiteralProperty; +} + +export declare type UnionFloatLiteralPutDefaultParameters = UnionFloatLiteralPutDefaultBodyParam & RequestParameters; + +export declare interface UnionIntLiteralGetAll { + get(options?: UnionIntLiteralGetAllParameters): StreamableMethod; + put(options: UnionIntLiteralPutAllParameters): StreamableMethod; +} + +export declare interface UnionIntLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: UnionIntLiteralPropertyOutput; +} + +export declare type UnionIntLiteralGetAllParameters = RequestParameters; + +export declare interface UnionIntLiteralGetDefault { + get(options?: UnionIntLiteralGetDefaultParameters): StreamableMethod; + put(options: UnionIntLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface UnionIntLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: UnionIntLiteralPropertyOutput; +} + +export declare type UnionIntLiteralGetDefaultParameters = RequestParameters; + +export declare interface UnionIntLiteralProperty { + property?: 1 | 2; +} + +export declare interface UnionIntLiteralPropertyOutput { + property?: 1 | 2; +} + +export declare interface UnionIntLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionIntLiteralPutAllBodyParam { + body: UnionIntLiteralProperty; +} + +export declare type UnionIntLiteralPutAllParameters = UnionIntLiteralPutAllBodyParam & RequestParameters; + +export declare interface UnionIntLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionIntLiteralPutDefaultBodyParam { + body: UnionIntLiteralProperty; +} + +export declare type UnionIntLiteralPutDefaultParameters = UnionIntLiteralPutDefaultBodyParam & RequestParameters; + +export declare interface UnionStringLiteralGetAll { + get(options?: UnionStringLiteralGetAllParameters): StreamableMethod; + put(options: UnionStringLiteralPutAllParameters): StreamableMethod; +} + +export declare interface UnionStringLiteralGetAll200Response extends HttpResponse { + status: "200"; + body: UnionStringLiteralPropertyOutput; +} + +export declare type UnionStringLiteralGetAllParameters = RequestParameters; + +export declare interface UnionStringLiteralGetDefault { + get(options?: UnionStringLiteralGetDefaultParameters): StreamableMethod; + put(options: UnionStringLiteralPutDefaultParameters): StreamableMethod; +} + +export declare interface UnionStringLiteralGetDefault200Response extends HttpResponse { + status: "200"; + body: UnionStringLiteralPropertyOutput; +} + +export declare type UnionStringLiteralGetDefaultParameters = RequestParameters; + +export declare interface UnionStringLiteralProperty { + property?: "hello" | "world"; +} + +export declare interface UnionStringLiteralPropertyOutput { + property?: "hello" | "world"; +} + +export declare interface UnionStringLiteralPutAll204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionStringLiteralPutAllBodyParam { + body: UnionStringLiteralProperty; +} + +export declare type UnionStringLiteralPutAllParameters = UnionStringLiteralPutAllBodyParam & RequestParameters; + +export declare interface UnionStringLiteralPutDefault204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionStringLiteralPutDefaultBodyParam { + body: UnionStringLiteralProperty; +} + +export declare type UnionStringLiteralPutDefaultParameters = UnionStringLiteralPutDefaultBodyParam & RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/tspconfig.yaml new file mode 100644 index 0000000000..8c5957d744 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/optionality/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/optional-property" + description: "Optional Property Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/src/index.d.ts new file mode 100644 index 0000000000..b2427ae1b9 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/src/index.d.ts @@ -0,0 +1,933 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface BooleanLiteralGet { + get(options?: BooleanLiteralGetParameters): StreamableMethod; + put(options: BooleanLiteralPutParameters): StreamableMethod; +} + +export declare interface BooleanLiteralGet200Response extends HttpResponse { + status: "200"; + body: BooleanLiteralPropertyOutput; +} + +export declare type BooleanLiteralGetParameters = RequestParameters; + +export declare interface BooleanLiteralProperty { + property: true; +} + +export declare interface BooleanLiteralPropertyOutput { + property: true; +} + +export declare interface BooleanLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanLiteralPutBodyParam { + body: BooleanLiteralProperty; +} + +export declare type BooleanLiteralPutParameters = BooleanLiteralPutBodyParam & RequestParameters; + +export declare interface BooleanModelGet { + get(options?: BooleanModelGetParameters): StreamableMethod; + put(options: BooleanModelPutParameters): StreamableMethod; +} + +export declare interface BooleanModelGet200Response extends HttpResponse { + status: "200"; + body: BooleanPropertyOutput; +} + +export declare type BooleanModelGetParameters = RequestParameters; + +export declare interface BooleanModelPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanModelPutBodyParam { + body: BooleanProperty; +} + +export declare type BooleanModelPutParameters = BooleanModelPutBodyParam & RequestParameters; + +export declare interface BooleanProperty { + property: boolean; +} + +export declare interface BooleanPropertyOutput { + property: boolean; +} + +export declare interface BytesGet { + get(options?: BytesGetParameters): StreamableMethod; + put(options: BytesPutParameters): StreamableMethod; +} + +export declare interface BytesGet200Response extends HttpResponse { + status: "200"; + body: BytesPropertyOutput; +} + +export declare type BytesGetParameters = RequestParameters; + +export declare interface BytesProperty { + property: string; +} + +export declare interface BytesPropertyOutput { + property: string; +} + +export declare interface BytesPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface BytesPutBodyParam { + body: BytesProperty; +} + +export declare type BytesPutParameters = BytesPutBodyParam & RequestParameters; + +export declare interface CollectionsIntGet { + get(options?: CollectionsIntGetParameters): StreamableMethod; + put(options: CollectionsIntPutParameters): StreamableMethod; +} + +export declare interface CollectionsIntGet200Response extends HttpResponse { + status: "200"; + body: CollectionsIntPropertyOutput; +} + +export declare type CollectionsIntGetParameters = RequestParameters; + +export declare interface CollectionsIntProperty { + property: number[]; +} + +export declare interface CollectionsIntPropertyOutput { + property: number[]; +} + +export declare interface CollectionsIntPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsIntPutBodyParam { + body: CollectionsIntProperty; +} + +export declare type CollectionsIntPutParameters = CollectionsIntPutBodyParam & RequestParameters; + +export declare interface CollectionsModelGet { + get(options?: CollectionsModelGetParameters): StreamableMethod; + put(options: CollectionsModelPutParameters): StreamableMethod; +} + +export declare interface CollectionsModelGet200Response extends HttpResponse { + status: "200"; + body: CollectionsModelPropertyOutput; +} + +export declare type CollectionsModelGetParameters = RequestParameters; + +export declare interface CollectionsModelProperty { + property: Array; +} + +export declare interface CollectionsModelPropertyOutput { + property: Array; +} + +export declare interface CollectionsModelPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsModelPutBodyParam { + body: CollectionsModelProperty; +} + +export declare type CollectionsModelPutParameters = CollectionsModelPutBodyParam & RequestParameters; + +export declare interface CollectionsStringGet { + get(options?: CollectionsStringGetParameters): StreamableMethod; + put(options: CollectionsStringPutParameters): StreamableMethod; +} + +export declare interface CollectionsStringGet200Response extends HttpResponse { + status: "200"; + body: CollectionsStringPropertyOutput; +} + +export declare type CollectionsStringGetParameters = RequestParameters; + +export declare interface CollectionsStringProperty { + property: string[]; +} + +export declare interface CollectionsStringPropertyOutput { + property: string[]; +} + +export declare interface CollectionsStringPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface CollectionsStringPutBodyParam { + body: CollectionsStringProperty; +} + +export declare type CollectionsStringPutParameters = CollectionsStringPutBodyParam & RequestParameters; + +declare function createClient(options?: ValueTypesClientOptions): ValueTypesClient; +export default createClient; + +export declare interface DatetimeGet { + get(options?: DatetimeGetParameters): StreamableMethod; + put(options: DatetimePutParameters): StreamableMethod; +} + +export declare interface DatetimeGet200Response extends HttpResponse { + status: "200"; + body: DatetimePropertyOutput; +} + +export declare type DatetimeGetParameters = RequestParameters; + +export declare interface DatetimeProperty { + property: Date | string; +} + +export declare interface DatetimePropertyOutput { + property: string; +} + +export declare interface DatetimePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DatetimePutBodyParam { + body: DatetimeProperty; +} + +export declare type DatetimePutParameters = DatetimePutBodyParam & RequestParameters; + +export declare interface Decimal128Get { + get(options?: Decimal128GetParameters): StreamableMethod; + put(options: Decimal128PutParameters): StreamableMethod; +} + +export declare interface Decimal128Get200Response extends HttpResponse { + status: "200"; + body: Decimal128PropertyOutput; +} + +export declare type Decimal128GetParameters = RequestParameters; + +export declare interface Decimal128Property { + property: number; +} + +export declare interface Decimal128PropertyOutput { + property: number; +} + +export declare interface Decimal128Put204Response extends HttpResponse { + status: "204"; +} + +export declare interface Decimal128PutBodyParam { + body: Decimal128Property; +} + +export declare type Decimal128PutParameters = Decimal128PutBodyParam & RequestParameters; + +export declare interface DecimalGet { + get(options?: DecimalGetParameters): StreamableMethod; + put(options: DecimalPutParameters): StreamableMethod; +} + +export declare interface DecimalGet200Response extends HttpResponse { + status: "200"; + body: DecimalPropertyOutput; +} + +export declare type DecimalGetParameters = RequestParameters; + +export declare interface DecimalProperty { + property: number; +} + +export declare interface DecimalPropertyOutput { + property: number; +} + +export declare interface DecimalPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DecimalPutBodyParam { + body: DecimalProperty; +} + +export declare type DecimalPutParameters = DecimalPutBodyParam & RequestParameters; + +export declare interface DictionaryStringGet { + get(options?: DictionaryStringGetParameters): StreamableMethod; + put(options: DictionaryStringPutParameters): StreamableMethod; +} + +export declare interface DictionaryStringGet200Response extends HttpResponse { + status: "200"; + body: DictionaryStringPropertyOutput; +} + +export declare type DictionaryStringGetParameters = RequestParameters; + +export declare interface DictionaryStringProperty { + property: Record; +} + +export declare interface DictionaryStringPropertyOutput { + property: Record; +} + +export declare interface DictionaryStringPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DictionaryStringPutBodyParam { + body: DictionaryStringProperty; +} + +export declare type DictionaryStringPutParameters = DictionaryStringPutBodyParam & RequestParameters; + +export declare interface DurationGet { + get(options?: DurationGetParameters): StreamableMethod; + put(options: DurationPutParameters): StreamableMethod; +} + +export declare interface DurationGet200Response extends HttpResponse { + status: "200"; + body: DurationPropertyOutput; +} + +export declare type DurationGetParameters = RequestParameters; + +export declare interface DurationProperty { + property: string; +} + +export declare interface DurationPropertyOutput { + property: string; +} + +export declare interface DurationPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface DurationPutBodyParam { + body: DurationProperty; +} + +export declare type DurationPutParameters = DurationPutBodyParam & RequestParameters; + +export declare interface EnumGet { + get(options?: EnumGetParameters): StreamableMethod; + put(options: EnumPutParameters): StreamableMethod; +} + +export declare interface EnumGet200Response extends HttpResponse { + status: "200"; + body: EnumPropertyOutput; +} + +export declare type EnumGetParameters = RequestParameters; + +export declare interface EnumProperty { + property: FixedInnerEnum; +} + +export declare interface EnumPropertyOutput { + property: FixedInnerEnumOutput; +} + +export declare interface EnumPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface EnumPutBodyParam { + body: EnumProperty; +} + +export declare type EnumPutParameters = EnumPutBodyParam & RequestParameters; + +export declare interface ExtensibleEnumGet { + get(options?: ExtensibleEnumGetParameters): StreamableMethod; + put(options: ExtensibleEnumPutParameters): StreamableMethod; +} + +export declare interface ExtensibleEnumGet200Response extends HttpResponse { + status: "200"; + body: ExtensibleEnumPropertyOutput; +} + +export declare type ExtensibleEnumGetParameters = RequestParameters; + +export declare interface ExtensibleEnumProperty { + property: InnerEnum; +} + +export declare interface ExtensibleEnumPropertyOutput { + property: InnerEnumOutput; +} + +export declare interface ExtensibleEnumPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface ExtensibleEnumPutBodyParam { + body: ExtensibleEnumProperty; +} + +export declare type ExtensibleEnumPutParameters = ExtensibleEnumPutBodyParam & RequestParameters; + +export declare type FixedInnerEnum = "ValueOne" | "ValueTwo"; + +export declare type FixedInnerEnumOutput = "ValueOne" | "ValueTwo"; + +export declare interface FloatGet { + get(options?: FloatGetParameters): StreamableMethod; + put(options: FloatPutParameters): StreamableMethod; +} + +export declare interface FloatGet200Response extends HttpResponse { + status: "200"; + body: FloatPropertyOutput; +} + +export declare type FloatGetParameters = RequestParameters; + +export declare interface FloatLiteralGet { + get(options?: FloatLiteralGetParameters): StreamableMethod; + put(options: FloatLiteralPutParameters): StreamableMethod; +} + +export declare interface FloatLiteralGet200Response extends HttpResponse { + status: "200"; + body: FloatLiteralPropertyOutput; +} + +export declare type FloatLiteralGetParameters = RequestParameters; + +export declare interface FloatLiteralProperty { + property: 43.125; +} + +export declare interface FloatLiteralPropertyOutput { + property: 43.125; +} + +export declare interface FloatLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface FloatLiteralPutBodyParam { + body: FloatLiteralProperty; +} + +export declare type FloatLiteralPutParameters = FloatLiteralPutBodyParam & RequestParameters; + +export declare interface FloatProperty { + property: number; +} + +export declare interface FloatPropertyOutput { + property: number; +} + +export declare interface FloatPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface FloatPutBodyParam { + body: FloatProperty; +} + +export declare type FloatPutParameters = FloatPutBodyParam & RequestParameters; + +export declare type InnerEnum = string; + +export declare type InnerEnumOutput = string; + +export declare interface InnerModel { + property: string; +} + +export declare interface InnerModelOutput { + property: string; +} + +export declare interface IntGet { + get(options?: IntGetParameters): StreamableMethod; + put(options: IntPutParameters): StreamableMethod; +} + +export declare interface IntGet200Response extends HttpResponse { + status: "200"; + body: IntPropertyOutput; +} + +export declare type IntGetParameters = RequestParameters; + +export declare interface IntLiteralGet { + get(options?: IntLiteralGetParameters): StreamableMethod; + put(options: IntLiteralPutParameters): StreamableMethod; +} + +export declare interface IntLiteralGet200Response extends HttpResponse { + status: "200"; + body: IntLiteralPropertyOutput; +} + +export declare type IntLiteralGetParameters = RequestParameters; + +export declare interface IntLiteralProperty { + property: 42; +} + +export declare interface IntLiteralPropertyOutput { + property: 42; +} + +export declare interface IntLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface IntLiteralPutBodyParam { + body: IntLiteralProperty; +} + +export declare type IntLiteralPutParameters = IntLiteralPutBodyParam & RequestParameters; + +export declare interface IntProperty { + property: number; +} + +export declare interface IntPropertyOutput { + property: number; +} + +export declare interface IntPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface IntPutBodyParam { + body: IntProperty; +} + +export declare type IntPutParameters = IntPutBodyParam & RequestParameters; + +export declare interface ModelGet { + get(options?: ModelGetParameters): StreamableMethod; + put(options: ModelPutParameters): StreamableMethod; +} + +export declare interface ModelGet200Response extends HttpResponse { + status: "200"; + body: ModelPropertyOutput; +} + +export declare type ModelGetParameters = RequestParameters; + +export declare interface ModelProperty { + property: InnerModel; +} + +export declare interface ModelPropertyOutput { + property: InnerModelOutput; +} + +export declare interface ModelPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelPutBodyParam { + body: ModelProperty; +} + +export declare type ModelPutParameters = ModelPutBodyParam & RequestParameters; + +export declare interface NeverGet { + get(options?: NeverGetParameters): StreamableMethod; + put(options: NeverPutParameters): StreamableMethod; +} + +export declare interface NeverGet200Response extends HttpResponse { + status: "200"; + body: NeverPropertyOutput; +} + +export declare type NeverGetParameters = RequestParameters; + +export declare interface NeverProperty { +} + +export declare interface NeverPropertyOutput { +} + +export declare interface NeverPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface NeverPutBodyParam { + body: NeverProperty; +} + +export declare type NeverPutParameters = NeverPutBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/property/value-types/boolean"): BooleanModelGet; + (path: "/type/property/value-types/string"): StringModelGet; + (path: "/type/property/value-types/bytes"): BytesGet; + (path: "/type/property/value-types/int"): IntGet; + (path: "/type/property/value-types/float"): FloatGet; + (path: "/type/property/value-types/decimal"): DecimalGet; + (path: "/type/property/value-types/decimal128"): Decimal128Get; + (path: "/type/property/value-types/datetime"): DatetimeGet; + (path: "/type/property/value-types/duration"): DurationGet; + (path: "/type/property/value-types/enum"): EnumGet; + (path: "/type/property/value-types/extensible-enum"): ExtensibleEnumGet; + (path: "/type/property/value-types/model"): ModelGet; + (path: "/type/property/value-types/collections/string"): CollectionsStringGet; + (path: "/type/property/value-types/collections/int"): CollectionsIntGet; + (path: "/type/property/value-types/collections/model"): CollectionsModelGet; + (path: "/type/property/value-types/dictionary/string"): DictionaryStringGet; + (path: "/type/property/value-types/never"): NeverGet; + (path: "/type/property/value-types/unknown/string"): UnknownStringGet; + (path: "/type/property/value-types/unknown/int"): UnknownIntGet; + (path: "/type/property/value-types/unknown/dict"): UnknownDictGet; + (path: "/type/property/value-types/unknown/array"): UnknownArrayGet; + (path: "/type/property/value-types/string/literal"): StringLiteralGet; + (path: "/type/property/value-types/int/literal"): IntLiteralGet; + (path: "/type/property/value-types/float/literal"): FloatLiteralGet; + (path: "/type/property/value-types/boolean/literal"): BooleanLiteralGet; + (path: "/type/property/value-types/union/string/literal"): UnionStringLiteralGet; + (path: "/type/property/value-types/union/int/literal"): UnionIntLiteralGet; + (path: "/type/property/value-types/union/float/literal"): UnionFloatLiteralGet; + (path: "/type/property/value-types/union-enum-value"): UnionEnumValueGet; +} + +export declare interface StringLiteralGet { + get(options?: StringLiteralGetParameters): StreamableMethod; + put(options: StringLiteralPutParameters): StreamableMethod; +} + +export declare interface StringLiteralGet200Response extends HttpResponse { + status: "200"; + body: StringLiteralPropertyOutput; +} + +export declare type StringLiteralGetParameters = RequestParameters; + +export declare interface StringLiteralProperty { + property: "hello"; +} + +export declare interface StringLiteralPropertyOutput { + property: "hello"; +} + +export declare interface StringLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringLiteralPutBodyParam { + body: StringLiteralProperty; +} + +export declare type StringLiteralPutParameters = StringLiteralPutBodyParam & RequestParameters; + +export declare interface StringModelGet { + get(options?: StringModelGetParameters): StreamableMethod; + put(options: StringModelPutParameters): StreamableMethod; +} + +export declare interface StringModelGet200Response extends HttpResponse { + status: "200"; + body: StringPropertyOutput; +} + +export declare type StringModelGetParameters = RequestParameters; + +export declare interface StringModelPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringModelPutBodyParam { + body: StringProperty; +} + +export declare type StringModelPutParameters = StringModelPutBodyParam & RequestParameters; + +export declare interface StringProperty { + property: string; +} + +export declare interface StringPropertyOutput { + property: string; +} + +export declare interface UnionEnumValueGet { + get(options?: UnionEnumValueGetParameters): StreamableMethod; + put(options: UnionEnumValuePutParameters): StreamableMethod; +} + +export declare interface UnionEnumValueGet200Response extends HttpResponse { + status: "200"; + body: UnionEnumValuePropertyOutput; +} + +export declare type UnionEnumValueGetParameters = RequestParameters; + +export declare interface UnionEnumValueProperty { + property: "value2"; +} + +export declare interface UnionEnumValuePropertyOutput { + property: "value2"; +} + +export declare interface UnionEnumValuePut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionEnumValuePutBodyParam { + body: UnionEnumValueProperty; +} + +export declare type UnionEnumValuePutParameters = UnionEnumValuePutBodyParam & RequestParameters; + +export declare interface UnionFloatLiteralGet { + get(options?: UnionFloatLiteralGetParameters): StreamableMethod; + put(options: UnionFloatLiteralPutParameters): StreamableMethod; +} + +export declare interface UnionFloatLiteralGet200Response extends HttpResponse { + status: "200"; + body: UnionFloatLiteralPropertyOutput; +} + +export declare type UnionFloatLiteralGetParameters = RequestParameters; + +export declare interface UnionFloatLiteralProperty { + property: 43.125 | 46.875; +} + +export declare interface UnionFloatLiteralPropertyOutput { + property: 43.125 | 46.875; +} + +export declare interface UnionFloatLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionFloatLiteralPutBodyParam { + body: UnionFloatLiteralProperty; +} + +export declare type UnionFloatLiteralPutParameters = UnionFloatLiteralPutBodyParam & RequestParameters; + +export declare interface UnionIntLiteralGet { + get(options?: UnionIntLiteralGetParameters): StreamableMethod; + put(options: UnionIntLiteralPutParameters): StreamableMethod; +} + +export declare interface UnionIntLiteralGet200Response extends HttpResponse { + status: "200"; + body: UnionIntLiteralPropertyOutput; +} + +export declare type UnionIntLiteralGetParameters = RequestParameters; + +export declare interface UnionIntLiteralProperty { + property: 42 | 43; +} + +export declare interface UnionIntLiteralPropertyOutput { + property: 42 | 43; +} + +export declare interface UnionIntLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionIntLiteralPutBodyParam { + body: UnionIntLiteralProperty; +} + +export declare type UnionIntLiteralPutParameters = UnionIntLiteralPutBodyParam & RequestParameters; + +export declare interface UnionStringLiteralGet { + get(options?: UnionStringLiteralGetParameters): StreamableMethod; + put(options: UnionStringLiteralPutParameters): StreamableMethod; +} + +export declare interface UnionStringLiteralGet200Response extends HttpResponse { + status: "200"; + body: UnionStringLiteralPropertyOutput; +} + +export declare type UnionStringLiteralGetParameters = RequestParameters; + +export declare interface UnionStringLiteralProperty { + property: "hello" | "world"; +} + +export declare interface UnionStringLiteralPropertyOutput { + property: "hello" | "world"; +} + +export declare interface UnionStringLiteralPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnionStringLiteralPutBodyParam { + body: UnionStringLiteralProperty; +} + +export declare type UnionStringLiteralPutParameters = UnionStringLiteralPutBodyParam & RequestParameters; + +export declare interface UnknownArrayGet { + get(options?: UnknownArrayGetParameters): StreamableMethod; + put(options: UnknownArrayPutParameters): StreamableMethod; +} + +export declare interface UnknownArrayGet200Response extends HttpResponse { + status: "200"; + body: UnknownArrayPropertyOutput; +} + +export declare type UnknownArrayGetParameters = RequestParameters; + +export declare interface UnknownArrayProperty { + property: unknown; +} + +export declare interface UnknownArrayPropertyOutput { + property: any; +} + +export declare interface UnknownArrayPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownArrayPutBodyParam { + body: UnknownArrayProperty; +} + +export declare type UnknownArrayPutParameters = UnknownArrayPutBodyParam & RequestParameters; + +export declare interface UnknownDictGet { + get(options?: UnknownDictGetParameters): StreamableMethod; + put(options: UnknownDictPutParameters): StreamableMethod; +} + +export declare interface UnknownDictGet200Response extends HttpResponse { + status: "200"; + body: UnknownDictPropertyOutput; +} + +export declare type UnknownDictGetParameters = RequestParameters; + +export declare interface UnknownDictProperty { + property: unknown; +} + +export declare interface UnknownDictPropertyOutput { + property: any; +} + +export declare interface UnknownDictPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownDictPutBodyParam { + body: UnknownDictProperty; +} + +export declare type UnknownDictPutParameters = UnknownDictPutBodyParam & RequestParameters; + +export declare interface UnknownIntGet { + get(options?: UnknownIntGetParameters): StreamableMethod; + put(options: UnknownIntPutParameters): StreamableMethod; +} + +export declare interface UnknownIntGet200Response extends HttpResponse { + status: "200"; + body: UnknownIntPropertyOutput; +} + +export declare type UnknownIntGetParameters = RequestParameters; + +export declare interface UnknownIntProperty { + property: unknown; +} + +export declare interface UnknownIntPropertyOutput { + property: any; +} + +export declare interface UnknownIntPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownIntPutBodyParam { + body: UnknownIntProperty; +} + +export declare type UnknownIntPutParameters = UnknownIntPutBodyParam & RequestParameters; + +export declare interface UnknownStringGet { + get(options?: UnknownStringGetParameters): StreamableMethod; + put(options: UnknownStringPutParameters): StreamableMethod; +} + +export declare interface UnknownStringGet200Response extends HttpResponse { + status: "200"; + body: UnknownStringPropertyOutput; +} + +export declare type UnknownStringGetParameters = RequestParameters; + +export declare interface UnknownStringProperty { + property: unknown; +} + +export declare interface UnknownStringPropertyOutput { + property: any; +} + +export declare interface UnknownStringPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownStringPutBodyParam { + body: UnknownStringProperty; +} + +export declare type UnknownStringPutParameters = UnknownStringPutBodyParam & RequestParameters; + +export declare type ValueTypesClient = Client & { + path: Routes; +}; + +export declare interface ValueTypesClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/tspconfig.yaml new file mode 100644 index 0000000000..c8557f94f8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/property/value-types/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/property-types" + description: "Property Types Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/scalar/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/scalar/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/scalar/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/scalar/src/index.d.ts new file mode 100644 index 0000000000..a1aaed24a0 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/scalar/src/index.d.ts @@ -0,0 +1,235 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface BooleanModelGet { + get(options?: BooleanModelGetParameters): StreamableMethod; + put(options: BooleanModelPutParameters): StreamableMethod; +} + +export declare interface BooleanModelGet200Response extends HttpResponse { + status: "200"; + body: boolean; +} + +export declare type BooleanModelGetParameters = RequestParameters; + +export declare interface BooleanModelPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface BooleanModelPutBodyParam { + body: boolean; +} + +export declare type BooleanModelPutParameters = BooleanModelPutBodyParam & RequestParameters; + +declare function createClient(options?: ScalarClientOptions): ScalarClient; +export default createClient; + +export declare interface Decimal128TypeRequestBody { + put(options: Decimal128TypeRequestBodyParameters): StreamableMethod; +} + +export declare interface Decimal128TypeRequestBody204Response extends HttpResponse { + status: "204"; +} + +export declare interface Decimal128TypeRequestBodyBodyParam { + body: number; +} + +export declare type Decimal128TypeRequestBodyParameters = Decimal128TypeRequestBodyBodyParam & RequestParameters; + +export declare interface Decimal128TypeRequestParameter { + get(options: Decimal128TypeRequestParameterParameters): StreamableMethod; +} + +export declare interface Decimal128TypeRequestParameter204Response extends HttpResponse { + status: "204"; +} + +export declare type Decimal128TypeRequestParameterParameters = Decimal128TypeRequestParameterQueryParam & RequestParameters; + +export declare interface Decimal128TypeRequestParameterQueryParam { + queryParameters: Decimal128TypeRequestParameterQueryParamProperties; +} + +export declare interface Decimal128TypeRequestParameterQueryParamProperties { + value: number; +} + +export declare interface Decimal128TypeResponseBody { + get(options?: Decimal128TypeResponseBodyParameters): StreamableMethod; +} + +export declare interface Decimal128TypeResponseBody200Response extends HttpResponse { + status: "200"; + body: number; +} + +export declare type Decimal128TypeResponseBodyParameters = RequestParameters; + +export declare interface Decimal128VerifyPrepareVerify { + get(options?: Decimal128VerifyPrepareVerifyParameters): StreamableMethod; +} + +export declare interface Decimal128VerifyPrepareVerify200Response extends HttpResponse { + status: "200"; + body: number[]; +} + +export declare type Decimal128VerifyPrepareVerifyParameters = RequestParameters; + +export declare interface Decimal128VerifyVerify { + post(options: Decimal128VerifyVerifyParameters): StreamableMethod; +} + +export declare interface Decimal128VerifyVerify204Response extends HttpResponse { + status: "204"; +} + +export declare interface Decimal128VerifyVerifyBodyParam { + body: number; +} + +export declare type Decimal128VerifyVerifyParameters = Decimal128VerifyVerifyBodyParam & RequestParameters; + +export declare interface DecimalTypeRequestBody { + put(options: DecimalTypeRequestBodyParameters): StreamableMethod; +} + +export declare interface DecimalTypeRequestBody204Response extends HttpResponse { + status: "204"; +} + +export declare interface DecimalTypeRequestBodyBodyParam { + body: number; +} + +export declare type DecimalTypeRequestBodyParameters = DecimalTypeRequestBodyBodyParam & RequestParameters; + +export declare interface DecimalTypeRequestParameter { + get(options: DecimalTypeRequestParameterParameters): StreamableMethod; +} + +export declare interface DecimalTypeRequestParameter204Response extends HttpResponse { + status: "204"; +} + +export declare type DecimalTypeRequestParameterParameters = DecimalTypeRequestParameterQueryParam & RequestParameters; + +export declare interface DecimalTypeRequestParameterQueryParam { + queryParameters: DecimalTypeRequestParameterQueryParamProperties; +} + +export declare interface DecimalTypeRequestParameterQueryParamProperties { + value: number; +} + +export declare interface DecimalTypeResponseBody { + get(options?: DecimalTypeResponseBodyParameters): StreamableMethod; +} + +export declare interface DecimalTypeResponseBody200Response extends HttpResponse { + status: "200"; + body: number; +} + +export declare type DecimalTypeResponseBodyParameters = RequestParameters; + +export declare interface DecimalVerifyPrepareVerify { + get(options?: DecimalVerifyPrepareVerifyParameters): StreamableMethod; +} + +export declare interface DecimalVerifyPrepareVerify200Response extends HttpResponse { + status: "200"; + body: number[]; +} + +export declare type DecimalVerifyPrepareVerifyParameters = RequestParameters; + +export declare interface DecimalVerifyVerify { + post(options: DecimalVerifyVerifyParameters): StreamableMethod; +} + +export declare interface DecimalVerifyVerify204Response extends HttpResponse { + status: "204"; +} + +export declare interface DecimalVerifyVerifyBodyParam { + body: number; +} + +export declare type DecimalVerifyVerifyParameters = DecimalVerifyVerifyBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/scalar/string"): StringModelGet; + (path: "/type/scalar/boolean"): BooleanModelGet; + (path: "/type/scalar/unknown"): UnknownGet; + (path: "/type/scalar/decimal/response_body"): DecimalTypeResponseBody; + (path: "/type/scalar/decimal/resquest_body"): DecimalTypeRequestBody; + (path: "/type/scalar/decimal/request_parameter"): DecimalTypeRequestParameter; + (path: "/type/scalar/decimal128/response_body"): Decimal128TypeResponseBody; + (path: "/type/scalar/decimal128/resquest_body"): Decimal128TypeRequestBody; + (path: "/type/scalar/decimal128/request_parameter"): Decimal128TypeRequestParameter; + (path: "/type/scalar/decimal/prepare_verify"): DecimalVerifyPrepareVerify; + (path: "/type/scalar/decimal/verify"): DecimalVerifyVerify; + (path: "/type/scalar/decimal128/prepare_verify"): Decimal128VerifyPrepareVerify; + (path: "/type/scalar/decimal128/verify"): Decimal128VerifyVerify; +} + +export declare type ScalarClient = Client & { + path: Routes; +}; + +export declare interface ScalarClientOptions extends ClientOptions { +} + +export declare interface StringModelGet { + get(options?: StringModelGetParameters): StreamableMethod; + put(options: StringModelPutParameters): StreamableMethod; +} + +export declare interface StringModelGet200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare type StringModelGetParameters = RequestParameters; + +export declare interface StringModelPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringModelPutBodyParam { + body: string; +} + +export declare type StringModelPutParameters = StringModelPutBodyParam & RequestParameters; + +export declare interface UnknownGet { + get(options?: UnknownGetParameters): StreamableMethod; + put(options: UnknownPutParameters): StreamableMethod; +} + +export declare interface UnknownGet200Response extends HttpResponse { + status: "200"; + body: any; +} + +export declare type UnknownGetParameters = RequestParameters; + +export declare interface UnknownPut204Response extends HttpResponse { + status: "204"; +} + +export declare interface UnknownPutBodyParam { + body: unknown; +} + +export declare type UnknownPutParameters = UnknownPutBodyParam & RequestParameters; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/scalar/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/scalar/tspconfig.yaml new file mode 100644 index 0000000000..0dead87fa6 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/scalar/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + packageDetails: + name: "@msinternal/scalar" diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/union/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/type/union/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/union/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/type/union/src/index.d.ts new file mode 100644 index 0000000000..3998ae3d12 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/union/src/index.d.ts @@ -0,0 +1,368 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface Cat { + name: string; +} + +export declare interface CatOutput { + name: string; +} + +declare function createClient(options?: UnionsClientOptions): UnionsClient; +export default createClient; + +export declare interface Dog { + bark: string; +} + +export declare interface DogOutput { + bark: string; +} + +export declare interface EnumsOnlyCases { + lr: Lr | Ud; + ud: Ud | Ud; +} + +export declare interface EnumsOnlyCasesOutput { + lr: LrOutput | UdOutput; + ud: UdOutput | UdOutput; +} + +export declare interface EnumsOnlyGet { + get(options?: EnumsOnlyGetParameters): StreamableMethod; + post(options: EnumsOnlySendParameters): StreamableMethod; +} + +export declare interface EnumsOnlyGet200Response extends HttpResponse { + status: "200"; + body: { + prop: EnumsOnlyCasesOutput; + }; +} + +export declare type EnumsOnlyGetParameters = RequestParameters; + +export declare interface EnumsOnlySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface EnumsOnlySendBodyParam { + body: { + prop: EnumsOnlyCases; + }; +} + +export declare type EnumsOnlySendParameters = EnumsOnlySendBodyParam & RequestParameters; + +export declare interface FloatsOnlyGet { + get(options?: FloatsOnlyGetParameters): StreamableMethod; + post(options: FloatsOnlySendParameters): StreamableMethod; +} + +export declare interface FloatsOnlyGet200Response extends HttpResponse { + status: "200"; + body: { + prop: 1.1 | 2.2 | 3.3; + }; +} + +export declare type FloatsOnlyGetParameters = RequestParameters; + +export declare interface FloatsOnlySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface FloatsOnlySendBodyParam { + body: { + prop: 1.1 | 2.2 | 3.3; + }; +} + +export declare type FloatsOnlySendParameters = FloatsOnlySendBodyParam & RequestParameters; + +export declare interface IntsOnlyGet { + get(options?: IntsOnlyGetParameters): StreamableMethod; + post(options: IntsOnlySendParameters): StreamableMethod; +} + +export declare interface IntsOnlyGet200Response extends HttpResponse { + status: "200"; + body: { + prop: 1 | 2 | 3; + }; +} + +export declare type IntsOnlyGetParameters = RequestParameters; + +export declare interface IntsOnlySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface IntsOnlySendBodyParam { + body: { + prop: 1 | 2 | 3; + }; +} + +export declare type IntsOnlySendParameters = IntsOnlySendBodyParam & RequestParameters; + +export declare type Lr = "left" | "right"; + +export declare type LrOutput = "left" | "right"; + +export declare interface MixedLiteralsCases { + stringLiteral: "a" | 2 | 3.3 | true; + intLiteral: "a" | 2 | 3.3 | true; + floatLiteral: "a" | 2 | 3.3 | true; + booleanLiteral: "a" | 2 | 3.3 | true; +} + +export declare interface MixedLiteralsCasesOutput { + stringLiteral: "a" | 2 | 3.3 | true; + intLiteral: "a" | 2 | 3.3 | true; + floatLiteral: "a" | 2 | 3.3 | true; + booleanLiteral: "a" | 2 | 3.3 | true; +} + +export declare interface MixedLiteralsGet { + get(options?: MixedLiteralsGetParameters): StreamableMethod; + post(options: MixedLiteralsSendParameters): StreamableMethod; +} + +export declare interface MixedLiteralsGet200Response extends HttpResponse { + status: "200"; + body: { + prop: MixedLiteralsCasesOutput; + }; +} + +export declare type MixedLiteralsGetParameters = RequestParameters; + +export declare interface MixedLiteralsSend204Response extends HttpResponse { + status: "204"; +} + +export declare interface MixedLiteralsSendBodyParam { + body: { + prop: MixedLiteralsCases; + }; +} + +export declare type MixedLiteralsSendParameters = MixedLiteralsSendBodyParam & RequestParameters; + +export declare interface MixedTypesCases { + model: Cat | "a" | number | boolean; + literal: Cat | "a" | number | boolean; + int: Cat | "a" | number | boolean; + boolean: Cat | "a" | number | boolean; + array: (Cat | "a" | number | boolean)[]; +} + +export declare interface MixedTypesCasesOutput { + model: CatOutput | "a" | number | boolean; + literal: CatOutput | "a" | number | boolean; + int: CatOutput | "a" | number | boolean; + boolean: CatOutput | "a" | number | boolean; + array: (CatOutput | "a" | number | boolean)[]; +} + +export declare interface MixedTypesGet { + get(options?: MixedTypesGetParameters): StreamableMethod; + post(options: MixedTypesSendParameters): StreamableMethod; +} + +export declare interface MixedTypesGet200Response extends HttpResponse { + status: "200"; + body: { + prop: MixedTypesCasesOutput; + }; +} + +export declare type MixedTypesGetParameters = RequestParameters; + +export declare interface MixedTypesSend204Response extends HttpResponse { + status: "204"; +} + +export declare interface MixedTypesSendBodyParam { + body: { + prop: MixedTypesCases; + }; +} + +export declare type MixedTypesSendParameters = MixedTypesSendBodyParam & RequestParameters; + +export declare interface ModelsOnlyGet { + get(options?: ModelsOnlyGetParameters): StreamableMethod; + post(options: ModelsOnlySendParameters): StreamableMethod; +} + +export declare interface ModelsOnlyGet200Response extends HttpResponse { + status: "200"; + body: { + prop: CatOutput | DogOutput; + }; +} + +export declare type ModelsOnlyGetParameters = RequestParameters; + +export declare interface ModelsOnlySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface ModelsOnlySendBodyParam { + body: { + prop: Cat | Dog; + }; +} + +export declare type ModelsOnlySendParameters = ModelsOnlySendBodyParam & RequestParameters; + +export declare interface Routes { + (path: "/type/union/strings-only"): StringsOnlyGet; + (path: "/type/union/string-extensible"): StringExtensibleGet; + (path: "/type/union/string-extensible-named"): StringExtensibleNamedGet; + (path: "/type/union/ints-only"): IntsOnlyGet; + (path: "/type/union/floats-only"): FloatsOnlyGet; + (path: "/type/union/models-only"): ModelsOnlyGet; + (path: "/type/union/enums-only"): EnumsOnlyGet; + (path: "/type/union/string-and-array"): StringAndArrayGet; + (path: "/type/union/mixed-literals"): MixedLiteralsGet; + (path: "/type/union/mixed-types"): MixedTypesGet; +} + +export declare interface StringAndArrayCases { + string: string | string[]; + array: string | string[]; +} + +export declare interface StringAndArrayCasesOutput { + string: string | string[]; + array: string | string[]; +} + +export declare interface StringAndArrayGet { + get(options?: StringAndArrayGetParameters): StreamableMethod; + post(options: StringAndArraySendParameters): StreamableMethod; +} + +export declare interface StringAndArrayGet200Response extends HttpResponse { + status: "200"; + body: { + prop: StringAndArrayCasesOutput; + }; +} + +export declare type StringAndArrayGetParameters = RequestParameters; + +export declare interface StringAndArraySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringAndArraySendBodyParam { + body: { + prop: StringAndArrayCases; + }; +} + +export declare type StringAndArraySendParameters = StringAndArraySendBodyParam & RequestParameters; + +export declare interface StringExtensibleGet { + get(options?: StringExtensibleGetParameters): StreamableMethod; + post(options: StringExtensibleSendParameters): StreamableMethod; +} + +export declare interface StringExtensibleGet200Response extends HttpResponse { + status: "200"; + body: { + prop: string; + }; +} + +export declare type StringExtensibleGetParameters = RequestParameters; + +export declare interface StringExtensibleNamedGet { + get(options?: StringExtensibleNamedGetParameters): StreamableMethod; + post(options: StringExtensibleNamedSendParameters): StreamableMethod; +} + +export declare interface StringExtensibleNamedGet200Response extends HttpResponse { + status: "200"; + body: { + prop: StringExtensibleNamedUnionOutput; + }; +} + +export declare type StringExtensibleNamedGetParameters = RequestParameters; + +export declare interface StringExtensibleNamedSend204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringExtensibleNamedSendBodyParam { + body: { + prop: StringExtensibleNamedUnion; + }; +} + +export declare type StringExtensibleNamedSendParameters = StringExtensibleNamedSendBodyParam & RequestParameters; + +export declare type StringExtensibleNamedUnion = string; + +export declare type StringExtensibleNamedUnionOutput = string; + +export declare interface StringExtensibleSend204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringExtensibleSendBodyParam { + body: { + prop: string; + }; +} + +export declare type StringExtensibleSendParameters = StringExtensibleSendBodyParam & RequestParameters; + +export declare interface StringsOnlyGet { + get(options?: StringsOnlyGetParameters): StreamableMethod; + post(options: StringsOnlySendParameters): StreamableMethod; +} + +export declare interface StringsOnlyGet200Response extends HttpResponse { + status: "200"; + body: { + prop: "a" | "b" | "c"; + }; +} + +export declare type StringsOnlyGetParameters = RequestParameters; + +export declare interface StringsOnlySend204Response extends HttpResponse { + status: "204"; +} + +export declare interface StringsOnlySendBodyParam { + body: { + prop: "a" | "b" | "c"; + }; +} + +export declare type StringsOnlySendParameters = StringsOnlySendBodyParam & RequestParameters; + +export declare type Ud = "up" | "down"; + +export declare type UdOutput = "up" | "down"; + +export declare type UnionsClient = Client & { + path: Routes; +}; + +export declare interface UnionsClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/type/union/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/type/union/tspconfig.yaml new file mode 100644 index 0000000000..0477ac9f3f --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/type/union/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: UnionsClient + experimentalExtensibleEnums: true + packageDetails: + name: "@msinternal/unions" + description: "Unions Test Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/union-body/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/union-body/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/union-body/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/union-body/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/union-body/src/index.d.ts new file mode 100644 index 0000000000..524b0c712b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/union-body/src/index.d.ts @@ -0,0 +1,76 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +export declare interface CommonRegistrationRequest { + payMethod: PaymentMethods; +} + +export declare interface CommonRegistrationRequestOutput { + payMethod: PaymentMethodsOutput; +} + +declare function createClient(endpointParam: string, options?: UnionBodyClientOptions): UnionBodyClient; +export default createClient; + +export declare type PaymentMethods = "01"; + +export declare type PaymentMethodsOutput = "01"; + +export declare interface RequestRegisterCC extends CommonRegistrationRequest { + payMethod: "01"; +} + +export declare interface RequestRegisterCCOutput extends CommonRegistrationRequestOutput { + payMethod: "01"; +} + +export declare interface RequestRegisterVA { + prop: string; +} + +export declare interface RequestRegisterVAOutput { + prop: string; +} + +export declare interface RequestUnionBody { + post(options: RequestUnionBodyParameters): StreamableMethod; +} + +export declare interface RequestUnionBody200Response extends HttpResponse { + status: "200"; + body: Record; +} + +export declare interface RequestUnionBodyBodyParam { + body: RequestRegisterCC | RequestRegisterVA; +} + +export declare type RequestUnionBodyParameters = RequestUnionBodyBodyParam & RequestParameters; + +export declare interface ResponseUnionBody { + get(options?: ResponseUnionBodyParameters): StreamableMethod; +} + +export declare interface ResponseUnionBody200Response extends HttpResponse { + status: "200"; + body: RequestRegisterCCOutput | RequestRegisterVAOutput; +} + +export declare type ResponseUnionBodyParameters = RequestParameters; + +export declare interface Routes { + (path: "/request-union-body"): RequestUnionBody; + (path: "/response-union-body"): ResponseUnionBody; +} + +export declare type UnionBodyClient = Client & { + path: Routes; +}; + +export declare interface UnionBodyClientOptions extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/union-body/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/union-body/tspconfig.yaml new file mode 100644 index 0000000000..282cf27cc9 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/union-body/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: true + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: UnionBodyClient + packageDetails: + name: "@msinternal/union-body" + description: "Union Body Test Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/added/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/versioning/added/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/added/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/versioning/added/src/index.d.ts new file mode 100644 index 0000000000..64aa1a8410 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/added/src/index.d.ts @@ -0,0 +1,119 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, version: Versions, options?: VersioningAddedClientOptions): VersioningAddedClient; +export default createClient; + +export declare type EnumV1 = "enumMemberV1" | "enumMemberV2"; + +export declare type EnumV1Output = "enumMemberV1" | "enumMemberV2"; + +export declare type EnumV2 = "enumMember"; + +export declare type EnumV2Output = "enumMember"; + +export declare interface ModelV1 { + prop: string; + enumProp: EnumV1; + unionProp: UnionV1; +} + +export declare interface ModelV1Output { + prop: string; + enumProp: EnumV1Output; + unionProp: UnionV1Output; +} + +export declare interface ModelV2 { + prop: string; + enumProp: EnumV2; + unionProp: UnionV2; +} + +export declare interface ModelV2Output { + prop: string; + enumProp: EnumV2Output; + unionProp: UnionV2Output; +} + +export declare interface Routes { + (path: "/v1"): V1; + (path: "/v2"): V2; + (path: "/interface-v2/v2"): V2InInterface; +} + +export declare type UnionV1 = string | number; + +export declare type UnionV1Output = string | number; + +export declare type UnionV2 = string | number; + +export declare type UnionV2Output = string | number; + +export declare interface V1 { + post(options: V1Parameters): StreamableMethod; +} + +export declare interface V1200Response extends HttpResponse { + status: "200"; + body: ModelV1Output; +} + +export declare interface V1BodyParam { + body: ModelV1; +} + +export declare interface V1HeaderParam { + headers: RawHttpHeadersInput & V1Headers; +} + +export declare interface V1Headers { + "header-v2": string; +} + +export declare type V1Parameters = V1HeaderParam & V1BodyParam & RequestParameters; + +export declare interface V2 { + post(options: V2Parameters): StreamableMethod; +} + +export declare interface V2200Response extends HttpResponse { + status: "200"; + body: ModelV2Output; +} + +export declare interface V2BodyParam { + body: ModelV2; +} + +export declare interface V2InInterface { + post(options: V2InInterfaceParameters): StreamableMethod; +} + +export declare interface V2InInterface200Response extends HttpResponse { + status: "200"; + body: ModelV2Output; +} + +export declare interface V2InInterfaceBodyParam { + body: ModelV2; +} + +export declare type V2InInterfaceParameters = V2InInterfaceBodyParam & RequestParameters; + +export declare type V2Parameters = V2BodyParam & RequestParameters; + +export declare type VersioningAddedClient = Client & { + path: Routes; +}; + +export declare interface VersioningAddedClientOptions extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/added/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/versioning/added/tspconfig.yaml new file mode 100644 index 0000000000..fbcc141600 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/added/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: VersioningAddedClient + packageDetails: + name: "@msinternal/versioning-added" + description: "Versioning Added Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/src/index.d.ts new file mode 100644 index 0000000000..8add70364a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/src/index.d.ts @@ -0,0 +1,56 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, version: Versions, options?: VersioningMadeOptionalClientOptions): VersioningMadeOptionalClient; +export default createClient; + +export declare interface Routes { + (path: "/test"): Test; +} + +export declare interface Test { + post(options: TestParameters): StreamableMethod; +} + +export declare interface Test200Response extends HttpResponse { + status: "200"; + body: TestModelOutput; +} + +export declare interface TestBodyParam { + body: TestModel; +} + +export declare interface TestModel { + prop: string; + changedProp?: string; +} + +export declare interface TestModelOutput { + prop: string; + changedProp?: string; +} + +export declare type TestParameters = TestQueryParam & TestBodyParam & RequestParameters; + +export declare interface TestQueryParam { + queryParameters?: TestQueryParamProperties; +} + +export declare interface TestQueryParamProperties { + param?: string; +} + +export declare type VersioningMadeOptionalClient = Client & { + path: Routes; +}; + +export declare interface VersioningMadeOptionalClientOptions extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/tspconfig.yaml new file mode 100644 index 0000000000..94bb6b1e23 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/madeOptional/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: VersioningMadeOptionalClient + packageDetails: + name: "@msinternal/versioning-madeOptional" + description: "Versioning MadeOptional Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/removed/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/versioning/removed/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/removed/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/integration/generated/versioning/removed/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/versioning/removed/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/integration/generated/versioning/removed/src/index.d.ts rename to packages/typespec-ts/test/azureIntegration/generated/versioning/removed/src/index.d.ts diff --git a/packages/typespec-ts/test/integration/generated/versioning/removed/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/versioning/removed/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/integration/generated/versioning/removed/tspconfig.yaml rename to packages/typespec-ts/test/azureIntegration/generated/versioning/removed/tspconfig.yaml index f50fcad826..e5fad62183 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/removed/tspconfig.yaml +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/removed/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true generateSample: true diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/src/index.d.ts new file mode 100644 index 0000000000..aad88a477f --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/src/index.d.ts @@ -0,0 +1,82 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, version: Versions, options?: VersioningRenamedFromClientOptions): VersioningRenamedFromClient; +export default createClient; + +export declare type NewEnum = "newEnumMember"; + +export declare type NewEnumOutput = "newEnumMember"; + +export declare interface NewModel { + newProp: string; + enumProp: NewEnum; + unionProp: NewUnion; +} + +export declare interface NewModelOutput { + newProp: string; + enumProp: NewEnumOutput; + unionProp: NewUnionOutput; +} + +export declare interface NewOp { + post(options: NewOpParameters): StreamableMethod; +} + +export declare interface NewOp200Response extends HttpResponse { + status: "200"; + body: NewModelOutput; +} + +export declare interface NewOpBodyParam { + body: NewModel; +} + +export declare interface NewOpInNewInterface { + post(options: NewOpInNewInterfaceParameters): StreamableMethod; +} + +export declare interface NewOpInNewInterface200Response extends HttpResponse { + status: "200"; + body: NewModelOutput; +} + +export declare interface NewOpInNewInterfaceBodyParam { + body: NewModel; +} + +export declare type NewOpInNewInterfaceParameters = NewOpInNewInterfaceBodyParam & RequestParameters; + +export declare type NewOpParameters = NewOpQueryParam & NewOpBodyParam & RequestParameters; + +export declare interface NewOpQueryParam { + queryParameters: NewOpQueryParamProperties; +} + +export declare interface NewOpQueryParamProperties { + newQuery: string; +} + +export declare type NewUnion = string | number; + +export declare type NewUnionOutput = string | number; + +export declare interface Routes { + (path: "/test"): NewOp; + (path: "/interface/test"): NewOpInNewInterface; +} + +export declare type VersioningRenamedFromClient = Client & { + path: Routes; +}; + +export declare interface VersioningRenamedFromClientOptions extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/tspconfig.yaml new file mode 100644 index 0000000000..84934f9d2c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/renamedFrom/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: VersioningRenamedFromClient + packageDetails: + name: "@msinternal/versioning-renamedFrom" + description: "Versioning RenamedFrom Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts new file mode 100644 index 0000000000..9e4161e665 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts @@ -0,0 +1,38 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, version: Versions, options?: VersioningReturnTypeChangedFromClientOptions): VersioningReturnTypeChangedFromClient; +export default createClient; + +export declare interface Routes { + (path: "/test"): Test; +} + +export declare interface Test { + post(options: TestParameters): StreamableMethod; +} + +export declare interface Test200Response extends HttpResponse { + status: "200"; + body: string; +} + +export declare interface TestBodyParam { + body: string; +} + +export declare type TestParameters = TestBodyParam & RequestParameters; + +export declare type VersioningReturnTypeChangedFromClient = Client & { + path: Routes; +}; + +export declare interface VersioningReturnTypeChangedFromClientOptions extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml new file mode 100644 index 0000000000..2e81de7c50 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: VersioningReturnTypeChangedFromClient + packageDetails: + name: "@msinternal/versioning-returnTypeChangedFrom" + description: "Versioning ReturnTypeChangedFrom Service" diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/.gitignore b/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/src/index.d.ts new file mode 100644 index 0000000000..267cf511ee --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/src/index.d.ts @@ -0,0 +1,56 @@ +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { HttpResponse } from '@azure-rest/core-client'; +import type { RequestParameters } from '@azure-rest/core-client'; +import type { StreamableMethod } from '@azure-rest/core-client'; + +declare function createClient(endpointParam: string, version: Versions, options?: VersioningTypeChangedFromClientOptions): VersioningTypeChangedFromClient; +export default createClient; + +export declare interface Routes { + (path: "/test"): Test; +} + +export declare interface Test { + post(options: TestParameters): StreamableMethod; +} + +export declare interface Test200Response extends HttpResponse { + status: "200"; + body: TestModelOutput; +} + +export declare interface TestBodyParam { + body: TestModel; +} + +export declare interface TestModel { + prop: string; + changedProp: string; +} + +export declare interface TestModelOutput { + prop: string; + changedProp: string; +} + +export declare type TestParameters = TestQueryParam & TestBodyParam & RequestParameters; + +export declare interface TestQueryParam { + queryParameters: TestQueryParamProperties; +} + +export declare interface TestQueryParamProperties { + param: string; +} + +export declare type VersioningTypeChangedFromClient = Client & { + path: Routes; +}; + +export declare interface VersioningTypeChangedFromClientOptions extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml new file mode 100644 index 0000000000..37db731b3b --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + generateSample: true + title: VersioningTypeChangedFromClient + packageDetails: + name: "@msinternal/versioning-typeChangedFrom" + description: "Versioning TypeChangedFrom Service" diff --git a/packages/typespec-ts/test/integration/lroCore.spec.ts b/packages/typespec-ts/test/azureIntegration/lroCore.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/lroCore.spec.ts rename to packages/typespec-ts/test/azureIntegration/lroCore.spec.ts diff --git a/packages/typespec-ts/test/integration/lroRpc.spec.ts b/packages/typespec-ts/test/azureIntegration/lroRpc.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/lroRpc.spec.ts rename to packages/typespec-ts/test/azureIntegration/lroRpc.spec.ts diff --git a/packages/typespec-ts/test/integration/mediaTypes.spec.ts b/packages/typespec-ts/test/azureIntegration/mediaTypes.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/mediaTypes.spec.ts rename to packages/typespec-ts/test/azureIntegration/mediaTypes.spec.ts diff --git a/packages/typespec-ts/test/integration/modelFlatten.spec.ts b/packages/typespec-ts/test/azureIntegration/modelFlatten.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/modelFlatten.spec.ts rename to packages/typespec-ts/test/azureIntegration/modelFlatten.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/modelInheritance.spec.ts b/packages/typespec-ts/test/azureIntegration/modelInheritance.spec.ts new file mode 100644 index 0000000000..08bfe50d33 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelInheritance.spec.ts @@ -0,0 +1,146 @@ +import NestedDiscriminatorClientFactory, { + GoblinShark, + NestedDiscriminatorClient, + Salmon, + SalmonOutput, + SharkOutput +} from "./generated/type/model/inheritance/nested-discriminator/src/index.js"; +import { assert } from "chai"; + +describe("NestedDiscriminatorClient Rest Client", () => { + let client: NestedDiscriminatorClient; + + beforeEach(() => { + client = NestedDiscriminatorClientFactory({ + allowInsecureConnection: true + }); + }); + + const validBody: GoblinShark = { + age: 1, + kind: "shark", + sharktype: "goblin" + }; + it("should get valid", async () => { + const result = await client + .path("/type/model/inheritance/nested-discriminator/model") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.age, 1); + if (result.body.kind === "shark") { + assert.strictEqual((result.body as SharkOutput).sharktype, "goblin"); + } + }); + + it("should put valid", async () => { + const result = await client + .path("/type/model/inheritance/nested-discriminator/model") + .put({ + body: validBody + }); + assert.strictEqual(result.status, "204"); + }); + + const validRecursiveBody: Salmon = { + age: 1, + kind: "salmon", + partner: { + age: 2, + kind: "shark", + sharktype: "saw" + }, + friends: [ + { + age: 2, + kind: "salmon", + partner: { + age: 3, + kind: "salmon" + }, + hate: { + key1: { + age: 4, + kind: "salmon" + }, + key2: { + age: 2, + kind: "shark", + sharktype: "goblin" + } + } + }, + { + age: 3, + kind: "shark", + sharktype: "goblin" + } + ], + hate: { + key3: { + age: 3, + kind: "shark", + sharktype: "saw" + }, + key4: { + age: 2, + kind: "salmon", + friends: [ + { + age: 1, + kind: "salmon" + }, + { + age: 4, + kind: "shark", + sharktype: "goblin" + } + ] + } + } + }; + it("should get recursive body", async () => { + const result = await client + .path("/type/model/inheritance/nested-discriminator/recursivemodel") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual( + JSON.stringify(result.body), + JSON.stringify(validRecursiveBody) + ); + if (result.body.kind === "salmon") { + assert.strictEqual( + (result.body as SalmonOutput).partner?.kind, + validRecursiveBody.partner?.kind + ); + } + }); + + it("should put recursive body", async () => { + const result = await client + .path("/type/model/inheritance/nested-discriminator/recursivemodel") + .put({ + body: validRecursiveBody + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get missing discriminator body", async () => { + const result = await client + .path( + "/type/model/inheritance/nested-discriminator/missingdiscriminator" + ) + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.age, 1); + assert.isUndefined(result.body.kind); + }); + + it("should get wrong discriminator body", async () => { + const result = await client + .path("/type/model/inheritance/nested-discriminator/wrongdiscriminator") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.age, 1); + assert.strictEqual(result.body.kind, "wrongKind"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelInheritanceEnumDiscriminator.spec.ts b/packages/typespec-ts/test/azureIntegration/modelInheritanceEnumDiscriminator.spec.ts new file mode 100644 index 0000000000..36232ef497 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelInheritanceEnumDiscriminator.spec.ts @@ -0,0 +1,94 @@ +import EnumDiscriminatorClientFactory, { + EnumDiscriminatorClient, + Golden, + Snake +} from "./generated/type/model/inheritance/enum-discriminator/src/index.js"; +import { assert } from "chai"; + +describe("EnumDiscriminatorClient Rest Client", () => { + let client: EnumDiscriminatorClient; + + beforeEach(() => { + client = EnumDiscriminatorClientFactory({ + allowInsecureConnection: true + }); + }); + + const validBody: Golden = { + weight: 10, + kind: "golden" + }; + const validFixedEnumBody: Snake = { + length: 10, + kind: "cobra" + }; + it("should get extensible enum", async () => { + const result = await client + .path("/type/model/inheritance/enum-discriminator/extensible-enum") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, validBody); + }); + + it("should put extensible enum", async () => { + const result = await client + .path("/type/model/inheritance/enum-discriminator/extensible-enum") + .put({ body: validBody }); + assert.strictEqual(result.status, "204"); + }); + + it("should get extensible enum if missing discriminator", async () => { + const result = await client + .path( + "/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator" + ) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { weight: 10 } as any); + }); + + it("should get extensible enum if wrong discriminator", async () => { + const result = await client + .path( + "/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator" + ) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { weight: 8, kind: "wrongKind" }); + }); + + it("should get fixed enum", async () => { + const result = await client + .path("/type/model/inheritance/enum-discriminator/fixed-enum") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, validFixedEnumBody); + }); + + it("should put fixed enum", async () => { + const result = await client + .path("/type/model/inheritance/enum-discriminator/fixed-enum") + .put({ body: validFixedEnumBody }); + assert.strictEqual(result.status, "204"); + }); + + it("should get fixed enum if missing discriminator", async () => { + const result = await client + .path( + "/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator" + ) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { length: 10 } as any); + }); + + it("should get fixed enum if wrong discriminator", async () => { + const result = await client + .path( + "/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator" + ) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { length: 8, kind: "wrongKind" }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelInheritanceNotDiscriminated.spec.ts b/packages/typespec-ts/test/azureIntegration/modelInheritanceNotDiscriminated.spec.ts new file mode 100644 index 0000000000..d988e87855 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelInheritanceNotDiscriminated.spec.ts @@ -0,0 +1,39 @@ +import NotDiscriminatedClientFactory, { + NotDiscriminatedClient, + Siamese +} from "./generated/type/model/inheritance/not-discriminated/src/index.js"; +import { assert } from "chai"; + +describe("NotDiscriminatedClient Rest Client", () => { + let client: NotDiscriminatedClient; + + beforeEach(() => { + client = NotDiscriminatedClientFactory({ + allowInsecureConnection: true + }); + }); + + const validBody: Siamese = { name: "abc", age: 32, smart: true }; + it("should get valid", async () => { + const result = await client + .path("/type/model/inheritance/not-discriminated/valid") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, validBody); + }); + + it("should put valid", async () => { + const result = await client + .path("/type/model/inheritance/not-discriminated/valid") + .put({ body: validBody }); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, validBody); + }); + + it("should post valid", async () => { + const result = await client + .path("/type/model/inheritance/not-discriminated/valid") + .post({ body: validBody }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelInheritanceRecursive.spec.ts b/packages/typespec-ts/test/azureIntegration/modelInheritanceRecursive.spec.ts new file mode 100644 index 0000000000..71ce8eb367 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelInheritanceRecursive.spec.ts @@ -0,0 +1,45 @@ +import RecursiveClientFactory, { + Extension, + RecursiveClient +} from "./generated/type/model/inheritance/recursive/src/index.js"; +import { assert } from "chai"; + +const body: Extension = { + level: 0, + extension: [ + { + level: 1, + extension: [ + { + level: 2 + } + ] + }, + { + level: 1 + } + ] +}; +describe("Recursive Client", () => { + let client: RecursiveClient; + + beforeEach(() => { + client = RecursiveClientFactory({ + allowInsecureConnection: true + }); + }); + + it("Inheritance Recursive put test", async () => { + const result = await client + .path("/type/model/inheritance/recursive") + .put({ body }); + assert.equal(result.status, "204"); + }); + + it("Inheritance Recursive get test", async () => { + const result = await client + .path("/type/model/inheritance/recursive") + .get(); + assert.equal(result.status, "200"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelInheritanceSingleDiscriminator.spec.ts b/packages/typespec-ts/test/azureIntegration/modelInheritanceSingleDiscriminator.spec.ts new file mode 100644 index 0000000000..12e54b7e41 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelInheritanceSingleDiscriminator.spec.ts @@ -0,0 +1,96 @@ +import SingleDiscriminatorClientFactory, { + Eagle, + SingleDiscriminatorClient, + Sparrow +} from "./generated/type/model/inheritance/single-discriminator/src/index.js"; +import { assert } from "chai"; + +describe("SingleDiscriminatorClient Rest Client", () => { + let client: SingleDiscriminatorClient; + + beforeEach(() => { + client = SingleDiscriminatorClientFactory({ + allowInsecureConnection: true + }); + }); + + const validBody: Sparrow = { + wingspan: 1, + kind: "sparrow" + }; + const validRecursiveBody: Eagle = { + wingspan: 5, + kind: "eagle", + partner: { + wingspan: 2, + kind: "goose" + }, + friends: [ + { + wingspan: 2, + kind: "seagull" + } + ], + hate: { + key3: { + wingspan: 1, + kind: "sparrow" + } + } + }; + it("should get model with single discriminator", async () => { + const result = await client + .path("/type/model/inheritance/single-discriminator/model") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, validBody); + }); + + it("should put model with single discriminator", async () => { + const result = await client + .path("/type/model/inheritance/single-discriminator/model") + .put({ body: validBody }); + assert.strictEqual(result.status, "204"); + }); + + it("should get recursive model with single discriminator", async () => { + const result = await client + .path("/type/model/inheritance/single-discriminator/recursivemodel") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, validRecursiveBody); + }); + + it("should put recursive model with single discriminator", async () => { + const result = await client + .path("/type/model/inheritance/single-discriminator/recursivemodel") + .put({ body: validRecursiveBody }); + assert.strictEqual(result.status, "204"); + }); + + it("should get if missing discriminator", async () => { + const result = await client + .path( + "/type/model/inheritance/single-discriminator/missingdiscriminator" + ) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { wingspan: 1 } as any); + }); + + it("should get if wrong discriminator", async () => { + const result = await client + .path("/type/model/inheritance/single-discriminator/wrongdiscriminator") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { wingspan: 1, kind: "wrongKind" } as any); + }); + + it("should get legacy model", async () => { + const result = await client + .path("/type/model/inheritance/single-discriminator/legacy-model") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, { size: 20, kind: "t-rex" }); + }); +}); diff --git a/packages/typespec-ts/test/integration/modelPropertyAdditional.spec.ts b/packages/typespec-ts/test/azureIntegration/modelPropertyAdditional.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/modelPropertyAdditional.spec.ts rename to packages/typespec-ts/test/azureIntegration/modelPropertyAdditional.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/modelPropertyNullable.spec.ts b/packages/typespec-ts/test/azureIntegration/modelPropertyNullable.spec.ts new file mode 100644 index 0000000000..5f98e9c423 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelPropertyNullable.spec.ts @@ -0,0 +1,103 @@ +import { assert } from "chai"; +import TypePropertyNullableClientFactory, { + NullableClient +} from "./generated/type/property/nullable/src/index.js"; +import { matrix } from "../util/matrix.js"; + +interface TypeDetail { + type: string; + defaultValue: any; + convertedToFn?: (_: any) => any; +} + +const testedTypes: TypeDetail[] = [ + { + type: "string", + defaultValue: "hello" + }, + { + type: "bytes", + defaultValue: "aGVsbG8sIHdvcmxkIQ==" + }, + { + type: "datetime", + defaultValue: "2022-08-26T18:38:00Z" + }, + { + type: "duration", + defaultValue: "P123DT22H14M12.011S" + }, + { + type: "collections/bytes", + defaultValue: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="] + }, + { + type: "collections/model", + defaultValue: [{ property: "hello" }, { property: "world" }] + }, + { + type: "collections/string", + defaultValue: ["hello", "world"] + } +]; +describe("ModelsPropertyNullableClient Rest Client", () => { + let client: NullableClient; + + beforeEach(() => { + client = TypePropertyNullableClientFactory({ + allowInsecureConnection: true + }); + }); + + matrix([testedTypes], async (params: TypeDetail) => { + it(`should get a null value for nullable ${params.type}`, async () => { + const result = await client + .path(`/type/property/nullable/${params.type}/null` as any) + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.nullableProperty, null); + assert.deepEqual(result.body.requiredProperty, "foo"); + }); + + it(`should get a non-null value for nullable ${params.type}`, async () => { + const result = await client + .path(`/type/property/nullable/${params.type}/non-null` as any) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body.nullableProperty, params.defaultValue); + assert.deepEqual(result.body.requiredProperty, "foo"); + }); + + it(`should patch a null value for nullable ${params.type}`, async () => { + const result = await client + .path(`/type/property/nullable/${params.type}/null` as any) + .patch({ + contentType: "application/merge-patch+json", + body: { + requiredProperty: "foo", + nullableProperty: null + } + }); + assert.strictEqual(result.status, "204"); + }); + + it(`should patch a non-null value for nullable ${params.type}`, async () => { + let property; + if (params.convertedToFn) { + property = params.convertedToFn(params.defaultValue); + } else { + property = params.defaultValue; + } + const result = await client + .path(`/type/property/nullable/${params.type}/non-null` as any) + .patch({ + contentType: "application/merge-patch+json", + body: { + requiredProperty: "foo", + nullableProperty: property || null + } + }); + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelPropertyOptional.spec.ts b/packages/typespec-ts/test/azureIntegration/modelPropertyOptional.spec.ts new file mode 100644 index 0000000000..f41468bbff --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelPropertyOptional.spec.ts @@ -0,0 +1,563 @@ +import TypePropertyOptionalClientFactory, { + OptionalClient +} from "./generated/type/property/optionality/src/index.js"; +import { assert } from "chai"; + +describe("ModelsPropertyOptional Rest Client", () => { + let client: OptionalClient; + + beforeEach(() => { + client = TypePropertyOptionalClientFactory({ + allowInsecureConnection: true + }); + }); + + it("should get all string", async () => { + const result = await client + .path("/type/property/optional/string/all") + .get(); + + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "hello"); + }); + + it("should get default string", async () => { + const result = await client + .path("/type/property/optional/string/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all string", async () => { + const result = await client + .path("/type/property/optional/string/all") + .put({ + body: { property: "hello" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default string", async () => { + const result = await client + .path("/type/property/optional/string/default") + .put({ body: {} }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all bytes", async () => { + const result = await client + .path("/type/property/optional/bytes/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "aGVsbG8sIHdvcmxkIQ=="); + }); + + it("should get default bytes", async () => { + const result = await client + .path("/type/property/optional/bytes/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all bytes", async () => { + const result = await client + .path("/type/property/optional/bytes/all") + .put({ + body: { property: "aGVsbG8sIHdvcmxkIQ==" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default bytes", async () => { + const result = await client + .path("/type/property/optional/bytes/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all datetime", async () => { + const result = await client + .path("/type/property/optional/datetime/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "2022-08-26T18:38:00Z"); + }); + + it("should get default datetime", async () => { + const result = await client + .path("/type/property/optional/datetime/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all datetime", async () => { + const result = await client + .path("/type/property/optional/datetime/all") + .put({ + body: { property: "2022-08-26T18:38:00Z" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default datetime", async () => { + const result = await client + .path("/type/property/optional/datetime/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all duration", async () => { + const result = await client + .path("/type/property/optional/duration/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "P123DT22H14M12.011S"); + }); + + it("should get default duration", async () => { + const result = await client + .path("/type/property/optional/duration/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all duration", async () => { + const result = await client + .path("/type/property/optional/duration/all") + .put({ + body: { property: "P123DT22H14M12.011S" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default duration", async () => { + const result = await client + .path("/type/property/optional/duration/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all plainDate", async () => { + const result = await client + .path("/type/property/optional/plainDate/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "2022-12-12"); + }); + + it("should get default plainDate", async () => { + const result = await client + .path("/type/property/optional/plainDate/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all plainDate", async () => { + const result = await client + .path("/type/property/optional/plainDate/all") + .put({ + body: { property: "2022-12-12" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default plainDate", async () => { + const result = await client + .path("/type/property/optional/plainDate/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all plainTime", async () => { + const result = await client + .path("/type/property/optional/plainTime/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "13:06:12"); + }); + + it("should get default plainTime", async () => { + const result = await client + .path("/type/property/optional/plainTime/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all plainTime", async () => { + const result = await client + .path("/type/property/optional/plainTime/all") + .put({ + body: { property: "13:06:12" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default plainTime", async () => { + const result = await client + .path("/type/property/optional/plainTime/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all collections bytes", async () => { + const result = await client + .path("/type/property/optional/collections/bytes/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property?.length, 2); + }); + + it("should get default collections bytes", async () => { + const result = await client + .path("/type/property/optional/collections/bytes/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all collections bytes", async () => { + const result = await client + .path("/type/property/optional/collections/bytes/all") + .put({ + body: { property: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="] } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default collections bytes", async () => { + const result = await client + .path("/type/property/optional/collections/bytes/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all collections model", async () => { + const result = await client + .path("/type/property/optional/collections/model/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property?.length, 2); + }); + + it("should get default collections model", async () => { + const result = await client + .path("/type/property/optional/collections/model/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all collections model", async () => { + const result = await client + .path("/type/property/optional/collections/model/all") + .put({ + body: { property: [{ property: "hello" }, { property: "world" }] } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default collections model", async () => { + const result = await client + .path("/type/property/optional/collections/model/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all string literal", async () => { + const result = await client + .path("/type/property/optional/string/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "hello"); + }); + + it("should get default string literal", async () => { + const result = await client + .path("/type/property/optional/string/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all string literal", async () => { + const result = await client + .path("/type/property/optional/string/literal/all") + .put({ + body: { property: "hello" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default string literal", async () => { + const result = await client + .path("/type/property/optional/string/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all int literal", async () => { + const result = await client + .path("/type/property/optional/int/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, 1); + }); + + it("should get default int literal", async () => { + const result = await client + .path("/type/property/optional/int/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all int literal", async () => { + const result = await client + .path("/type/property/optional/int/literal/all") + .put({ + body: { property: 1 } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default int literal", async () => { + const result = await client + .path("/type/property/optional/int/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all float literal", async () => { + const result = await client + .path("/type/property/optional/float/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, 1.25); + }); + + it("should get default float literal", async () => { + const result = await client + .path("/type/property/optional/float/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all float literal", async () => { + const result = await client + .path("/type/property/optional/float/literal/all") + .put({ + body: { property: 1.25 } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default float literal", async () => { + const result = await client + .path("/type/property/optional/float/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all boolean literal", async () => { + const result = await client + .path("/type/property/optional/boolean/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, true); + }); + + it("should get default boolean literal", async () => { + const result = await client + .path("/type/property/optional/boolean/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all boolean literal", async () => { + const result = await client + .path("/type/property/optional/boolean/literal/all") + .put({ + body: { property: true } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default boolean literal", async () => { + const result = await client + .path("/type/property/optional/boolean/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all union string literal", async () => { + const result = await client + .path("/type/property/optional/union/string/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, "world"); + }); + + it("should get default union string literal", async () => { + const result = await client + .path("/type/property/optional/union/string/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all union string literal", async () => { + const result = await client + .path("/type/property/optional/union/string/literal/all") + .put({ + body: { property: "world" } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default union string literal", async () => { + const result = await client + .path("/type/property/optional/union/string/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all union int literal", async () => { + const result = await client + .path("/type/property/optional/union/int/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, 2); + }); + + it("should get default union int literal", async () => { + const result = await client + .path("/type/property/optional/union/int/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all union int literal", async () => { + const result = await client + .path("/type/property/optional/union/int/literal/all") + .put({ + body: { property: 2 } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default union int literal", async () => { + const result = await client + .path("/type/property/optional/union/int/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get all union float literal", async () => { + const result = await client + .path("/type/property/optional/union/float/literal/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.property, 2.375); + }); + + it("should get default union float literal", async () => { + const result = await client + .path("/type/property/optional/union/float/literal/default") + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, {}); + }); + + it("should put all union float literal", async () => { + const result = await client + .path("/type/property/optional/union/float/literal/all") + .put({ + body: { property: 2.375 } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put default union float literal", async () => { + const result = await client + .path("/type/property/optional/union/float/literal/default") + .put({ + body: {} + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get models that will return all properties in the model", async () => { + const result = await client + .path("/type/property/optional/requiredAndOptional/all") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.optionalProperty, "hello"); + assert.strictEqual(result.body.requiredProperty, 42); + }); + + it("should get models that will return only the required properties", async () => { + const result = await client + .path("/type/property/optional/requiredAndOptional/requiredOnly") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.requiredProperty, 42); + }); + + it("should put a body with all properties present", async () => { + const result = await client + .path("/type/property/optional/requiredAndOptional/all") + .put({ + body: { + requiredProperty: 42, + optionalProperty: "hello" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should put a body with only required properties", async () => { + const result = await client + .path("/type/property/optional/requiredAndOptional/requiredOnly") + .put({ + body: { + requiredProperty: 42 + } + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelPropertyType.spec.ts b/packages/typespec-ts/test/azureIntegration/modelPropertyType.spec.ts new file mode 100644 index 0000000000..63e9b7d5b8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelPropertyType.spec.ts @@ -0,0 +1,167 @@ +import TypePropertyValueTypesClientFactory, { + ValueTypesClient +} from "./generated/type/property/value-types/src/index.js"; +import { assert } from "chai"; +import { matrix } from "../util/matrix.js"; + +interface TypeDetail { + type: string; + defaultValue: any; + convertedToFn?: (_: any) => any; +} + +const testedTypes: TypeDetail[] = [ + { + type: "boolean", + defaultValue: true + }, + { + type: "string", + defaultValue: "hello" + }, + { + type: "bytes", + defaultValue: "aGVsbG8sIHdvcmxkIQ==" + }, + { + type: "int", + defaultValue: 42 + }, + { + type: "float", + defaultValue: 43.125 + }, + { + type: "decimal", + defaultValue: 0.33333 + }, + { + type: "decimal128", + defaultValue: 0.33333 + }, + { + type: "datetime", + defaultValue: "2022-08-26T18:38:00Z", + convertedToFn: (value: string) => new Date(value).toISOString() + }, + { + type: "duration", + defaultValue: "P123DT22H14M12.011S" + }, + { + type: "enum", + defaultValue: "ValueOne" + }, + { + type: "extensible-enum", + defaultValue: "UnknownValue" + }, + { + type: "model", + defaultValue: { property: "hello" } + }, + { + type: "collections/string", + defaultValue: ["hello", "world"] + }, + { + type: "collections/int", + defaultValue: [1, 2] + }, + { + type: "collections/model", + defaultValue: [{ property: "hello" }, { property: "world" }] + }, + { + type: "dictionary/string", + defaultValue: { k1: "hello", k2: "world" } + }, + { + type: "never", + defaultValue: undefined + }, + { + type: "unknown/string", + defaultValue: "hello" + }, + { + type: "unknown/int", + defaultValue: 42 + }, + { + type: "unknown/dict", + defaultValue: { k1: "hello", k2: 42 } + }, + { + type: "unknown/array", + defaultValue: ["hello", "world"] + }, + { + type: "string/literal", + defaultValue: "hello" + }, + { + type: "int/literal", + defaultValue: 42 + }, + { + type: "float/literal", + defaultValue: 43.125 + }, + { + type: "boolean/literal", + defaultValue: true + }, + { + type: "union/string/literal", + defaultValue: "world" + }, + { + type: "union/int/literal", + defaultValue: 42 + }, + { + type: "union/float/literal", + defaultValue: 46.875 + }, + { + type: "union-enum-value", + defaultValue: "value2" + } +]; +describe("ModelsPropertyTypesClient Rest Client", () => { + let client: ValueTypesClient; + + beforeEach(() => { + client = TypePropertyValueTypesClientFactory({ + allowInsecureConnection: true + }); + }); + + matrix([testedTypes], async (params: TypeDetail) => { + it(`should get a ${params.type} value`, async () => { + const result = await client + .path(`/type/property/value-types/${params.type}` as any) + .get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body.property, params.defaultValue); + }); + + it(`should put a ${params.type} value`, async () => { + let property; + if (params.convertedToFn) { + property = params.convertedToFn(params.defaultValue); + } else { + property = params.defaultValue; + } + const result = await client + .path(`/type/property/value-types/${params.type}` as any) + .put({ + body: { + property + } + }); + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/modelUsage.spec.ts b/packages/typespec-ts/test/azureIntegration/modelUsage.spec.ts new file mode 100644 index 0000000000..f61165710a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/modelUsage.spec.ts @@ -0,0 +1,35 @@ +import TypeModelUsageClientFactory, { + UsageClient +} from "./generated/type/model/usage/src/index.js"; +import { assert } from "chai"; +describe("ModelsUsageClient Rest Client", () => { + let client: UsageClient; + const body = { + requiredProp: "example-value" + }; + + beforeEach(() => { + client = TypeModelUsageClientFactory({ allowInsecureConnection: true }); + }); + + it("should post input model correctly", async () => { + const result = await client.path("/type/model/usage/input").post({ + body + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get output model correctly", async () => { + const result = await client.path("/type/model/usage/output").get(); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, body); + }); + + it("should get output model correctly", async () => { + const result = await client + .path("/type/model/usage/input-output") + .post({ body }); + assert.strictEqual(result.status, "200"); + assert.deepEqual(result.body, body); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/multipart.spec.ts b/packages/typespec-ts/test/azureIntegration/multipart.spec.ts new file mode 100644 index 0000000000..57bd645345 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/multipart.spec.ts @@ -0,0 +1,179 @@ +import { assert } from "chai"; +import { resolvePath } from "@typespec/compiler"; +import MultiPartClientFactory, { + MultiPartClient +} from "./generated/payload/multipart/src/index.js"; +import { resolve } from "path"; +import { readFile } from "fs/promises"; +import { fileURLToPath } from "url"; +describe("MultiPartClient Rest Client", () => { + let client: MultiPartClient; + + beforeEach(() => { + client = MultiPartClientFactory({ + allowInsecureConnection: true + }); + }); + const root = resolvePath(fileURLToPath(import.meta.url), "../../../temp"); + const imgPath = resolve(root, "./assets/image.jpg"); + const pngPath = resolve(root, "./assets/image.png"); + + describe("string + bytes", () => { + it("Buffer extends Uint8Array should be allowed", async () => { + const file = await readFile(imgPath); + const result = await client + .path("/multipart/form-data/mixed-parts") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "id", body: "123" }, + { name: "profileImage", body: file, filename: "profileImage.jpg" } + ] + }); + assert.strictEqual(result.status, "204"); + }); + + it("supports anonymous model file upload", async () => { + const result = await client + .path("/multipart/form-data/anonymous-model") + .post({ + contentType: "multipart/form-data", + body: [ + { + name: "profileImage", + body: await readFile(imgPath), + filename: "test.jpg" + } + ] + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("custom content type + filename", () => { + it("raises 400 error when filename and MIME type unspecified", async () => { + const file = await readFile(imgPath); + const result = await client + .path("/multipart/form-data/check-filename-and-content-type") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "id", body: "123" }, + { name: "profileImage", body: file, filename: "profileImage.jpg" } + ] + }); + assert.strictEqual(result.status, "400"); + assert.strictEqual((result as any).body.expected, "image/jpg"); + assert.strictEqual( + (result as any).body.actual, + "application/octet-stream" + ); + }); + it("allows specifying MIME type and filename", async () => { + const fileContent = await readFile(imgPath); + const filename = "hello.jpg"; + const contentType = "image/jpg"; + + const result = await client + .path("/multipart/form-data/check-filename-and-content-type") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "id", body: "123" }, + { name: "profileImage", body: fileContent, filename, contentType } + ] + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("bytes + bytes", () => { + it("can upload multiple files with same part name", async () => { + const file1 = await readFile(pngPath); + const result = await client + .path("/multipart/form-data/binary-array-parts") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "id", body: "123" }, + { name: "pictures", body: file1, filename: "test1.png" }, + { name: "pictures", body: file1, filename: "test.png" } + ] + }); + assert.strictEqual(result.status, "204"); + }); + + it("can skip uploading optional file parts", async () => { + const file = await readFile(imgPath); + const result = await client + .path("/multipart/form-data/multi-binary-parts") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "profileImage", body: file, filename: "profileImage.jpg" } + ] + }); + assert.strictEqual(result.status, "204"); + }); + + it("can upload optional file parts", async () => { + const file = await readFile(imgPath); + const optionalFile = await readFile(pngPath); + const result = await client + .path("/multipart/form-data/multi-binary-parts") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "profileImage", body: file, filename: "profileImage.jpg" }, + { name: "picture", body: optionalFile, filename: "aaa.png" } + ] + }); + assert.strictEqual(result.status, "204"); + }); + + it("complex body with multiple parts of different kinds", async () => { + const profileImage = await readFile(imgPath); + const optionalFile = await readFile(pngPath); + + const result = await client + .path("/multipart/form-data/complex-parts") + .post({ + contentType: "multipart/form-data", + body: [ + { name: "id", body: "123" }, + { name: "address", body: { city: "X" } }, + // body is a JSON array + { name: "previousAddresses", body: [{ city: "Y" }, { city: "Z" }] }, + { + name: "profileImage", + body: profileImage, + filename: "profileImage.jpg" + }, + { name: "pictures", body: optionalFile, filename: "aaa.png" }, + { name: "pictures", body: optionalFile, filename: "aaa.png" } + ] + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("JSON parts", () => { + it("supports JSON part with file upload", async () => { + const profileImage = await readFile(imgPath); + + const result = await client.path("/multipart/form-data/json-part").post({ + contentType: "multipart/form-data", + body: [ + { name: "address", body: { city: "X" } }, + { + name: "profileImage", + body: profileImage, + filename: "profileImage.jpg" + } + ] + }); + + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/integration/overload.spec.ts b/packages/typespec-ts/test/azureIntegration/overload.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/overload.spec.ts rename to packages/typespec-ts/test/azureIntegration/overload.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/payloadContentNegotiation.spec.ts b/packages/typespec-ts/test/azureIntegration/payloadContentNegotiation.spec.ts new file mode 100644 index 0000000000..88a3eed648 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/payloadContentNegotiation.spec.ts @@ -0,0 +1,93 @@ +import { assert } from "chai"; +import { uint8ArrayToString } from "@azure/core-util"; +import ContentNegotiationClientFactory, { + ContentNegotiationClient +} from "./generated/payload/content-negotiation/src/index.js"; + +import { readFileSync } from "fs"; +import { resolvePath } from "@typespec/compiler"; +import { fileURLToPath } from "url"; + +const root = resolvePath(fileURLToPath(import.meta.url), "../../../temp"); +const pngFile = readFileSync(resolvePath(root, "assets/image.png")); +const jpegImage = readFileSync(resolvePath(root, "assets/image.jpg")); +describe("Content Negotiation Client", () => { + let client: ContentNegotiationClient; + + beforeEach(() => { + client = ContentNegotiationClientFactory({ + allowInsecureConnection: true + }); + }); + + it("should get image/png for same body in content negotiation", async () => { + const result = await client.path("/content-negotiation/same-body").get({ + headers: { accept: "image/png" } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual( + uint8ArrayToString(result.body, "utf-8"), + pngFile.toString() + ); + }); + + it("should get image/jpeg for same body in content negotiation", async () => { + const result = await client + .path("/content-negotiation/same-body") + .get({ headers: { accept: "image/jpeg" } }); + assert.strictEqual(result.status, "200"); + assert.strictEqual( + uint8ArrayToString(result.body, "utf-8"), + jpegImage.toString() + ); + }); + + it("should return error if put wrong accept for same body in content negotiation", async () => { + const result = await client + .path("/content-negotiation/same-body") + .get({ headers: { accept: "wrongAccept" } as any }); + assert.strictEqual( + (result.body as any).message, + "Unsupported Accept header" + ); + assert.strictEqual( + (result.body as any).expected, + `"image/png" | "image/jpeg"` + ); + assert.strictEqual((result.body as any).actual, "wrongAccept"); + }); + + it("should get image/png for different body in content negotiation", async () => { + const result = await client + .path("/content-negotiation/different-body") + .get({ headers: { accept: "image/png" } }); + assert.strictEqual(result.status, "200"); + assert.strictEqual( + uint8ArrayToString(result.body, "utf-8"), + pngFile.toString() + ); + }); + + it("should get application/json for different body in content negotiation", async () => { + const result = await client + .path("/content-negotiation/different-body") + .get({ headers: { accept: "application/json" } }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.content, pngFile.toString("base64")); + }); + + it("should return error if put wrong accept for different body in content negotiation", async () => { + const result = await client + .path("/content-negotiation/different-body") + .get({ headers: { accept: "wrongAccept" } as any }); + assert.strictEqual( + (result.body as any).message, + "Unsupported Accept header" + ); + assert.strictEqual( + (result.body as any).expected, + `"image/png" | "application/json"` + ); + assert.strictEqual((result.body as any).actual, "wrongAccept"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/payloadMediaType.spec.ts b/packages/typespec-ts/test/azureIntegration/payloadMediaType.spec.ts new file mode 100644 index 0000000000..f21429d6e9 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/payloadMediaType.spec.ts @@ -0,0 +1,48 @@ +import { assert } from "chai"; +import MediaTypeClientFactory, { + MediaTypeClient +} from "./generated/payload/media-type/src/index.js"; + +describe("MediaType Client", () => { + let client: MediaTypeClient; + + beforeEach(() => { + client = MediaTypeClientFactory({ + allowInsecureConnection: true + }); + }); + + it("should getAsText", async () => { + const result = await client + .path("/payload/media-type/string-body/getAsText") + .get({ accept: "text/plain" }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "{cat}"); + + }); + + it("should sendAsText", async () => { + const result = await client + .path("/payload/media-type/string-body/sendAsText") + .post({ body: "{cat}", contentType: "text/plain" }); + assert.strictEqual(result.status, "200"); + + }); + + it("should sendAsJson", async () => { + const result = await client + .path("/payload/media-type/string-body/sendAsJson") + .post({ body: "foo", contentType: "application/json" }); + assert.strictEqual(result.status, "200"); + + }); + + it("should getAsJson", async () => { + const result = await client + .path("/payload/media-type/string-body/getAsJson") + .get({ accept: "application/json" }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "foo"); + + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/payloadPageable.spec.ts b/packages/typespec-ts/test/azureIntegration/payloadPageable.spec.ts new file mode 100644 index 0000000000..568be0c3d9 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/payloadPageable.spec.ts @@ -0,0 +1,29 @@ +import { assert } from "chai"; +import PageableClientFactory, { + PageableClient, +} from "./generated/payload/pageable/src/index.js"; + +describe("Pageable Client", () => { + let client: PageableClient; + + beforeEach(() => { + client = PageableClientFactory({ + allowInsecureConnection: true + }); + }); + + it("should get pagable Server Driven Pagination link", async () => { + const result = await client + .path("/payload/pageable/server-driven-pagination/link") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.pets[0]?.id, "1"); + assert.strictEqual(result.body.pets[0]?.name, 'dog'); + assert.strictEqual(result.body.pets[1]?.id, "2"); + assert.strictEqual(result.body.pets[1]?.name, 'cat'); + assert.strictEqual( + result.body.links.next, + "http://localhost:3000/payload/pageable/server-driven-pagination/link/nextPage" + ); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/repeatableHeaders.spec.ts b/packages/typespec-ts/test/azureIntegration/repeatableHeaders.spec.ts new file mode 100644 index 0000000000..d772539dbc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/repeatableHeaders.spec.ts @@ -0,0 +1,29 @@ +import { assert } from "chai"; +import RepeatabilityClientFactory, { + RepeatabilityClient +} from "./generated/special-headers/repeatability/src/index.js"; +describe("RepeatabilityClient", () => { + let client: RepeatabilityClient; + + beforeEach(() => { + client = RepeatabilityClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should set repeatable headers correctly", async () => { + const result = await client + .path("/special-headers/repeatability/immediateSuccess") + .post({ + headers: { + "Repeatability-First-Sent": "Tue, 15 Nov 2022 12:45:26 GMT", + "Repeatability-Request-ID": "2378d9bc-1726-11ee-be56-0242ac120002" // fake uuid + } + }); + assert.strictEqual(result.status, "204"); + assert.strictEqual(result.headers["repeatability-result"], "accepted"); + }); +}); diff --git a/packages/typespec-ts/test/integration/resiliencyDpgCustomization.spec.ts b/packages/typespec-ts/test/azureIntegration/resiliencyDpgCustomization.spec.ts similarity index 100% rename from packages/typespec-ts/test/integration/resiliencyDpgCustomization.spec.ts rename to packages/typespec-ts/test/azureIntegration/resiliencyDpgCustomization.spec.ts diff --git a/packages/typespec-ts/test/azureIntegration/routes.spec.ts b/packages/typespec-ts/test/azureIntegration/routes.spec.ts new file mode 100644 index 0000000000..dbfd001b9f --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/routes.spec.ts @@ -0,0 +1,238 @@ +import RoutesClientFactory, { + RoutesClient, +} from "./generated/routes/src/index.js"; +import { assert } from "chai"; +describe("RoutesClient Rest Client", () => { + let client: RoutesClient; + + beforeEach(() => { + client = RoutesClientFactory({ + allowInsecureConnection: true + }); + }); + + it("should have PathParameters templateOnly", async () => { + const result = await client + .path("/routes/path/template-only/{param}", "a") + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should have PathParameters explicit", async () => { + const result = await client + .path("/routes/path/explicit/{param}", "a") + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should have PathParameters annotationOnly", async () => { + const result = await client + .path("/routes/path/annotation-only/{param}", "a") + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should have allowReserved: true", async () => { + const result = await client + .path("/routes/path/reserved-expansion/template/{param}", { + value: "foo/bar baz", + allowReserved: true + }) + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should have allowReserved: true with helper", async () => { + const result = await client + .path( + "/routes/path/reserved-expansion/template/{param}", + { + value: "foo/bar baz", + allowReserved: true + } + ) + .get(); + assert.strictEqual(result.status, "204"); + }); + + it("should have explode: true array", async () => { + const result = await client + .path("/routes/query/query-expansion/explode/array") + .get({ + queryParameters: { + param: { + value: ["a", "b"], + explode: true, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should have explode: true record", async () => { + const result = await client + .path("/routes/query/query-expansion/explode/record") + .get({ + queryParameters: { + param: { + value: { a: 1, b: 2 }, + explode: true, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should have explode: true primitive", async () => { + const result = await client + .path("/routes/query/query-expansion/explode/primitive") + .get({ + queryParameters: { + param: "a" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should have explode: false array", async () => { + const result = await client + .path("/routes/query/query-expansion/standard/array") + .get({ + queryParameters: { + param: ["a", "b"] + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should have explode: false record", async () => { + const result = await client + .path("/routes/query/query-expansion/standard/record") + .get({ + queryParameters: { + param: { + value: { a: 1, b: 2 }, + explode: false, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should have explode: false primitive", async () => { + const result = await client + .path("/routes/query/query-expansion/standard/primitive") + .get({ + queryParameters: { + param: "a" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should have QueryParameters templateOnly", async () => { + const result = await client + .path("/routes/query/template-only") + .get({ queryParameters: { param: "a" } }); + assert.strictEqual(result.status, "204"); + }); + + it("should have QueryParameters explicit", async () => { + const result = await client + .path("/routes/query/explicit") + .get({ queryParameters: { param: "a" } }); + assert.strictEqual(result.status, "204"); + }); + + it("should have QueryParameters annotationOnly", async () => { + const result = await client + .path("/routes/query/annotation-only") + .get({ queryParameters: { param: "a" } }); + assert.strictEqual(result.status, "204"); + }); + + describe("Query continuation", () => { + it("should pass query-continuation with standard array correctly", async () => { + const result = await client + .path("/routes/query/query-continuation/standard/array?fixed=true") + .get({ + queryParameters: { + param: ["a", "b"] + } + }); + assert.strictEqual(result.status, "204"); + }); + + + it("should pass query-continuation with standard primitive correctly", async () => { + const result = await client + .path("/routes/query/query-continuation/standard/primitive?fixed=true") + .get({ + queryParameters: { + param: "a" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should pass query-continuation with standard record correctly", async () => { + const result = await client + .path("/routes/query/query-continuation/standard/record?fixed=true") + .get({ + queryParameters: { + param: { + value: { a: 1, b: 2 }, + explode: false, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should pass query-continuation with exploded record correctly", async () => { + const result = await client + .path("/routes/query/query-continuation/explode/record?fixed=true") + .get({ + queryParameters: { + param: { + value: { a: 1, b: 2 }, + explode: true, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should pass query-continuation with exploded primitive correctly", async () => { + const result = await client + .path("/routes/query/query-continuation/explode/primitive?fixed=true") + .get({ + queryParameters: { + param: "a" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should pass query-continuation with exploded array correctly", async () => { + const result = await client + .path("/routes/query/query-continuation/explode/array?fixed=true") + .get({ + queryParameters: { + param: { + value: ["a", "b"], + explode: true, + style: "form" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + +}); diff --git a/packages/typespec-ts/test/azureIntegration/scalar.spec.ts b/packages/typespec-ts/test/azureIntegration/scalar.spec.ts new file mode 100644 index 0000000000..d32bc151c5 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/scalar.spec.ts @@ -0,0 +1,131 @@ +import { assert } from "chai"; +import ScalarClientFactory, { + ScalarClient +} from "./generated/type/scalar/src/index.js"; + +describe("Scalar Client", () => { + let client: ScalarClient; + + beforeEach(() => { + client = ScalarClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get string value", async () => { + const result = await client.path("/type/scalar/string").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "test"); + }); + + it("should put string value", async () => { + const result = await client + .path("/type/scalar/string") + .put({ body: "test", headers: { "content-type": "text/plain" } }); + assert.strictEqual(result.status, "204"); + }); + + it("should get boolean value", async () => { + const result = await client.path("/type/scalar/boolean").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, true); + }); + + it("should put boolean value", async () => { + const result = await client + .path("/type/scalar/boolean") + .put({ body: true }); + assert.strictEqual(result.status, "204"); + }); + + it("should get unknown value", async () => { + const result = await client.path("/type/scalar/unknown").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "test"); + }); + + it("should put unknown value", async () => { + const result = await client + .path("/type/scalar/unknown") + .put({ body: "test", headers: { "content-type": "text/plain" } }); + assert.strictEqual(result.status, "204"); + }); + + it("should get decimal response body", async () => { + const result = await client + .path("/type/scalar/decimal/response_body") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, 0.33333); + }); + + it("should put decimal request body", async () => { + const result = await client + .path("/type/scalar/decimal/resquest_body") + .put({ body: 0.33333 }); + assert.strictEqual(result.status, "204"); + }); + + it("should get decimal request parameter", async () => { + const result = await client + .path("/type/scalar/decimal/request_parameter") + .get({ queryParameters: { value: 0.33333 } }); + assert.strictEqual(result.status, "204"); + }); + + it("should get decimal128 response body", async () => { + const result = await client + .path("/type/scalar/decimal128/response_body") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, 0.33333); + }); + + it("should put decimal128 request body", async () => { + const result = await client + .path("/type/scalar/decimal128/resquest_body") + .put({ body: 0.33333 }); + assert.strictEqual(result.status, "204"); + }); + + it("should get decimal128 request parameter", async () => { + const result = await client + .path("/type/scalar/decimal128/request_parameter") + .get({ queryParameters: { value: 0.33333 } }); + assert.strictEqual(result.status, "204"); + }); + + it("should fail to post decimal verify", async () => { + // prepare the verification + const getResult = await client + .path("/type/scalar/decimal/prepare_verify") + .get(); + // do any calculation based on numbers + let total = 0; + getResult.body.forEach((decimal: number) => { + total += decimal; + }); + const result = await client + .path("/type/scalar/decimal/verify") + .post({ body: total }); + assert.strictEqual(result.status, "400"); + }); + + it("should fail to post decimal128 verify", async () => { + const getResult = await client + .path("/type/scalar/decimal128/prepare_verify") + .get(); + // do any calculation based on numbers + let total = 0; + getResult.body.forEach((decimal: number) => { + total += decimal; + }); + const result = await client + .path("/type/scalar/decimal128/verify") + .post({ body: total }); + assert.strictEqual(result.status, "400"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/serializationEncodeNameJson.spec.ts b/packages/typespec-ts/test/azureIntegration/serializationEncodeNameJson.spec.ts new file mode 100644 index 0000000000..6e75b400a9 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/serializationEncodeNameJson.spec.ts @@ -0,0 +1,33 @@ +import { assert } from "chai"; +import SerializationEncodedNameJsonClientFactory, { + SerializationEncodedNameJsonClient +} from "./generated/serialization/encoded-name/json/src/index.js"; +describe("ClientEncodedNameClient Rest Client", () => { + let client: SerializationEncodedNameJsonClient; + + beforeEach(() => { + client = SerializationEncodedNameJsonClientFactory({ + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should post json property", async () => { + const result = await client + .path("/serialization/encoded-name/json/property") + .post({ + body: { wireName: true } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get json property", async () => { + const result = await client + .path("/serialization/encoded-name/json/property") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.wireName, true); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/server.spec.ts b/packages/typespec-ts/test/azureIntegration/server.spec.ts new file mode 100644 index 0000000000..9d4ccfecc2 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/server.spec.ts @@ -0,0 +1,141 @@ +import { assert } from "chai"; +import SingleParamInServerPathClientFactory, { + SingleParamInServerPathClient +} from "./generated/server/path/single/src/index.js"; +import MultipleParamInServerPathClientFactory, { + MultipleParamInServerPathClient +} from "./generated/server/path/multiple/src/index.js"; +import NotVersionedParamInServerVersionsClientFactory, { + NotVersionedParamInServerVersionsClient +} from "./generated/server/versions/not-versioned/src/index.js"; +import VersionedParamInServerVersionsClientFactory, { + VersionedParamInServerVersionsClient +} from "./generated/server/versions/versioned/src/index.js"; + +describe("SingleParamInServerPath Rest Client", () => { + let client: SingleParamInServerPathClient; + + beforeEach(() => { + client = SingleParamInServerPathClientFactory("http://localhost:3000", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should work with no param", async () => { + const result = await client.path("/server/path/single/myOp").head(); + assert.strictEqual(result.status, "200"); + }); +}); + +describe("MultipleParamInServerPath Rest Client", () => { + let client: MultipleParamInServerPathClient; + + beforeEach(() => { + client = MultipleParamInServerPathClientFactory("http://localhost:3000", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should work with no param", async () => { + const result = await client.path("/").get(); + assert.strictEqual(result.status, "204"); + }); + + it("should work with param", async () => { + const result = await client.path("/{keyword}", "test").get(); + assert.strictEqual(result.status, "204"); + }); +}); + +describe(" NotVersionedParamInServerVersions Rest Client", () => { + let client: NotVersionedParamInServerVersionsClient; + + beforeEach(() => { + client = NotVersionedParamInServerVersionsClientFactory( + "http://localhost:3000", + { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + } + ); + }); + + it("should work with no param", async () => { + const result = await client + .path("/server/versions/not-versioned/without-api-version") + .head(); + assert.strictEqual(result.status, "200"); + }); + + it("should work with param", async () => { + const result = await client + .path("/server/versions/not-versioned/with-query-api-version") + .head({ queryParameters: { "api-version": "v1.0" } }); + assert.strictEqual(result.status, "200"); + }); + + it("should work with path param", async () => { + const result = await client + .path( + "/server/versions/not-versioned/with-path-api-version/{apiVersion}", + "v1.0" + ) + .head(); + assert.strictEqual(result.status, "200"); + }); +}); + +describe(" VersionedParamInServerVersions Rest Client", () => { + let client: VersionedParamInServerVersionsClient; + + beforeEach(() => { + client = VersionedParamInServerVersionsClientFactory( + "http://localhost:3000", + { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + } + ); + }); + + it("should work with no param", async () => { + const result = await client + .path("/server/versions/versioned/without-api-version") + .head(); + assert.strictEqual(result.status, "200"); + }); + + it("should work with param", async () => { + const result = await client + .path("/server/versions/versioned/with-query-api-version") + .head({ queryParameters: { "api-version": "2022-12-01-preview" } }); + assert.strictEqual(result.status, "200"); + }); + + it("should work with path param", async () => { + const result = await client + .path( + "/server/versions/versioned/with-path-api-version/{apiVersion}", + "2022-12-01-preview" + ) + .head(); + assert.strictEqual(result.status, "200"); + }); + + it("should work with old param", async () => { + const result = await client + .path("/server/versions/versioned/with-query-old-api-version") + .head({ queryParameters: { "api-version": "2021-01-01-preview" } }); + assert.strictEqual(result.status, "200"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/serverEndpointNotDefined.spec.ts b/packages/typespec-ts/test/azureIntegration/serverEndpointNotDefined.spec.ts new file mode 100644 index 0000000000..778ecf9e36 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/serverEndpointNotDefined.spec.ts @@ -0,0 +1,23 @@ +import { assert } from "chai"; +import NotDefinedParamInServerEndpointClientFactory, { + NotDefinedParamInServerEndpointClient +} from "./generated/server/endpoint/not-defined/src/index.js"; +describe("NotDefinedParamInServerEndpoint Rest Client", () => { + let client: NotDefinedParamInServerEndpointClient; + + beforeEach(() => { + client = NotDefinedParamInServerEndpointClientFactory( + "http://localhost:3000", + { + allowInsecureConnection: true + } + ); + }); + + it("should work with not defined endpoint", async () => { + const result = await client + .path("/server/endpoint/not-defined/valid") + .head(); + assert.strictEqual(result.status, "200"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/sharedRoutes.spec.ts b/packages/typespec-ts/test/azureIntegration/sharedRoutes.spec.ts new file mode 100644 index 0000000000..20dc96bede --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/sharedRoutes.spec.ts @@ -0,0 +1,20 @@ +import { assert } from "chai"; +import SharedRouteTestClientFactory, { + SharedRouteClient +} from "./generated/shared-route/src/index.js"; +describe("SharedRouteTest Rest Client", () => { + let client: SharedRouteClient; + + beforeEach(() => { + client = SharedRouteTestClientFactory("http://fake-url.com", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("client should be created", async () => { + assert.isNotNull(client); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/specialWords.spec.ts b/packages/typespec-ts/test/azureIntegration/specialWords.spec.ts new file mode 100644 index 0000000000..ce4ae4c07c --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/specialWords.spec.ts @@ -0,0 +1,784 @@ +import SpecialWordsClientFactory, { + SpecialWordsClient +} from "./generated/special-words/src/index.js"; +import { assert } from "chai"; + +describe("SpecialWordsClient Rest Client", () => { + let client: SpecialWordsClient; + + beforeEach(() => { + client = SpecialWordsClientFactory({ allowInsecureConnection: true }); + }); + + describe("operations", () => { + it("should get special words for operation `and`", async () => { + const result = await client.path("/special-words/operations/and").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `as`", async () => { + const result = await client.path("/special-words/operations/as").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `assert`", async () => { + const result = await client + .path("/special-words/operations/assert") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `async`", async () => { + const result = await client + .path("/special-words/operations/async") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `await`", async () => { + const result = await client + .path("/special-words/operations/await") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `break`", async () => { + const result = await client + .path("/special-words/operations/break") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `class`", async () => { + const result = await client + .path("/special-words/operations/class") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `constructor`", async () => { + const result = await client + .path("/special-words/operations/constructor") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `continue`", async () => { + const result = await client + .path("/special-words/operations/continue") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `def`", async () => { + const result = await client.path("/special-words/operations/def").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `del`", async () => { + const result = await client.path("/special-words/operations/del").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `elif`", async () => { + const result = await client + .path("/special-words/operations/elif") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `else`", async () => { + const result = await client + .path("/special-words/operations/else") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `except`", async () => { + const result = await client + .path("/special-words/operations/except") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `exec`", async () => { + const result = await client + .path("/special-words/operations/exec") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `finally`", async () => { + const result = await client + .path("/special-words/operations/finally") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `for`", async () => { + const result = await client.path("/special-words/operations/for").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `from`", async () => { + const result = await client + .path("/special-words/operations/from") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `global`", async () => { + const result = await client + .path("/special-words/operations/global") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `if`", async () => { + const result = await client.path("/special-words/operations/if").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `import`", async () => { + const result = await client + .path("/special-words/operations/import") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `in`", async () => { + const result = await client.path("/special-words/operations/in").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `is`", async () => { + const result = await client.path("/special-words/operations/is").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `lambda`", async () => { + const result = await client + .path("/special-words/operations/lambda") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `not`", async () => { + const result = await client.path("/special-words/operations/not").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `or`", async () => { + const result = await client.path("/special-words/operations/or").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `pass`", async () => { + const result = await client + .path("/special-words/operations/pass") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `raise`", async () => { + const result = await client + .path("/special-words/operations/raise") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `return`", async () => { + const result = await client + .path("/special-words/operations/return") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `try`", async () => { + const result = await client.path("/special-words/operations/try").get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `while`", async () => { + const result = await client + .path("/special-words/operations/while") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `with`", async () => { + const result = await client + .path("/special-words/operations/with") + .get(); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `yield`", async () => { + const result = await client + .path("/special-words/operations/yield") + .get(); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("parameters", () => { + it("should get special words for operation `and`", async () => { + const result = await client.path("/special-words/parameters/and").get({ + queryParameters: { + and: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `as`", async () => { + const result = await client.path("/special-words/parameters/as").get({ + queryParameters: { + as: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `assert`", async () => { + const result = await client + .path("/special-words/parameters/assert") + .get({ + queryParameters: { + assert: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `async`", async () => { + const result = await client + .path("/special-words/parameters/async") + .get({ + queryParameters: { + async: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `await`", async () => { + const result = await client + .path("/special-words/parameters/await") + .get({ + queryParameters: { + await: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `break`", async () => { + const result = await client + .path("/special-words/parameters/break") + .get({ + queryParameters: { + break: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `class`", async () => { + const result = await client + .path("/special-words/parameters/class") + .get({ + queryParameters: { + class: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `constructor`", async () => { + const result = await client + .path("/special-words/parameters/constructor") + .get({ + queryParameters: { + constructor: "ok" as any + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `continue`", async () => { + const result = await client + .path("/special-words/parameters/continue") + .get({ + queryParameters: { + continue: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `def`", async () => { + const result = await client.path("/special-words/parameters/def").get({ + queryParameters: { + def: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `del`", async () => { + const result = await client.path("/special-words/parameters/del").get({ + queryParameters: { + del: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `elif`", async () => { + const result = await client.path("/special-words/parameters/elif").get({ + queryParameters: { + elif: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `else`", async () => { + const result = await client.path("/special-words/parameters/else").get({ + queryParameters: { + else: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `except`", async () => { + const result = await client + .path("/special-words/parameters/except") + .get({ + queryParameters: { + except: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `exec`", async () => { + const result = await client.path("/special-words/parameters/exec").get({ + queryParameters: { + exec: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `finally`", async () => { + const result = await client + .path("/special-words/parameters/finally") + .get({ + queryParameters: { + finally: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `for`", async () => { + const result = await client.path("/special-words/parameters/for").get({ + queryParameters: { + for: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `from`", async () => { + const result = await client.path("/special-words/parameters/from").get({ + queryParameters: { + from: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `global`", async () => { + const result = await client + .path("/special-words/parameters/global") + .get({ + queryParameters: { + global: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `if`", async () => { + const result = await client.path("/special-words/parameters/if").get({ + queryParameters: { + if: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `import`", async () => { + const result = await client + .path("/special-words/parameters/import") + .get({ + queryParameters: { + import: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `in`", async () => { + const result = await client.path("/special-words/parameters/in").get({ + queryParameters: { + in: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `is`", async () => { + const result = await client.path("/special-words/parameters/is").get({ + queryParameters: { + is: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `lambda`", async () => { + const result = await client + .path("/special-words/parameters/lambda") + .get({ + queryParameters: { + lambda: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `not`", async () => { + const result = await client.path("/special-words/parameters/not").get({ + queryParameters: { + not: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `or`", async () => { + const result = await client.path("/special-words/parameters/or").get({ + queryParameters: { + or: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `pass`", async () => { + const result = await client.path("/special-words/parameters/pass").get({ + queryParameters: { + pass: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `raise`", async () => { + const result = await client + .path("/special-words/parameters/raise") + .get({ + queryParameters: { + raise: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `return`", async () => { + const result = await client + .path("/special-words/parameters/return") + .get({ + queryParameters: { + return: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `try`", async () => { + const result = await client.path("/special-words/parameters/try").get({ + queryParameters: { + try: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `while`", async () => { + const result = await client + .path("/special-words/parameters/while") + .get({ + queryParameters: { + while: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `with`", async () => { + const result = await client.path("/special-words/parameters/with").get({ + queryParameters: { + with: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `yield`", async () => { + const result = await client + .path("/special-words/parameters/yield") + .get({ + queryParameters: { + yield: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `cancellationToken`", async () => { + const result = await client + .path("/special-words/parameters/cancellationToken") + .get({ + queryParameters: { + cancellationToken: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("models", () => { + it("should get special words for operation `and`", async () => { + const result = await client.path("/special-words/models/and").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `as`", async () => { + const result = await client.path("/special-words/models/as").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `assert`", async () => { + const result = await client.path("/special-words/models/assert").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `async`", async () => { + const result = await client.path("/special-words/models/async").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `await`", async () => { + const result = await client.path("/special-words/models/await").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `break`", async () => { + const result = await client.path("/special-words/models/break").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `class`", async () => { + const result = await client.path("/special-words/models/class").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `constructor`", async () => { + const result = await client + .path("/special-words/models/constructor") + .post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `continue`", async () => { + const result = await client + .path("/special-words/models/continue") + .post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `def`", async () => { + const result = await client.path("/special-words/models/def").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `del`", async () => { + const result = await client.path("/special-words/models/del").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `elif`", async () => { + const result = await client.path("/special-words/models/elif").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `else`", async () => { + const result = await client.path("/special-words/models/else").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `except`", async () => { + const result = await client.path("/special-words/models/except").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `exec`", async () => { + const result = await client.path("/special-words/models/exec").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `finally`", async () => { + const result = await client.path("/special-words/models/finally").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `for`", async () => { + const result = await client.path("/special-words/models/for").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `from`", async () => { + const result = await client.path("/special-words/models/from").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `global`", async () => { + const result = await client.path("/special-words/models/global").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `if`", async () => { + const result = await client.path("/special-words/models/if").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `import`", async () => { + const result = await client.path("/special-words/models/import").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `in`", async () => { + const result = await client.path("/special-words/models/in").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `is`", async () => { + const result = await client.path("/special-words/models/is").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `lambda`", async () => { + const result = await client.path("/special-words/models/lambda").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `not`", async () => { + const result = await client.path("/special-words/models/not").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `or`", async () => { + const result = await client.path("/special-words/models/or").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `pass`", async () => { + const result = await client.path("/special-words/models/pass").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `raise`", async () => { + const result = await client.path("/special-words/models/raise").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `return`", async () => { + const result = await client.path("/special-words/models/return").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `try`", async () => { + const result = await client.path("/special-words/models/try").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `while`", async () => { + const result = await client.path("/special-words/models/while").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `with`", async () => { + const result = await client.path("/special-words/models/with").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should get special words for operation `yield`", async () => { + const result = await client.path("/special-words/models/yield").post({ + body: { + name: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + }); + + describe("model properties", () => { + it("should post special words for operation `same-as-model`", async () => { + const result = await client + .path("/special-words/model-properties/same-as-model") + .post({ + body: { + SameAsModel: "ok" + } + }); + assert.strictEqual(result.status, "204"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/spreadParameters.spec.ts b/packages/typespec-ts/test/azureIntegration/spreadParameters.spec.ts new file mode 100644 index 0000000000..f91caaaa6d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/spreadParameters.spec.ts @@ -0,0 +1,133 @@ +import ParametersSpreadClientFactory, { + SpreadClient +} from "./generated/parameters/spread/src/index.js"; +import { assert } from "chai"; +describe("HelloClient Rest Client", () => { + let client: SpreadClient; + + beforeEach(() => { + client = ParametersSpreadClientFactory({ allowInsecureConnection: true }); + }); + + it("should spread named model", async () => { + const result = await client + .path("/parameters/spread/model/request-body") + .put({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread model composite request only with body param", async () => { + const result = await client + .path("/parameters/spread/model/composite-request-only-with-body") + .put({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread model composite request without body param", async () => { + const result = await client + .path( + "/parameters/spread/model/composite-request-without-body/{name}", + "foo" + ) + .put({ headers: { "test-header": "bar" } }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread model composite request", async () => { + const result = await client + .path("/parameters/spread/model/composite-request/{name}", "foo") + .put({ + headers: { "test-header": "bar" }, + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread model composite request mix", async () => { + const result = await client + .path("/parameters/spread/model/composite-request-mix/{name}", "foo") + .put({ + headers: { "test-header": "bar" }, + body: { + prop: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread alias with only body param", async () => { + const result = await client + .path("/parameters/spread/alias/request-body") + .put({ + body: { + name: "foo" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread alias with mixed params", async () => { + const result = await client + .path("/parameters/spread/alias/request-parameter/{id}", "1") + .put({ + body: { + name: "foo" + }, + headers: { + "x-ms-test-header": "bar" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread alias with more than 5 params", async () => { + const result = await client + .path("/parameters/spread/alias/multiple-parameters/{id}", "1") + .put({ + body: { + requiredString: "foo", + optionalInt: 1, + requiredIntList: [1, 2], + optionalStringList: ["foo", "bar"] + }, + headers: { + "x-ms-test-header": "bar" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread alias with inner-model-parameter", async () => { + const result = await client + .path("/parameters/spread/alias/inner-model-parameter/{id}", "1") + .post({ + body: { name: "foo" }, + headers: { + "x-ms-test-header": "bar" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should spread alias with inner-alias-parameter", async () => { + const result = await client + .path("/parameters/spread/alias/inner-alias-parameter/{id}", "1") + .post({ + body: { name: "foo", age: 1 }, + headers: { + "x-ms-test-header": "bar" + } + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/typespec/media-types/client.tsp b/packages/typespec-ts/test/azureIntegration/typespec/media-types/client.tsp new file mode 100644 index 0000000000..43607bc17d --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/media-types/client.tsp @@ -0,0 +1,63 @@ +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/rest"; +import "@typespec/http"; +import "@typespec/versioning"; +import "./main.tsp"; +import "./routes.tsp"; + +using Azure.ClientGenerator.Core; +using TypeSpec.Rest; +using TypeSpec.Http; + +namespace TypeScript.Test.MediaTypes; + +@client({ + name: "MediaTypesClient", + service: TypeScript.Test.MediaTypes, +}) +interface MediaTypesClient { + /** + * Multiple content-type by union + */ + getByUnion is MediaTypesOperations.getByUnionOnly; + + /** + * Multiple content-type by shared routes + */ + getBySharedRouteForString is MediaTypesOperations.getBySharedRouteForString; + getBySharedRouteForModel is MediaTypesOperations.getBySharedRouteForModel; + getBySharedRouteForBytes is MediaTypesOperations.getBySharedRouteForBytes; + + /** + * Multiple content-type by overload + */ + getByOverload is MediaTypesOperations.getByOverloadParent; + + @overload(MediaTypesClient.getByOverload) + getByOverloadString( + @body + @doc("Input parameter.") + input: string, + @header contentType: "text/plain" + ): string; + + @overload(MediaTypesClient.getByOverload) + getByOverloadForModel( + @body + @doc("Input parameter.") + input: SourcePath, + @header contentType: "application/json" + ): string; + + @overload(MediaTypesClient.getByOverload) + getByOverloadForBytes( + @body + @doc("Input parameter.") + input: bytes, + @header contentType: + | "application/pdf" + | "image/jpeg" + | "image/png" + | "image/tiff" + ): string; +} diff --git a/packages/typespec-ts/test/azureIntegration/typespec/media-types/main.tsp b/packages/typespec-ts/test/azureIntegration/typespec/media-types/main.tsp new file mode 100644 index 0000000000..9cf8d525fc --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/media-types/main.tsp @@ -0,0 +1,18 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +@service({ + title: "MediaTypes", +}) +@server( + "{$host}", + "Play with produces/consumes and media-types in general.", + { + $host: string, + } +) +@doc("Play with produces/consumes and media-types in general.") +namespace TypeScript.Test.MediaTypes; diff --git a/packages/typespec-ts/test/azureIntegration/typespec/media-types/routes.tsp b/packages/typespec-ts/test/azureIntegration/typespec/media-types/routes.tsp new file mode 100644 index 0000000000..b4a5c2c8d5 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/media-types/routes.tsp @@ -0,0 +1,94 @@ +import "@typespec/rest"; + +using TypeSpec.Http; + +namespace TypeScript.Test.MediaTypes; + +@doc("Uri or local path to source data.") +model SourcePath { + @minLength(0) + @maxLength(2048) + @doc("File source path.") + source: string; +} + +@route("/mediatypes") +interface MediaTypesOperations { + /** + * Union maps union + */ + @doc("Union of types map union of content types.") + @route("/union") + @post + getByUnionOnly( + @body + @doc("Input parameter.") + input: SourcePath | bytes | string, + @header contentType: + | "application/pdf" + | "application/json" + | "image/jpeg" + | "image/png" + | "image/tiff" + | "text/plain" + ): string; + + /** + * Shared route + */ + @doc("Using shared route to express the mapping info - string.") + @route("/shared-route") + @sharedRoute + @post + getBySharedRouteForString( + @body + @doc("Input parameter.") + input: string, + @header contentType: "text/plain" + ): string; + + @doc("Using shared route to express the mapping info - model.") + @route("/shared-route") + @sharedRoute + @post + getBySharedRouteForModel( + @body + @doc("Input parameter.") + input: SourcePath, + @header contentType: "application/json" + ): string; + + @doc("Using shared route to express the mapping info - bytes.") + @route("/shared-route") + @sharedRoute + @post + getBySharedRouteForBytes( + @body + @doc("Input parameter.") + input: bytes, + @header contentType: + | "application/pdf" + | "image/jpeg" + | "image/png" + | "image/tiff" + ): string; + + /** + * Overload + */ + @doc("Union of types map union of content types. Then use @overload to detailed mapping.") + @route("/overload") + @post + getByOverloadParent( + @body + @doc("Input parameter.") + input: SourcePath | bytes | string, + @header contentType: + | "application/pdf" + | "application/json" + | "image/jpeg" + | "image/png" + | "image/tiff" + | "text/plain" + ): string; +} diff --git a/packages/typespec-ts/test/azureIntegration/typespec/overload/client.tsp b/packages/typespec-ts/test/azureIntegration/typespec/overload/client.tsp new file mode 100644 index 0000000000..824b50c3a9 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/overload/client.tsp @@ -0,0 +1,63 @@ +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/rest"; +import "@typespec/http"; +import "@typespec/versioning"; +import "./main.tsp"; +import "./routes.tsp"; + +using Azure.ClientGenerator.Core; +using TypeSpec.Rest; +using TypeSpec.Http; + +namespace TypeScript.Test.Overalod; + +@client({ + name: "OverloadClient", + service: TypeScript.Test.Overalod, +}) +@route("/overload") +interface OverloadClient { + /** + * Overload with same routes + */ + getThing is OveralodOperations.getThing; + + @overload(OverloadClient.getThing) + getString(@body param: string): string; + + @overload(OverloadClient.getThing) + getNumber(@body param: int32): int32; + + /** + * Overload with different routes + */ + + upload is OveralodOperations.upload; + + @overload(OverloadClient.upload) + @route("/toString") + uploadString(@body data: string, @header contentType: "text/plain"): void; + + @overload(OverloadClient.upload) + uploadBytes( + @body + data: bytes, + @header contentType: "application/octet-stream" + ): void; + + /** + * Overloads with different actions + */ + + process is OveralodOperations.process; + + @overload(OverloadClient.process) + @post + processString(data: string, @header contentType: "text/plain"): void; + + @overload(OverloadClient.process) + processBytes( + data: bytes, + @header contentType: "application/octet-stream" + ): void; +} diff --git a/packages/typespec-ts/test/azureIntegration/typespec/overload/main.tsp b/packages/typespec-ts/test/azureIntegration/typespec/overload/main.tsp new file mode 100644 index 0000000000..e684e10f47 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/overload/main.tsp @@ -0,0 +1,18 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +@service({ + title: "OverloadTest", +}) +@server( + "{$host}", + "Play with overload cases.", + { + $host: string, + } +) +@doc("Play with overload cases.") +namespace TypeScript.Test.Overalod; diff --git a/packages/typespec-ts/test/azureIntegration/typespec/overload/routes.tsp b/packages/typespec-ts/test/azureIntegration/typespec/overload/routes.tsp new file mode 100644 index 0000000000..00b7be0e33 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/overload/routes.tsp @@ -0,0 +1,40 @@ +import "@typespec/rest"; + +using TypeSpec.Http; + +namespace TypeScript.Test.Overalod; + +@doc("Resource to process.") +model Resource { + id: string; +} + +interface OveralodOperations { + /** + * Overload with same routes + */ + @route("/get") + getThing(@body param: string | int32): string | int32; + + /** + * Overload with different routes + */ + @route("/changed-routes") + @put + upload( + @body + data: string | bytes, + @header contentType: "text/plain" | "application/octet-stream" + ): void; + + /** + * Overloads with different actions + */ + + @route("/changed-actions") + @put + process( + data: string | bytes, + @header contentType: "text/plain" | "application/octet-stream" + ): void; +} diff --git a/packages/typespec-ts/test/azureIntegration/typespec/shared-route/main.tsp b/packages/typespec-ts/test/azureIntegration/typespec/shared-route/main.tsp new file mode 100644 index 0000000000..f2d131d245 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/shared-route/main.tsp @@ -0,0 +1,18 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +@service({ + title: "SharedRouteTest", +}) +@server( + "{$host}", + "Play with shared route cases.", + { + $host: string, + } +) +@doc("Play with shared route cases.") +namespace TypeScript.Test.SharedRoute; diff --git a/packages/typespec-ts/test/azureIntegration/typespec/shared-route/routes.tsp b/packages/typespec-ts/test/azureIntegration/typespec/shared-route/routes.tsp new file mode 100644 index 0000000000..759dd6ceb2 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/shared-route/routes.tsp @@ -0,0 +1,80 @@ +import "@typespec/rest"; + +using TypeSpec.Http; + +namespace TypeScript.Test.SharedRoute; + +@doc("Resource to process.") +model Resource { + id: string; +} + +@error +model Error { + code: int32; + message: string; +} + +model NoContentResponse { + @statusCode statusCode: 202; + @body body: Resource; +} + +model OkResponse { + @statusCode statusCode: 200; + @body body: Resource[]; +} + + +@route("/sharedroute") +interface SharedRouteOperations { + + /** + * different query & header parameters + */ + + @sharedRoute + @route("/query") + listBySubscription(...Resource, @header filter: "subscription"): NoContentResponse | Error; + + + @sharedRoute + @route("/query") + listByResourceGroup(...Resource, @query filter: "resourceGroup"): OkResponse | Error; + + + /** + * different request bodies + */ + + @sharedRoute + @route("/request-body") + updateInt(@body a: int32, @query options: string): void; + + @sharedRoute + @route("/request-body") + updateString(@body b: string, @query options: string): void; + + /** + * different responses + */ + + @sharedRoute + @route("/response-body") + returnsInt(...Resource, @query options: string): int32; + + @sharedRoute + @route("/response-body") + returnsString(...Resource, @query options: string): string; + + /** + * different request and response bodies + */ + @sharedRoute + @route("/request-response") + processInt(@body body: int32, @query options: string): int32; + + @sharedRoute + @route("/request-response") + processString(@body body: string, @query options: string): string; +} diff --git a/packages/typespec-ts/test/azureIntegration/typespec/union-body/main.tsp b/packages/typespec-ts/test/azureIntegration/typespec/union-body/main.tsp new file mode 100644 index 0000000000..84638f54a8 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/typespec/union-body/main.tsp @@ -0,0 +1,36 @@ +import "@typespec/rest"; + +using TypeSpec.Http; + +// PAYMENT_METHODS +enum PAYMENT_METHODS { + CREDIT_CARD: "01", +} + +model CommonRegistrationRequest { + payMethod: PAYMENT_METHODS, +} + +model RequestRegisterCC extends CommonRegistrationRequest { + payMethod: PAYMENT_METHODS.CREDIT_CARD, +} + +model RequestRegisterVA { + prop: string; +} + +model ReturnResponse { + @body body: RequestRegisterCC | RequestRegisterVA +} + +@service({}) +@route("/") +namespace NicepayPlatform { + @post + @route("/request-union-body") + op requestUnionBody(@body request: RequestRegisterCC | RequestRegisterVA): {@body _ : {};}; + + @get + @route("/response-union-body") + op responseUnionBody(): ReturnResponse; +} diff --git a/packages/typespec-ts/test/azureIntegration/unionBody.spec.ts b/packages/typespec-ts/test/azureIntegration/unionBody.spec.ts new file mode 100644 index 0000000000..9b36fca2c6 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/unionBody.spec.ts @@ -0,0 +1,27 @@ +import UnionBodyClientFactory, { + UnionBodyClient +} from "./generated/union-body/src/index.js"; +import { assert } from "chai"; +describe("UnionBodyClient Rest Client", () => { + let client: UnionBodyClient; + + beforeEach(() => { + client = UnionBodyClientFactory("http://localhost:3000", { + allowInsecureConnection: true + }); + }); + + it("should have no compile error for request body", async () => { + const result = await client.path("/request-union-body").post({ + body: { + prop: "test" + } + }); + assert.strictEqual(result.status, "404"); + }); + + it("should have no compile error for response body", async () => { + const result = await client.path("/response-union-body").get(); + assert.strictEqual(result.status, "404"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/unions.spec.ts b/packages/typespec-ts/test/azureIntegration/unions.spec.ts new file mode 100644 index 0000000000..3bd1e0c31a --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/unions.spec.ts @@ -0,0 +1,212 @@ +import UnionsClientFactory, { + CatOutput, + DogOutput, + UnionsClient +} from "./generated/type/union/src/index.js"; +import { assert } from "chai"; +describe("UnionsClient Rest Client", () => { + let client: UnionsClient; + + function isCatOutput( + pet: CatOutput | DogOutput | "a" | number | boolean + ): pet is CatOutput { + return (pet as CatOutput)?.name !== undefined; + } + + beforeEach(() => { + client = UnionsClientFactory({ allowInsecureConnection: true }); + }); + + it("should get strings only union", async () => { + const result = await client.path("/type/union/strings-only").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "b"); + }); + + it("should post strings only union", async () => { + const result = await client.path("/type/union/strings-only").post({ + body: { + prop: "b" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get strings extensible union", async () => { + const result = await client.path("/type/union/string-extensible").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "custom"); + }); + + it("should post strings extensible union", async () => { + const result = await client.path("/type/union/string-extensible").post({ + body: { + prop: "custom" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get strings extensible named union", async () => { + const result = await client + .path("/type/union/string-extensible-named") + .get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "custom"); + }); + + it("should post strings extensible named union", async () => { + const result = await client + .path("/type/union/string-extensible-named") + .post({ + body: { + prop: "custom" + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get ints only union", async () => { + const result = await client.path("/type/union/ints-only").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, 2); + }); + + it("should post ints only union", async () => { + const result = await client.path("/type/union/ints-only").post({ + body: { + prop: 2 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get floats only union", async () => { + const result = await client.path("/type/union/floats-only").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, 2.2); + }); + + it("should post floats only union", async () => { + const result = await client.path("/type/union/floats-only").post({ + body: { + prop: 2.2 + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get models only union", async () => { + const result = await client.path("/type/union/models-only").get(); + assert.strictEqual(result.status, "200"); + if (isCatOutput(result.body.prop)) { + assert.strictEqual(result.body.prop.name, "test"); + } + }); + + it("should post models only union", async () => { + const result = await client.path("/type/union/models-only").post({ + body: { + prop: { name: "test" } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get enums only union", async () => { + const result = await client.path("/type/union/enums-only").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop.lr, "right"); + assert.strictEqual(result.body.prop.ud, "up"); + }); + + it("should post enums only union", async () => { + const result = await client.path("/type/union/enums-only").post({ + body: { + prop: { + lr: "right", + ud: "up" + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get string and array union", async () => { + const result = await client.path("/type/union/string-and-array").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop.string, "test"); + assert.strictEqual(result.body.prop.array[0], "test1"); + assert.strictEqual(result.body.prop.array[1], "test2"); + }); + + it("should post string and array union", async () => { + const result = await client.path("/type/union/string-and-array").post({ + body: { + prop: { + string: "test", + array: ["test1", "test2"] + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get mixed literals union", async () => { + const result = await client.path("/type/union/mixed-literals").get(); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop.stringLiteral, "a"); + assert.strictEqual(result.body.prop.intLiteral, 2); + assert.strictEqual(result.body.prop.floatLiteral, 3.3); + assert.strictEqual(result.body.prop.booleanLiteral, true); + }); + + it("should post mixed literals union", async () => { + const result = await client.path("/type/union/mixed-literals").post({ + body: { + prop: { + stringLiteral: "a", + intLiteral: 2, + floatLiteral: 3.3, + booleanLiteral: true + } + } + }); + assert.strictEqual(result.status, "204"); + }); + + it("should get mixed types union", async () => { + const result = await client.path("/type/union/mixed-types").get(); + assert.strictEqual(result.status, "200"); + if (isCatOutput(result.body.prop.model)) { + assert.strictEqual(result.body.prop.model.name, "test"); + assert.strictEqual(result.body.prop.literal, "a"); + assert.strictEqual(result.body.prop.int, 2); + assert.strictEqual(result.body.prop.boolean, true); + } + }); + + it("should post mixed types union", async () => { + const result = await client.path("/type/union/mixed-types").post({ + body: { + prop: { + model: { + name: "test" + }, + literal: "a", + int: 2, + boolean: true, + array: [ + { + name: "test" + }, + "a", + 2, + true + ] + } + } + }); + assert.strictEqual(result.status, "204"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/versioningAdded.spec.ts b/packages/typespec-ts/test/azureIntegration/versioningAdded.spec.ts new file mode 100644 index 0000000000..f7e535f870 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/versioningAdded.spec.ts @@ -0,0 +1,58 @@ +import VersioningAddedClientFactory, { + VersioningAddedClient +} from "./generated/versioning/added/src/index.js"; +import { assert } from "chai"; +describe("VersioningAdded Rest Client", () => { + let client: VersioningAddedClient; + + beforeEach(() => { + client = VersioningAddedClientFactory("http://localhost:3000", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning added v1", async () => { + const result = await client.path("/v1").post({ + body: { + prop: "foo", + enumProp: "enumMemberV2", + unionProp: 10 + }, + headers: { + "header-v2": "bar" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "foo"); + assert.strictEqual(result.body.enumProp, "enumMemberV2"); + assert.strictEqual(result.body.unionProp, 10); + }); + + it("versioning added interface v2", async () => { + const result = await client.path("/interface-v2/v2").post({ + body: { + prop: "foo", + enumProp: "enumMember", + unionProp: "bar" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "foo"); + assert.strictEqual(result.body.enumProp, "enumMember"); + assert.strictEqual(result.body.unionProp, "bar"); + }); + + it("versioning added v2", async () => { + const result = await client.path("/v2").post({ + body: { + prop: "foo", + enumProp: "enumMember", + unionProp: "bar" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "foo"); + assert.strictEqual(result.body.enumProp, "enumMember"); + assert.strictEqual(result.body.unionProp, "bar"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/versioningMadeOptional.spec.ts b/packages/typespec-ts/test/azureIntegration/versioningMadeOptional.spec.ts new file mode 100644 index 0000000000..eebfe4b654 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/versioningMadeOptional.spec.ts @@ -0,0 +1,27 @@ +import VersioningMadeOptionalClientFactory, { + VersioningMadeOptionalClient +} from "./generated/versioning/madeOptional/src/index.js"; +import { assert } from "chai"; +describe("VersioningMadeOptional Rest Client", () => { + let client: VersioningMadeOptionalClient; + + beforeEach(() => { + client = VersioningMadeOptionalClientFactory( + "http://localhost:3000", + "v2", + { + allowInsecureConnection: true + } + ); + }); + + it("versioning madeOptional test", async () => { + const result = await client.path("/test").post({ + body: { + prop: "foo" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "foo"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/versioningRemoved.spec.ts b/packages/typespec-ts/test/azureIntegration/versioningRemoved.spec.ts new file mode 100644 index 0000000000..501adbe146 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/versioningRemoved.spec.ts @@ -0,0 +1,27 @@ +// import VersioningRemovedClientFactory, { +// VersioningRemovedClient +// } from "./generated/versioning/removed/src/index.js"; +// import { assert } from "chai"; +// describe("VersioningRemoved Rest Client", () => { +// let client: VersioningRemovedClient; + +// beforeEach(() => { +// client = VersioningRemovedClientFactory("http://localhost:3000", "v2", { +// allowInsecureConnection: true +// }); +// }); + +// it("versioning removed test", async () => { +// const result = await client.path("/v2").post({ +// body: { +// prop: "foo", +// enumProp: "enumMemberV2", +// unionProp: "bar" +// } +// }); +// assert.strictEqual(result.status, "200"); +// assert.strictEqual(result.body.prop, "foo"); +// assert.strictEqual(result.body.enumProp, "enumMemberV2"); +// assert.strictEqual(result.body.unionProp, "bar"); +// }); +// }); diff --git a/packages/typespec-ts/test/azureIntegration/versioningRenamedFrom.spec.ts b/packages/typespec-ts/test/azureIntegration/versioningRenamedFrom.spec.ts new file mode 100644 index 0000000000..292a401e77 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/versioningRenamedFrom.spec.ts @@ -0,0 +1,44 @@ +import VersioningRenamedFromClientFactory, { + VersioningRenamedFromClient +} from "./generated/versioning/renamedFrom/src/index.js"; +import { assert } from "chai"; +describe("VersioningRenamedFrom Rest Client", () => { + let client: VersioningRenamedFromClient; + + beforeEach(() => { + client = VersioningRenamedFromClientFactory("http://localhost:3000", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning RenamedFrom ewOp test", async () => { + const result = await client.path("/test").post({ + body: { + newProp: "foo", + enumProp: "newEnumMember", + unionProp: 10 + }, + queryParameters: { + newQuery: "bar" + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.newProp, "foo"); + assert.strictEqual(result.body.enumProp, "newEnumMember"); + assert.strictEqual(result.body.unionProp, 10); + }); + + it("versioning renamedFrom newInterface test", async () => { + const result = await client.path("/interface/test").post({ + body: { + newProp: "foo", + enumProp: "newEnumMember", + unionProp: 10 + } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.newProp, "foo"); + assert.strictEqual(result.body.enumProp, "newEnumMember"); + assert.strictEqual(result.body.unionProp, 10); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/versioningReturnTypeChangedFrom.spec.ts b/packages/typespec-ts/test/azureIntegration/versioningReturnTypeChangedFrom.spec.ts new file mode 100644 index 0000000000..564b2c3cba --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/versioningReturnTypeChangedFrom.spec.ts @@ -0,0 +1,26 @@ +import VersioningReturnTypeChangedFromClientFactory, { + VersioningReturnTypeChangedFromClient +} from "./generated/versioning/returnTypeChangedFrom/src/index.js"; +import { assert } from "chai"; +describe("VersioningReturnTypeChangedFrom Rest Client", () => { + let client: VersioningReturnTypeChangedFromClient; + + beforeEach(() => { + client = VersioningReturnTypeChangedFromClientFactory( + "http://localhost:3000", + "v2", + { + allowInsecureConnection: true + } + ); + }); + + it("versioning returnTypeChangedFrom test", async () => { + const result = await client.path("/test").post({ + body: "test", + contentType: "text/plain" + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body, "test"); + }); +}); diff --git a/packages/typespec-ts/test/azureIntegration/versioningTypeChangedFrom.spec.ts b/packages/typespec-ts/test/azureIntegration/versioningTypeChangedFrom.spec.ts new file mode 100644 index 0000000000..766fdcc108 --- /dev/null +++ b/packages/typespec-ts/test/azureIntegration/versioningTypeChangedFrom.spec.ts @@ -0,0 +1,27 @@ +import VersioningTypeChangedFromClientFactory, { + VersioningTypeChangedFromClient +} from "./generated/versioning/typeChangedFrom/src/index.js"; +import { assert } from "chai"; +describe("VersioningTypeChangedFrom Rest Client", () => { + let client: VersioningTypeChangedFromClient; + + beforeEach(() => { + client = VersioningTypeChangedFromClientFactory( + "http://localhost:3000", + "v2", + { + allowInsecureConnection: true + } + ); + }); + + it("versioning typeChangedFrom test", async () => { + const result = await client.path("/test").post({ + body: { prop: "foo", changedProp: "bar" }, + queryParameters: { param: "baz" } + }); + assert.strictEqual(result.status, "200"); + assert.strictEqual(result.body.prop, "foo"); + assert.strictEqual(result.body.changedProp, "bar"); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/arrayItemTypes.spec.ts b/packages/typespec-ts/test/azureModularIntegration/arrayItemTypes.spec.ts new file mode 100644 index 0000000000..7c8b829627 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/arrayItemTypes.spec.ts @@ -0,0 +1,184 @@ +import { assert } from "chai"; +import { ArrayClient } from "./generated/type/array/src/index.js"; + +interface TypeDetail { + type: string; + defaultValue: any; + convertedToFn?: (_: any) => any; +} + +const testedTypes: TypeDetail[] = [ + { + type: "int32", + defaultValue: [1, 2] + }, + { + type: "int64", + defaultValue: [Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER] + }, + { + type: "boolean", + defaultValue: [true, false] + }, + { + type: "string", + defaultValue: ["hello", ""] + }, + { + type: "float32", + defaultValue: [43.125] + }, + { + type: "datetime", + defaultValue: [new Date("2022-08-26T18:38:00Z")] + }, + { + type: "duration", + defaultValue: ["P123DT22H14M12.011S"] + }, + { + type: "unknown", + defaultValue: [1, "hello", null] + }, + // { + // type: "model", + // defaultValue: [{ property: "hello" }, { property: "world" }] + // }, + { + type: "nullable-float", + defaultValue: [1.25, null, 3.0] + }, + { + type: "nullable-int32", + defaultValue: [1, null, 3] + }, + { + type: "nullable-string", + defaultValue: ["hello", null, "world"] + }, + { + type: "nullable-boolean", + defaultValue: [true, null, false] + } + // { + // type: "nullable-model", + // defaultValue: [{ property: "hello" }, null, { property: "world" }] + // } +]; +describe("Array Item-Types Client", () => { + let client: ArrayClient; + + beforeEach(() => { + client = new ArrayClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + for (let item of testedTypes) { + it(`should get ${item.type} value`, async () => { + let result: any; + switch (item.type) { + case "int32": + result = await client.int32Value.get(); + break; + case "int64": + result = await client.int64Value.get(); + break; + case "boolean": + result = await client.booleanValue.get(); + break; + case "string": + result = await client.stringValue.get(); + break; + case "float32": + result = await client.float32Value.get(); + break; + case "datetime": + result = await client.datetimeValue.get(); + break; + case "duration": + result = await client.durationValue.get(); + break; + case "unknown": + result = await client.unknownValue.get(); + break; + // case "model": + // result = await client.modelValue.get(); + // break; + case "nullable-float": + result = await client.nullableFloatValue.get(); + break; + case "nullable-int32": + result = await client.nullableInt32Value.get(); + break; + case "nullable-string": + result = await client.nullableStringValue.get(); + break; + case "nullable-boolean": + result = await client.nullableBooleanValue.get(); + break; + // case "nullable-model": + // result = await client.nullableModelValue.get(); + // break; + default: + break; + } + assert.deepEqual(result, item.defaultValue); + }); + } + for (let item of testedTypes) { + it(`should put ${item.type} vaule`, async () => { + let result: any; + switch (item.type) { + case "int32": + result = await client.int32Value.put(item.defaultValue); + break; + case "int64": + result = await client.int64Value.put(item.defaultValue); + break; + case "boolean": + result = await client.booleanValue.put(item.defaultValue); + break; + case "string": + result = await client.stringValue.put(item.defaultValue); + break; + case "float32": + result = await client.float32Value.put(item.defaultValue); + break; + case "datetime": + result = await client.datetimeValue.put(item.defaultValue); + break; + case "duration": + result = await client.durationValue.put(item.defaultValue); + break; + case "unknown": + result = await client.unknownValue.put(item.defaultValue); + break; + case "model": + result = await client.modelValue.put(item.defaultValue); + break; + case "nullable-float": + result = await client.nullableFloatValue.put(item.defaultValue); + break; + case "nullable-boolean": + result = await client.nullableBooleanValue.put(item.defaultValue); + break; + case "nullable-int32": + result = await client.nullableInt32Value.put(item.defaultValue); + break; + case "nullable-string": + result = await client.nullableStringValue.put(item.defaultValue); + break; + case "nullable-model": + result = await client.nullableModelValue.put(item.defaultValue); + break; + default: + break; + } + assert.isUndefined(result); + }); + } +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/authApiKey.spec.ts b/packages/typespec-ts/test/azureModularIntegration/authApiKey.spec.ts new file mode 100644 index 0000000000..56458e20c2 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/authApiKey.spec.ts @@ -0,0 +1,42 @@ +import { ApiKeyClient } from "./generated/authentication/api-key/src/index.js"; +import { assert } from "chai"; + +describe("ApiKeyClient Classical Client", () => { + let validKeyClient: ApiKeyClient; + let invalidKeyClient: ApiKeyClient; + + beforeEach(() => { + validKeyClient = new ApiKeyClient( + { + key: "valid-key" + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + invalidKeyClient = new ApiKeyClient( + { + key: "invalid-key" + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + }); + + it("should not throw exception if apiKey is valid", async () => { + const result = await validKeyClient.valid(); + assert.strictEqual(result, undefined); + }); + + it("should throw exception if the apiKey is invalid", async () => { + try { + await invalidKeyClient.invalid(); + assert.fail("Expected an exception to be thrown."); + } catch (err: any) { + assert.strictEqual(err.message, "Unexpected status code: 403"); + } + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/authHttpCustom.spec.ts b/packages/typespec-ts/test/azureModularIntegration/authHttpCustom.spec.ts new file mode 100644 index 0000000000..5c5d70584e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/authHttpCustom.spec.ts @@ -0,0 +1,42 @@ +import { CustomClient } from "./generated/authentication/http/custom/src/index.js"; +import { assert } from "chai"; + +describe("CustomClient Classical Client", () => { + let validKeyClient: CustomClient; + let invalidKeyClient: CustomClient; + + beforeEach(() => { + validKeyClient = new CustomClient( + { + key: "valid-key" + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + invalidKeyClient = new CustomClient( + { + key: "invalid-key" + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + }); + + it("should not throw exception if apiKey is valid", async () => { + const result = await validKeyClient.valid(); + assert.strictEqual(result, undefined); + }); + + it("should throw exception if the apiKey is invalid", async () => { + try { + await invalidKeyClient.invalid(); + assert.fail("Expected an exception to be thrown."); + } catch (err: any) { + assert.strictEqual(err.message, "Unexpected status code: 403"); + } + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/authOauth2.spec.ts b/packages/typespec-ts/test/azureModularIntegration/authOauth2.spec.ts new file mode 100644 index 0000000000..f485eaab02 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/authOauth2.spec.ts @@ -0,0 +1,60 @@ +import { + bearerTokenAuthenticationPolicyName, + PipelinePolicy +} from "@azure/core-rest-pipeline"; +import { + createOAuth2, + invalid, + OAuth2Context, + valid +} from "./generated/authentication/oauth2/src/api/index.js"; +import { assert } from "chai"; +import { customBearerTokenAuthenticationPolicy } from "../util/customBearerTokenTestingPolicy.js"; + +describe("OAuth2Context in API Layer", () => { + let context: OAuth2Context; + let policy: PipelinePolicy; + const defaultScope = "https://security.microsoft.com/.default"; + + beforeEach(() => { + context = createOAuth2( + { + getToken: async () => Promise.resolve(null) + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + + policy = customBearerTokenAuthenticationPolicy({ + scopes: defaultScope, + credential: { + getToken: async () => { + return { + token: defaultScope, + expiresOnTimestamp: Date.now() + }; + } + } + }); + context.pipeline.removePolicy({ + name: bearerTokenAuthenticationPolicyName + }); + context.pipeline.addPolicy(policy); + }); + + it("should not throw exception if token is valid", async () => { + const result = await valid(context); + assert.strictEqual(result, undefined); + }); + + it("should throw exception if the token is invalid", async () => { + try { + await invalid(context); + assert.fail("Expected an exception to be thrown."); + } catch (err: any) { + assert.strictEqual(err.message, "Unexpected status code: 403"); + } + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/authUnion.spec.ts b/packages/typespec-ts/test/azureModularIntegration/authUnion.spec.ts new file mode 100644 index 0000000000..61d34386cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/authUnion.spec.ts @@ -0,0 +1,123 @@ +import { + bearerTokenAuthenticationPolicyName, + PipelinePolicy +} from "@azure/core-rest-pipeline"; +import { + createUnion, + UnionContext, + validKey, + validToken +} from "./generated/authentication/union/src/api/index.js"; +import { UnionClient } from "./generated/authentication/union/src/index.js"; +import { assert } from "chai"; +import { customBearerTokenAuthenticationPolicy } from "../util/customBearerTokenTestingPolicy.js"; + +describe("UnionContext in API Layer", () => { + let context: UnionContext; + let policy: PipelinePolicy; + const defaultScope = "https://security.microsoft.com/.default"; + + function prepareToken() { + context = createUnion( + { + getToken: async () => Promise.resolve(null) + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + + policy = customBearerTokenAuthenticationPolicy({ + scopes: defaultScope, + credential: { + getToken: async () => { + return { + token: defaultScope, + expiresOnTimestamp: Date.now() + }; + } + } + }); + context.pipeline.removePolicy({ + name: bearerTokenAuthenticationPolicyName + }); + context.pipeline.addPolicy(policy); + } + + function prepareKey() { + context = createUnion( + { + key: "valid-key" + }, + { allowInsecureConnection: true, endpoint: "http://localhost:3002" } + ); + } + + it("should not throw exception if apiKey is valid", async () => { + prepareKey(); + const result = await validKey(context); + assert.strictEqual(result, undefined); + }); + + it("should throw exception if the token is valid", async () => { + prepareToken(); + const result = await validToken(context); + assert.strictEqual(result, undefined); + }); +}); + +describe("UnionClient in classical client", () => { + let client: UnionClient; + let policy: PipelinePolicy; + const defaultScope = "https://security.microsoft.com/.default"; + + function prepareToken() { + client = new UnionClient( + { + getToken: async () => Promise.resolve(null) + }, + { + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + } + ); + + policy = customBearerTokenAuthenticationPolicy({ + scopes: defaultScope, + credential: { + getToken: async () => { + return { + token: defaultScope, + expiresOnTimestamp: Date.now() + }; + } + } + }); + client.pipeline.removePolicy({ + name: bearerTokenAuthenticationPolicyName + }); + client.pipeline.addPolicy(policy); + } + + function prepareKey() { + client = new UnionClient( + { + key: "valid-key" + }, + { allowInsecureConnection: true, endpoint: "http://localhost:3002" } + ); + } + + it("should not throw exception if apiKey is valid", async () => { + prepareKey(); + const result = await client.validKey(); + assert.strictEqual(result, undefined); + }); + + it("should throw exception if the token is valid", async () => { + prepareToken(); + const result = await client.validToken(); + assert.strictEqual(result, undefined); + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/azureArmManagedIdentity.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureArmManagedIdentity.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureArmManagedIdentity.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureArmManagedIdentity.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureArmResources.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureArmResources.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureArmResources.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureArmResources.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreAccess.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureClientGeneratorCoreAccess.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreAccess.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureClientGeneratorCoreAccess.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreUsage.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureClientGeneratorCoreUsage.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureClientGeneratorCoreUsage.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureClientGeneratorCoreUsage.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureCore.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureCore.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureCore.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureCore.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureCoreModel.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureCoreModel.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureCoreModel.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureCoreModel.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureCorePage.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureCorePage.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureCorePage.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureCorePage.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureCoreTraits.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureCoreTraits.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureCoreTraits.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureCoreTraits.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/azureExampleClient.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azureExampleClient.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azureExampleClient.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azureExampleClient.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/azurePayloadPageable.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azurePayloadPageable.spec.ts new file mode 100644 index 0000000000..d3e845be8a --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/azurePayloadPageable.spec.ts @@ -0,0 +1,88 @@ +import { + PageableClient, + User +} from "./generated/azure/payload/pageable/src/index.js"; +import { assert } from "chai"; + +describe("Azure PageableClient Classical Client", () => { + let client: PageableClient; + + beforeEach(() => { + client = new PageableClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should throw exceptions if no maxpagesize set", async () => { + const iter = client.list(); + const items = []; + try { + for await (const user of iter) { + items.push(user); + } + assert.fail("Should throw exception"); + } catch (err: any) { + assert.isNotNull(err); + assert.strictEqual( + err.message, + "Pagination failed with unexpected statusCode 400" + ); + } + }); + + it("should list all users if maxpagesize=3", async () => { + const iter = client.list({ + maxpagesize: 3 + }); + const items = []; + for await (const user of iter) { + items.push(user); + } + assert.strictEqual(items.length, 4); + }); + + it("should list all users byPage", async () => { + const iter = client.list({ + maxpagesize: 3 + }); + const items: User[] = []; + for await (const user of iter.byPage()) { + items.push(...user); + } + assert.strictEqual(items.length, 4); + }); + + it("should list left users byPage if continuationToken is set", async () => { + const iter = client.list({ + maxpagesize: 3 + }); + /** + * two pages: + * - 1st page has 3 items + * - 2nd page has 1 item + */ + const firstPage = await iter.byPage().next(); + assert.strictEqual(firstPage.done, false); + assert.strictEqual(firstPage.value.length, 3); + // initiate another iterator starting with 2nd page + const continuationToken = firstPage.value.continuationToken; + assert.strictEqual( + continuationToken, + "http://localhost:3002/azure/payload/pageable?skipToken=name-user7&maxpagesize=3" + ); + const items: User[] = []; + for await (const pagedUsers of iter.byPage({ continuationToken })) { + items.push(...pagedUsers); + } + assert.strictEqual(items.length, 1); + }); + + it("maxPageSize param should be ignored", async () => { + const pagedIter = client + .list({ maxpagesize: 3 }) + .byPage({ maxPageSize: 10 } as any); + const items: User[] = (await pagedIter.next()).value; + assert.strictEqual(items.length, 3); + }); +}); \ No newline at end of file diff --git a/packages/typespec-ts/test/modularIntegration/azurecorescalar.spec.ts b/packages/typespec-ts/test/azureModularIntegration/azurecorescalar.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/azurecorescalar.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/azurecorescalar.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/basicParameters.spec.ts b/packages/typespec-ts/test/azureModularIntegration/basicParameters.spec.ts new file mode 100644 index 0000000000..77858d6036 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/basicParameters.spec.ts @@ -0,0 +1,22 @@ +import { BasicClient } from "./generated/parameters/basic/src/index.js"; +import { assert } from "chai"; +describe("BasicClient Client", () => { + let client: BasicClient; + + beforeEach(() => { + client = new BasicClient({ + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + }); + }); + + it("basic parameters explicit-body simple", async () => { + const result = await client.explicitBody.simple({ name: "foo" }); + assert.isUndefined(result); + }); + + it("basic parameters implicit-body simple", async () => { + const result = await client.implicitBody.simple("foo"); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/bodyOptionality.spec.ts b/packages/typespec-ts/test/azureModularIntegration/bodyOptionality.spec.ts new file mode 100644 index 0000000000..a68c276777 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/bodyOptionality.spec.ts @@ -0,0 +1,35 @@ +import { assert } from "chai"; +import { BodyOptionalityClient } from "./generated/parameters/body-optionality/src/index.js"; +describe("Body Optionality Client", () => { + let client: BodyOptionalityClient; + + beforeEach(() => { + client = new BodyOptionalityClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should support required-explicit body", async () => { + const result = await client.requiredExplicit({ name: "foo" }); + assert.isUndefined(result); + }); + + it("should support optional-explicit body", async () => { + const result = await client.optionalExplicit.set({ body: { name: "foo" } }); + assert.isUndefined(result); + }); + + it("should support optional-explicit omitted body", async () => { + const result = await client.optionalExplicit.omit(); + assert.isUndefined(result); + }); + + it("should support required-implicit body", async () => { + const result = await client.requiredImplicit("foo"); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts b/packages/typespec-ts/test/azureModularIntegration/clientNaming.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/clientNaming.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/clientNaming.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/clientStructureDefault.spec.ts b/packages/typespec-ts/test/azureModularIntegration/clientStructureDefault.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/clientStructureDefault.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/clientStructureDefault.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/clientStructureMultiClient.spec.ts b/packages/typespec-ts/test/azureModularIntegration/clientStructureMultiClient.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/clientStructureMultiClient.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/clientStructureMultiClient.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/clientStructureOperationGroup.spec.ts b/packages/typespec-ts/test/azureModularIntegration/clientStructureOperationGroup.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/clientStructureOperationGroup.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/clientStructureOperationGroup.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/clientStructureRenamed.spec.ts b/packages/typespec-ts/test/azureModularIntegration/clientStructureRenamed.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/clientStructureRenamed.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/clientStructureRenamed.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/clientStructureTwoGroup.spec.ts b/packages/typespec-ts/test/azureModularIntegration/clientStructureTwoGroup.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/clientStructureTwoGroup.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/clientStructureTwoGroup.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/collectionFormat.spec.ts b/packages/typespec-ts/test/azureModularIntegration/collectionFormat.spec.ts new file mode 100644 index 0000000000..a54f21a317 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/collectionFormat.spec.ts @@ -0,0 +1,47 @@ +import { CollectionFormatClient } from "./generated/parameters/collection-format/src/index.js"; +import { assert } from "chai"; + +describe("CollectionFormatClient Classical Client", () => { + let client: CollectionFormatClient; + + beforeEach(() => { + client = new CollectionFormatClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should send csv format in query", async () => { + const result = await client.query.csv(["blue", "red", "green"]); + assert.strictEqual(result, undefined); + }); + + it("should send multi format in query", async () => { + const result = await client.query.multi(["blue", "red", "green"], { + requestOptions: { + skipUrlEncoding: true + } + }); + assert.strictEqual(result, undefined); + }); + + it("should send pipes format in query", async () => { + const result = await client.query.pipes(["blue", "red", "green"]); + assert.strictEqual(result, undefined); + }); + + it("should send ssv format in query", async () => { + const result = await client.query.ssv(["blue", "red", "green"]); + assert.strictEqual(result, undefined); + }); + + it("should send tsv format in query", async () => { + const result = await client.query.tsv(["blue", "red", "green"]); + assert.strictEqual(result, undefined); + }); + + it("should send csv format in header", async () => { + const result = await client.header.csv(["blue", "red", "green"]); + assert.strictEqual(result, undefined); + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/customClientRequestId.spec.ts b/packages/typespec-ts/test/azureModularIntegration/customClientRequestId.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/customClientRequestId.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/customClientRequestId.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/dictionaryTypes.spec.ts b/packages/typespec-ts/test/azureModularIntegration/dictionaryTypes.spec.ts new file mode 100644 index 0000000000..666c9bf10a --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/dictionaryTypes.spec.ts @@ -0,0 +1,155 @@ +import { assert } from "chai"; +import { DictionaryClient } from "./generated/type/dictionary/src/index.js"; + +describe("DictionaryClient Modular Client", () => { + let client: DictionaryClient; + + beforeEach(() => { + client = new DictionaryClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get a dictionary of boolean", async () => { + const result = await client.booleanValue.get(); + assert.deepEqual(result, { k1: true, k2: false }); + }); + + it("should send a dictionary of boolean", async () => { + const result = await client.booleanValue.put({ k1: true, k2: false }); + assert.isUndefined(result); + }); + + it.skip("should get a dictionary of datetime", async () => { + const result = await client.datetimeValue.get(); + assert.equal(result["k1"]?.toUTCString(), "2022-08-26T18:38:00Z"); + }); + + it("should send a dictionary of datetime", async () => { + const result = await client.datetimeValue.put({ + k1: new Date("2022-08-26T18:38:00Z") + }); + assert.isUndefined(result); + }); + + it("should get a dictionary of durations", async () => { + const result = await client.durationValue.get(); + assert.deepEqual(result, { + k1: "P123DT22H14M12.011S" + }); + }); + + it("should send a dictionary of durations", async () => { + const result = await client.durationValue.put({ + k1: "P123DT22H14M12.011S" + }); + assert.isUndefined(result); + }); + + it("should get a dictionary of float", async () => { + const result = await client.float32Value.get(); + assert.deepEqual(result, { k1: 43.125 }); + }); + + it("should send a dictionary of float", async () => { + const result = await client.float32Value.put({ k1: 43.125 }); + assert.isUndefined(result); + }); + + it("should get a dictionary of integer", async () => { + const result = await client.int32Value.get(); + assert.deepEqual(result, { k1: 1, k2: 2 }); + }); + + it("should send a dictionary of integer", async () => { + const result = await client.int32Value.put({ k1: 1, k2: 2 }); + assert.isUndefined(result); + }); + + it("should get a dictionary of int64", async () => { + const maxSafeInteger = Math.pow(2, 53) - 1; + const minSafeInteger = -Math.pow(2, 53) + 1; + const result = await client.int64Value.get(); + assert.deepEqual(result, { k1: maxSafeInteger, k2: minSafeInteger }); + }); + + it("should send a dictionary of int64", async () => { + const maxSafeInteger = Math.pow(2, 53) - 1; + const minSafeInteger = -Math.pow(2, 53) + 1; + const result = await client.int64Value.put({ + k1: maxSafeInteger, + k2: minSafeInteger + }); + assert.isUndefined(result); + }); + + it("should get a dictionary of model", async () => { + const result = await client.modelValue.get(); + assert.deepEqual(result, { + k1: { + property: "hello", + children: undefined + }, + k2: { + property: "world", + children: undefined + } + }); + }); + + it("should send a dictionary of model", async () => { + const result = await client.modelValue.put({ + k1: { + property: "hello" + }, + k2: { + property: "world" + } + }); + assert.isUndefined(result); + }); + + it("should get a dictionary of nullable numbers", async () => { + const result = await client.nullableFloatValue.get(); + assert.deepEqual(result, { k1: 1.25, k2: 0.5, k3: null }); + }); + + it("should send a dictionary of nullable numbers", async () => { + const result = await client.nullableFloatValue.put({ + k1: 1.25, + k2: 0.5, + k3: null + }); + assert.isUndefined(result); + }); + + it("should get a dictionary of recursive model", async () => { + const result = await client.recursiveModelValue.get(); + assert.deepEqual(result, { + k1: { property: "hello", children: {} }, + k2: { + property: "world", + children: { "k2.1": { children: undefined, property: "inner world" } } + } + }); + }); + + it("should get a dictionary of string value", async () => { + const result = await client.stringValue.get(); + assert.deepEqual(result, { k1: "hello", k2: "" }); + }); + + it("should send a dictionary of string value", async () => { + const result = await client.stringValue.put({ k1: "hello", k2: "" }); + assert.isUndefined(result); + }); + + it("should get a dictionary of an unknown value", async () => { + const result = await client.unknownValue.get(); + assert.deepEqual(result, { k1: 1, k2: "hello", k3: null }); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/encodeBytes.spec.ts b/packages/typespec-ts/test/azureModularIntegration/encodeBytes.spec.ts new file mode 100644 index 0000000000..6b7d2728c1 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/encodeBytes.spec.ts @@ -0,0 +1,213 @@ +import { assert } from "chai"; +import { BytesClient } from "./generated/encode/bytes/src/index.js"; +import { stringToUint8Array, uint8ArrayToString } from "@azure/core-util"; +import { readFileSync } from "fs"; +import { resolve } from "path"; +describe("EncodeBytesClient Modular Client", () => { + let client: BytesClient; + + beforeEach(() => { + client = new BytesClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("query", () => { + it(`should get bytes`, async () => { + const result = await client.query.default( + stringToUint8Array("dGVzdA==", "base64") + ); + assert.isUndefined(result); + }); + + it(`should get bytes base64 encoding`, async () => { + const result = await client.query.base64( + stringToUint8Array("dGVzdA==", "base64") + ); + assert.isUndefined(result); + }); + + it(`should get bytes base64url encoding`, async () => { + const result = await client.query.base64url( + stringToUint8Array("dGVzdA", "base64url") + ); + assert.isUndefined(result); + }); + + it(`should get bytes base64url-array`, async () => { + const result = await client.query.base64urlArray([ + stringToUint8Array("dGVzdA", "base64url"), + stringToUint8Array("dGVzdA", "base64url") + ]); + assert.isUndefined(result); + }); + }); + + describe("property", () => { + it(`should post bytes`, async () => { + const result = await client.property.default({ + value: stringToUint8Array("dGVzdA==", "base64") + }); + assert.deepEqual( + result.value, + stringToUint8Array("dGVzdA==", "base64") + ); + }); + + it(`should post bytes base64 encoding`, async () => { + const result = await client.property.base64({ + value: stringToUint8Array("dGVzdA==", "base64") + }); + assert.deepEqual( + result.value, + stringToUint8Array("dGVzdA==", "base64") + ); + }); + + it(`should post bytes base64url encoding`, async () => { + const result = await client.property.base64url({ + value: stringToUint8Array("dGVzdA", "base64url") + }); + assert.deepEqual( + uint8ArrayToString(result.value, "base64url"), + "dGVzdA" + ); + }); + + it(`should post bytes base64url array`, async () => { + const result = await client.property.base64urlArray({ + value: [ + stringToUint8Array("dGVzdA", "base64url"), + stringToUint8Array("dGVzdA", "base64url") + ] + }); + assert.deepEqual(result.value, [ + stringToUint8Array("dGVzdA", "base64url"), + stringToUint8Array("dGVzdA", "base64url") + ]); + }); + }); + + describe("header", () => { + it(`should get bytes`, async () => { + const result = await client.header.default( + stringToUint8Array("dGVzdA==", "base64") + ); + assert.isUndefined(result); + }); + + it(`should get bytes base64 encoding`, async () => { + const result = await client.header.base64( + stringToUint8Array("dGVzdA==", "base64") + ); + assert.isUndefined(result); + }); + + it(`should get bytes base64url encoding`, async () => { + const result = await client.header.base64url( + stringToUint8Array("dGVzdA", "base64url") + ); + assert.isUndefined(result); + }); + + it(`should get bytes base64url-array`, async () => { + const result = await client.header.base64urlArray([ + stringToUint8Array("dGVzdA", "base64url"), + stringToUint8Array("dGVzdA", "base64url") + ]); + assert.isUndefined(result); + }); + }); + + describe("request body", () => { + const pngFile = readFileSync( + resolve("../../packages/typespec-ts/temp/assets/image.png") + ); + it(`should post bytes`, async () => { + try { + const result = await client.requestBody.default( + stringToUint8Array("dGVzdA==", "base64"), + { + requestOptions: { headers: { "content-type": "application/json" } } + } + ); + assert.isUndefined(result); + } catch (err) { + console.log(JSON.stringify(err)); + assert.fail(err as string); + } + }); + + it(`should post bytes base64 encoding`, async () => { + const result = await client.requestBody.base64( + stringToUint8Array("dGVzdA==", "base64"), + { + requestOptions: { headers: { "content-type": "application/json" } } + } + ); + assert.isUndefined(result); + }); + + it(`should post bytes base64url encoding`, async () => { + const result = await client.requestBody.base64url( + stringToUint8Array("dGVzdA", "base64url"), + { + requestOptions: { headers: { "content-type": "application/json" } } + } + ); + assert.isUndefined(result); + }); + + it(`should post bytes with custom content type`, async () => { + const result = await client.requestBody.customContentType(pngFile); + assert.isUndefined(result); + }).timeout(10000); + + it(`should post bytes with custom content type`, async () => { + const result = await client.requestBody.octetStream(pngFile); + assert.isUndefined(result); + }); + }); + + describe("response body", () => { + const pngFile = readFileSync( + resolve("../../packages/typespec-ts/temp/assets/image.png") + ).toString("utf-8"); + it(`should get bytes with base64 encoding by default`, async () => { + const result = await client.responseBody.default(); + assert.strictEqual(uint8ArrayToString(result, "base64"), "dGVzdA=="); + }); + + it(`should get bytes base64 encoding`, async () => { + const result = await client.responseBody.base64(); + assert.strictEqual(uint8ArrayToString(result, "base64"), "dGVzdA=="); + }); + + it(`should get bytes base64url encoding`, async () => { + const result = await client.responseBody.base64url(); + assert.strictEqual(uint8ArrayToString(result, "base64url"), "dGVzdA"); + }); + + it(`should get bytes with custom content type`, async () => { + const result = await client.responseBody.customContentType({ + onResponse: (res) => { + res.headers.get("content-type") === "image/png"; + } + }); + assert.strictEqual(uint8ArrayToString(result, "utf-8"), pngFile); + }); + + it(`should get bytes with octet-stream content type`, async () => { + const result = await client.responseBody.octetStream({ + onResponse: (res) => { + res.headers.get("content-type") === "application/octet-stream"; + } + }); + assert.strictEqual(uint8ArrayToString(result, "utf-8"), pngFile); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/encodeDatetime.spec.ts b/packages/typespec-ts/test/azureModularIntegration/encodeDatetime.spec.ts new file mode 100644 index 0000000000..3093fb75f1 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/encodeDatetime.spec.ts @@ -0,0 +1,177 @@ +import { assert } from "chai"; +import { DatetimeClient } from "./generated/encode/datetime/src/index.js"; +describe("EncodeDatetimeClient Rest Client", () => { + let client: DatetimeClient; + + beforeEach(() => { + client = new DatetimeClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("query", () => { + it(`should get default datetime`, async () => { + const result = await client.query.default( + new Date("2022-08-26T18:38:00.000Z") + ); + assert.isUndefined(result); + }); + + it(`should get rfc3339`, async () => { + const result = await client.query.rfc3339( + new Date("2022-08-26T18:38:00.000Z") + ); + assert.isUndefined(result); + }); + + it(`should get rfc7231`, async () => { + const result = await client.query.rfc7231( + new Date("Fri, 26 Aug 2022 14:38:00 GMT") + ); + assert.isUndefined(result); + }); + + it(`should get unix timestamp`, async () => { + const result = await client.query.unixTimestamp(new Date("2023-06-12T10:47:44.000Z")); + assert.isUndefined(result); + }); + + it(`should get unix timestamp-array`, async () => { + const result = await client.query.unixTimestampArray([ + new Date("2023-06-12T10:47:44.000Z"), + new Date("2023-06-14T09:17:36.000Z"), + ]); + assert.isUndefined(result); + }); + }); + + describe("property", () => { + it(`should get default datetime`, async () => { + const result = await client.property.default({ + value: new Date("2022-08-26T18:38:00.000Z") + }); + assert.deepEqual(result.value, new Date("2022-08-26T18:38:00.000Z")); + }); + + it(`should get rfc3339`, async () => { + const result = await client.property.rfc3339({ + value: new Date("2022-08-26T18:38:00.000Z") + }); + assert.deepEqual(result.value, new Date("2022-08-26T18:38:00.000Z")); + }); + + it(`should get rfc7231`, async () => { + const result = await client.property.rfc7231({ + value: new Date("Fri, 26 Aug 2022 14:38:00 GMT") + }); + assert.deepEqual( + result.value, + new Date("Fri, 26 Aug 2022 14:38:00 GMT") + ); + }); + + it(`should get unix timestamp`, async () => { + const result = await client.property.unixTimestamp({ + value: new Date("2023-06-12T10:47:44.000Z") + }); + assert.deepEqual(result.value, new Date("2023-06-12T10:47:44.000Z")); + }); + + it(`should get unix timestamp-array`, async () => { + const result = await client.property.unixTimestampArray({ + value: [new Date("2023-06-12T10:47:44.000Z"), new Date("2023-06-14T09:17:36.000Z")] + }); + assert.deepEqual(result.value, [ + new Date("2023-06-12T10:47:44.000Z"), + new Date("2023-06-14T09:17:36.000Z") + ]); + }); + }); + + describe("header", () => { + it(`should get default datetime`, async () => { + const result = await client.header.default( + new Date("Fri, 26 Aug 2022 14:38:00 GMT") + ); + assert.isUndefined(result); + }); + + it(`should get rfc3339`, async () => { + const result = await client.header.rfc3339( + new Date("2022-08-26T18:38:00.000Z") + ); + assert.isUndefined(result); + }); + + it(`should get rfc7231`, async () => { + const result = await client.header.rfc7231( + new Date("Fri, 26 Aug 2022 14:38:00 GMT") + ); + assert.isUndefined(result); + }); + + it(`should get unix timestamp`, async () => { + const result = await client.header.unixTimestamp(new Date("2023-06-12T10:47:44.000Z")); + assert.isUndefined(result); + }); + + it(`should get unix timestamp-array`, async () => { + const result = await client.header.unixTimestampArray([ + new Date("2023-06-12T10:47:44.000Z"), + new Date("2023-06-14T09:17:36.000Z") + ]); + assert.isUndefined(result); + }); + }); + + describe("response header", () => { + it(`should get default header`, async () => { + const result = await client.responseHeader.default({ + onResponse: (res) => { + assert.strictEqual( + res.headers.get("value"), + "Fri, 26 Aug 2022 14:38:00 GMT" + ); + } + }); + assert.isUndefined(result); + }); + + it(`should get rfc3339 header`, async () => { + const result = await client.responseHeader.rfc3339({ + onResponse: (res) => { + assert.strictEqual( + res.headers.get("value"), + "2022-08-26T18:38:00.000Z" + ); + } + }); + assert.isUndefined(result); + }); + + it(`should get rfc7231 header`, async () => { + const result = await client.responseHeader.rfc7231({ + onResponse: (res) => { + assert.strictEqual( + res.headers.get("value"), + "Fri, 26 Aug 2022 14:38:00 GMT" + ); + } + }); + assert.isUndefined(result); + }); + + it(`should get unix-timestamp header`, async () => { + const result = await client.responseHeader.unixTimestamp({ + onResponse: (res) => { + assert.strictEqual(res.headers.get("value"), "1686566864"); + } + }); + assert.isUndefined(result); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/encodeDuration.spec.ts b/packages/typespec-ts/test/azureModularIntegration/encodeDuration.spec.ts new file mode 100644 index 0000000000..7c14a6d6f8 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/encodeDuration.spec.ts @@ -0,0 +1,113 @@ +import { assert } from "chai"; +import { DurationClient } from "./generated/encode/duration/src/index.js"; +describe("EncodeDurationClient Rest Client", () => { + let client: DurationClient; + + beforeEach(() => { + client = new DurationClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("query", () => { + it(`should get default duration`, async () => { + const result = await client.query.default("P40D"); + assert.isUndefined(result); + }); + + it(`should get iso8601 duration`, async () => { + const result = await client.query.iso8601("P40D"); + assert.isUndefined(result); + }); + + it(`should get float seconds`, async () => { + const result = await client.query.floatSeconds(35.625); + assert.isUndefined(result); + }); + + it(`should get float64 seconds`, async () => { + const result = await client.query.float64Seconds(35.625); + assert.isUndefined(result); + }); + + it(`should get int32 seconds`, async () => { + const result = await client.query.int32Seconds(36); + assert.isUndefined(result); + }); + + it(`should get int32 seconds array`, async () => { + const result = await client.query.int32SecondsArray([36, 47]); + assert.isUndefined(result); + }); + }); + + describe("property", () => { + it(`should get default duration`, async () => { + const result = await client.property.default({ value: "P40D" }); + assert.deepEqual(result.value, "P40D"); + }); + + it(`should get iso8601 duration`, async () => { + const result = await client.property.iso8601({ value: "P40D" }); + assert.deepEqual(result.value, "P40D"); + }); + + it(`should get float seconds`, async () => { + const result = await client.property.floatSeconds({ value: 35.625 }); + assert.deepEqual(result.value, 35.625); + }); + + it(`should get float64 seconds`, async () => { + const result = await client.property.float64Seconds({ value: 35.625 }); + assert.deepEqual(result.value, 35.625); + }); + + it(`should get int32 seconds`, async () => { + const result = await client.property.int32Seconds({ value: 36 }); + assert.deepEqual(result.value, 36); + }); + + it(`should get float seconds array`, async () => { + const result = await client.property.floatSecondsArray({ + value: [35.625, 46.75] + }); + assert.deepEqual(result.value, [35.625, 46.75]); + }); + }); + + describe("header", () => { + it(`should get default duration`, async () => { + const result = await client.header.default("P40D"); + assert.isUndefined(result); + }); + + it(`should get iso8601 duration`, async () => { + const result = await client.header.iso8601("P40D"); + assert.isUndefined(result); + }); + + it(`should get float seconds`, async () => { + const result = await client.header.floatSeconds(35.625); + assert.isUndefined(result); + }); + + it(`should get float64 seconds`, async () => { + const result = await client.header.float64Seconds(35.625); + assert.isUndefined(result); + }); + + it(`should get int32 seconds`, async () => { + const result = await client.header.int32Seconds(36); + assert.isUndefined(result); + }); + + it(`should get int32 seconds array`, async () => { + const result = await client.header.iso8601Array(["P40D", "P50D"]); + assert.isUndefined(result); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/encodeNumeric.spec.ts b/packages/typespec-ts/test/azureModularIntegration/encodeNumeric.spec.ts new file mode 100644 index 0000000000..896ccbdb84 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/encodeNumeric.spec.ts @@ -0,0 +1,36 @@ +import { assert } from "chai"; +import { NumericClient } from "./generated/encode/numeric/src/index.js"; +describe("EncodeNumericClient Rest Client", () => { + let client: NumericClient; + + beforeEach(() => { + client = new NumericClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + describe("query", () => { + it(`should get safeint numeric`, async () => { + const result = await client.property.safeintAsString({ + value: "10000000000" + }); + assert.strictEqual(result.value, "10000000000"); + }); + + it(`should get uint32 numeric`, async () => { + const result = await client.property.uint32AsStringOptional({ + value: "1" + }); + assert.strictEqual(result.value, "1"); + }); + + it(`should get uint8 numeric`, async () => { + const result = await client.property.uint8AsString({ value: "255" }); + assert.strictEqual(result.value, "255"); + }); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/extensibleEnums.spec.ts b/packages/typespec-ts/test/azureModularIntegration/extensibleEnums.spec.ts new file mode 100644 index 0000000000..b8ef1771a6 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/extensibleEnums.spec.ts @@ -0,0 +1,36 @@ +import { assert } from "chai"; +import { ExtensibleClient } from "./generated/type/enum/extensible/src/index.js"; +describe("ExtensibleEnums Rest Client", () => { + let client: ExtensibleClient; + + beforeEach(() => { + client = new ExtensibleClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should get known value", async () => { + const result = await client.string.getKnownValue(); + assert.strictEqual(result, "Monday"); + }); + + it("should get unknown value", async () => { + const result = await client.string.getUnknownValue(); + assert.strictEqual(result, "Weekend"); + }); + + it("should put known value", async () => { + const result = await client.string.putKnownValue("Monday", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + }); + + it("should put unknown value and receives 500", async () => { + const result = await client.string.putUnknownValue("Weekend" as any, { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/fixedEnums.spec.ts b/packages/typespec-ts/test/azureModularIntegration/fixedEnums.spec.ts new file mode 100644 index 0000000000..b83a546e17 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/fixedEnums.spec.ts @@ -0,0 +1,35 @@ +import { assert } from "chai"; +import { FixedClient } from "./generated/type/enum/fixed/src/index.js"; +describe("FixedEnums Rest Client", () => { + let client: FixedClient; + + beforeEach(() => { + client = new FixedClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should get known value", async () => { + const result = await client.string.getKnownValue(); + assert.strictEqual(result, "Monday"); + }); + + it("should put known value", async () => { + const result = await client.string.putKnownValue("Monday", { + requestOptions: { headers: { "content-type": "text/plain" } } + }); + assert.isUndefined(result); + }); + + it("should put unknown value and receives 500", async () => { + try { + await client.string.putUnknownValue("Weekend" as any, { + requestOptions: { headers: { "content-type": "application/json" } } + }); + assert.fail("Expected an exception to be thrown."); + } catch (err) { + assert.isOk(err); + } + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/src/index.d.ts new file mode 100644 index 0000000000..519d8e6934 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/src/index.d.ts @@ -0,0 +1,23 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { KeyCredential } from '@azure/core-auth'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class ApiKeyClient { + private _client; + readonly pipeline: Pipeline; + constructor(credential: KeyCredential, options?: ApiKeyClientOptionalParams); + invalid(options?: InvalidOptionalParams): Promise; + valid(options?: ValidOptionalParams): Promise; +} + +export declare interface ApiKeyClientOptionalParams extends ClientOptions { +} + +export declare interface InvalidOptionalParams extends OperationOptions { +} + +export declare interface ValidOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/tspconfig.yaml new file mode 100644 index 0000000000..ee0607bb11 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/api-key/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/azure-api-key" + description: "Azure API Key Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/src/index.d.ts new file mode 100644 index 0000000000..5f729c295e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/src/index.d.ts @@ -0,0 +1,23 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { KeyCredential } from '@azure/core-auth'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class CustomClient { + private _client; + readonly pipeline: Pipeline; + constructor(credential: KeyCredential, options?: CustomClientOptionalParams); + invalid(options?: InvalidOptionalParams): Promise; + valid(options?: ValidOptionalParams): Promise; +} + +export declare interface CustomClientOptionalParams extends ClientOptions { +} + +export declare interface InvalidOptionalParams extends OperationOptions { +} + +export declare interface ValidOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/tspconfig.yaml new file mode 100644 index 0000000000..aa3a24e794 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/http/custom/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/azure-http-custom" + description: "Azure Http Custom Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/src/index.d.ts new file mode 100644 index 0000000000..028d21f5e9 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/src/index.d.ts @@ -0,0 +1,23 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { TokenCredential } from '@azure/core-auth'; + +export declare interface InvalidOptionalParams extends OperationOptions { +} + +export declare class OAuth2Client { + private _client; + readonly pipeline: Pipeline; + constructor(credential: TokenCredential, options?: OAuth2ClientOptionalParams); + invalid(options?: InvalidOptionalParams): Promise; + valid(options?: ValidOptionalParams): Promise; +} + +export declare interface OAuth2ClientOptionalParams extends ClientOptions { +} + +export declare interface ValidOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/tspconfig.yaml new file mode 100644 index 0000000000..02da667349 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/oauth2/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/azure-oauth2" + description: "Azure Oauth2 Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/src/index.d.ts new file mode 100644 index 0000000000..96ce7bf62b --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/src/index.d.ts @@ -0,0 +1,24 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { KeyCredential } from '@azure/core-auth'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { TokenCredential } from '@azure/core-auth'; + +export declare class UnionClient { + private _client; + readonly pipeline: Pipeline; + constructor(credential: KeyCredential | TokenCredential, options?: UnionClientOptionalParams); + validToken(options?: ValidTokenOptionalParams): Promise; + validKey(options?: ValidKeyOptionalParams): Promise; +} + +export declare interface UnionClientOptionalParams extends ClientOptions { +} + +export declare interface ValidKeyOptionalParams extends OperationOptions { +} + +export declare interface ValidTokenOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/tspconfig.yaml new file mode 100644 index 0000000000..c8d8dca745 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/authentication/union/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/azure-auth-union" + description: "Azure Auth Union Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/tspconfig.yaml index ed52a495b0..bcf4391c68 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/access/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/access/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml index e50e562561..8866823b1f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/flatten-property/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml index fcecd8207c..8d7df1c4ba 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/client-generator-core/usage/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/tspconfig.yaml index cc07a97798..3fc57ade08 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/basic/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/tspconfig.yaml index 9a35cc84c5..dc8f34aa04 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/rpc/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/rpc/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/tspconfig.yaml index 8d2f708447..75164cef37 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/lro/standard/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/lro/standard/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/model/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/model/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/tspconfig.yaml index 787b7f7731..f6740f93ee 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/model/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/model/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/page/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/page/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/tspconfig.yaml index 9b6eff415c..ffc4023493 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/page/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/page/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/tspconfig.yaml index e7735b1f06..ee9d5ec0d6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/scalar/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/scalar/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/tspconfig.yaml index 8978c49dd0..93a626009e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/core/traits/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/core/traits/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/tspconfig.yaml index 503fcdf6bd..b8629e8a3d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/example/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/example/basic/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/payload/pageable/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/src/index.d.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/tspconfig.yaml new file mode 100644 index 0000000000..71f16f6996 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/payload/pageable/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/payload-pageable" + description: "Azure payload Pageable Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml index 42a04266ba..8a717da0b7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/common-properties/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/tspconfig.yaml index 6b75ec304f..75ca52276c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/resource-manager/resources/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml index 4772e70667..f93fa362f0 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/azure/special-headers/client-request-id/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/client/naming/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/client/naming/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/naming/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/client/naming/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/naming/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/client/naming/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/naming/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/client/naming/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/client/naming/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/client/naming/tspconfig.yaml index 71a90180e4..876f6570f3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/naming/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/naming/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/tspconfig.yaml index c03daf8d2b..1fac2ac7fb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/client-operation-group/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/client-operation-group/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/default/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/default/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/tspconfig.yaml index 8a5a26fa47..fc53ca9582 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/default/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/default/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/tspconfig.yaml index 665d503dc9..d559242bc6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/multi-client/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/multi-client/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/tspconfig.yaml index 4baeba8f40..b656a45268 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/renamed-operation/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/renamed-operation/tspconfig.yaml @@ -5,6 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/tspconfig.yaml index 47adf24efd..723ab5fa26 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/client/structure/two-operation-group/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/client/structure/two-operation-group/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/src/index.d.ts new file mode 100644 index 0000000000..b031f9cf37 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/src/index.d.ts @@ -0,0 +1,138 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface Base64BytesProperty { + value: Uint8Array; +} + +export declare interface Base64urlArrayBytesProperty { + value: Uint8Array[]; +} + +export declare interface Base64urlBytesProperty { + value: Uint8Array; +} + +export declare class BytesClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: BytesClientOptionalParams); + readonly responseBody: ResponseBodyOperations; + readonly requestBody: RequestBodyOperations; + readonly header: HeaderOperations; + readonly property: PropertyOperations; + readonly query: QueryOperations; +} + +export declare interface BytesClientOptionalParams extends ClientOptions { +} + +export declare interface DefaultBytesProperty { + value: Uint8Array; +} + +export declare interface HeaderBase64OptionalParams extends OperationOptions { +} + +export declare interface HeaderBase64urlArrayOptionalParams extends OperationOptions { +} + +export declare interface HeaderBase64urlOptionalParams extends OperationOptions { +} + +export declare interface HeaderDefaultOptionalParams extends OperationOptions { +} + +export declare interface HeaderOperations { + base64urlArray: (value: Uint8Array[], options?: HeaderBase64urlArrayOptionalParams) => Promise; + base64url: (value: Uint8Array, options?: HeaderBase64urlOptionalParams) => Promise; + base64: (value: Uint8Array, options?: HeaderBase64OptionalParams) => Promise; + default: (value: Uint8Array, options?: HeaderDefaultOptionalParams) => Promise; +} + +export declare interface PropertyBase64OptionalParams extends OperationOptions { +} + +export declare interface PropertyBase64urlArrayOptionalParams extends OperationOptions { +} + +export declare interface PropertyBase64urlOptionalParams extends OperationOptions { +} + +export declare interface PropertyDefaultOptionalParams extends OperationOptions { +} + +export declare interface PropertyOperations { + base64urlArray: (body: Base64urlArrayBytesProperty, options?: PropertyBase64urlArrayOptionalParams) => Promise; + base64url: (body: Base64urlBytesProperty, options?: PropertyBase64urlOptionalParams) => Promise; + base64: (body: Base64BytesProperty, options?: PropertyBase64OptionalParams) => Promise; + default: (body: DefaultBytesProperty, options?: PropertyDefaultOptionalParams) => Promise; +} + +export declare interface QueryBase64OptionalParams extends OperationOptions { +} + +export declare interface QueryBase64urlArrayOptionalParams extends OperationOptions { +} + +export declare interface QueryBase64urlOptionalParams extends OperationOptions { +} + +export declare interface QueryDefaultOptionalParams extends OperationOptions { +} + +export declare interface QueryOperations { + base64urlArray: (value: Uint8Array[], options?: QueryBase64urlArrayOptionalParams) => Promise; + base64url: (value: Uint8Array, options?: QueryBase64urlOptionalParams) => Promise; + base64: (value: Uint8Array, options?: QueryBase64OptionalParams) => Promise; + default: (value: Uint8Array, options?: QueryDefaultOptionalParams) => Promise; +} + +export declare interface RequestBodyBase64OptionalParams extends OperationOptions { +} + +export declare interface RequestBodyBase64urlOptionalParams extends OperationOptions { +} + +export declare interface RequestBodyCustomContentTypeOptionalParams extends OperationOptions { +} + +export declare interface RequestBodyDefaultOptionalParams extends OperationOptions { +} + +export declare interface RequestBodyOctetStreamOptionalParams extends OperationOptions { +} + +export declare interface RequestBodyOperations { + base64url: (value: Uint8Array, options?: RequestBodyBase64urlOptionalParams) => Promise; + base64: (value: Uint8Array, options?: RequestBodyBase64OptionalParams) => Promise; + customContentType: (value: Uint8Array, options?: RequestBodyCustomContentTypeOptionalParams) => Promise; + octetStream: (value: Uint8Array, options?: RequestBodyOctetStreamOptionalParams) => Promise; + default: (value: Uint8Array, options?: RequestBodyDefaultOptionalParams) => Promise; +} + +export declare interface ResponseBodyBase64OptionalParams extends OperationOptions { +} + +export declare interface ResponseBodyBase64urlOptionalParams extends OperationOptions { +} + +export declare interface ResponseBodyCustomContentTypeOptionalParams extends OperationOptions { +} + +export declare interface ResponseBodyDefaultOptionalParams extends OperationOptions { +} + +export declare interface ResponseBodyOctetStreamOptionalParams extends OperationOptions { +} + +export declare interface ResponseBodyOperations { + base64url: (options?: ResponseBodyBase64urlOptionalParams) => Promise; + base64: (options?: ResponseBodyBase64OptionalParams) => Promise; + customContentType: (options?: ResponseBodyCustomContentTypeOptionalParams) => Promise; + octetStream: (options?: ResponseBodyOctetStreamOptionalParams) => Promise; + default: (options?: ResponseBodyDefaultOptionalParams) => Promise; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/tspconfig.yaml new file mode 100644 index 0000000000..c3b29ed6c5 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/bytes/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/encode-bytes" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/src/index.d.ts new file mode 100644 index 0000000000..8ed5a8c89a --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/src/index.d.ts @@ -0,0 +1,126 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class DatetimeClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: DatetimeClientOptionalParams); + readonly responseHeader: ResponseHeaderOperations; + readonly header: HeaderOperations; + readonly property: PropertyOperations; + readonly query: QueryOperations; +} + +export declare interface DatetimeClientOptionalParams extends ClientOptions { +} + +export declare interface DefaultDatetimeProperty { + value: Date; +} + +export declare interface HeaderDefaultOptionalParams extends OperationOptions { +} + +export declare interface HeaderOperations { + unixTimestampArray: (value: Date[], options?: HeaderUnixTimestampArrayOptionalParams) => Promise; + unixTimestamp: (value: Date, options?: HeaderUnixTimestampOptionalParams) => Promise; + rfc7231: (value: Date, options?: HeaderRfc7231OptionalParams) => Promise; + rfc3339: (value: Date, options?: HeaderRfc3339OptionalParams) => Promise; + default: (value: Date, options?: HeaderDefaultOptionalParams) => Promise; +} + +export declare interface HeaderRfc3339OptionalParams extends OperationOptions { +} + +export declare interface HeaderRfc7231OptionalParams extends OperationOptions { +} + +export declare interface HeaderUnixTimestampArrayOptionalParams extends OperationOptions { +} + +export declare interface HeaderUnixTimestampOptionalParams extends OperationOptions { +} + +export declare interface PropertyDefaultOptionalParams extends OperationOptions { +} + +export declare interface PropertyOperations { + unixTimestampArray: (body: UnixTimestampArrayDatetimeProperty, options?: PropertyUnixTimestampArrayOptionalParams) => Promise; + unixTimestamp: (body: UnixTimestampDatetimeProperty, options?: PropertyUnixTimestampOptionalParams) => Promise; + rfc7231: (body: Rfc7231DatetimeProperty, options?: PropertyRfc7231OptionalParams) => Promise; + rfc3339: (body: Rfc3339DatetimeProperty, options?: PropertyRfc3339OptionalParams) => Promise; + default: (body: DefaultDatetimeProperty, options?: PropertyDefaultOptionalParams) => Promise; +} + +export declare interface PropertyRfc3339OptionalParams extends OperationOptions { +} + +export declare interface PropertyRfc7231OptionalParams extends OperationOptions { +} + +export declare interface PropertyUnixTimestampArrayOptionalParams extends OperationOptions { +} + +export declare interface PropertyUnixTimestampOptionalParams extends OperationOptions { +} + +export declare interface QueryDefaultOptionalParams extends OperationOptions { +} + +export declare interface QueryOperations { + unixTimestampArray: (value: Date[], options?: QueryUnixTimestampArrayOptionalParams) => Promise; + unixTimestamp: (value: Date, options?: QueryUnixTimestampOptionalParams) => Promise; + rfc7231: (value: Date, options?: QueryRfc7231OptionalParams) => Promise; + rfc3339: (value: Date, options?: QueryRfc3339OptionalParams) => Promise; + default: (value: Date, options?: QueryDefaultOptionalParams) => Promise; +} + +export declare interface QueryRfc3339OptionalParams extends OperationOptions { +} + +export declare interface QueryRfc7231OptionalParams extends OperationOptions { +} + +export declare interface QueryUnixTimestampArrayOptionalParams extends OperationOptions { +} + +export declare interface QueryUnixTimestampOptionalParams extends OperationOptions { +} + +export declare interface ResponseHeaderDefaultOptionalParams extends OperationOptions { +} + +export declare interface ResponseHeaderOperations { + unixTimestamp: (options?: ResponseHeaderUnixTimestampOptionalParams) => Promise; + rfc7231: (options?: ResponseHeaderRfc7231OptionalParams) => Promise; + rfc3339: (options?: ResponseHeaderRfc3339OptionalParams) => Promise; + default: (options?: ResponseHeaderDefaultOptionalParams) => Promise; +} + +export declare interface ResponseHeaderRfc3339OptionalParams extends OperationOptions { +} + +export declare interface ResponseHeaderRfc7231OptionalParams extends OperationOptions { +} + +export declare interface ResponseHeaderUnixTimestampOptionalParams extends OperationOptions { +} + +export declare interface Rfc3339DatetimeProperty { + value: Date; +} + +export declare interface Rfc7231DatetimeProperty { + value: Date; +} + +export declare interface UnixTimestampArrayDatetimeProperty { + value: Date[]; +} + +export declare interface UnixTimestampDatetimeProperty { + value: Date; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/tspconfig.yaml new file mode 100644 index 0000000000..a12139853d --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/datetime/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/encode-datatime" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/src/index.d.ts new file mode 100644 index 0000000000..a0dd0c9b57 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/src/index.d.ts @@ -0,0 +1,122 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface DefaultDurationProperty { + value: string; +} + +export declare class DurationClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: DurationClientOptionalParams); + readonly header: HeaderOperations; + readonly property: PropertyOperations; + readonly query: QueryOperations; +} + +export declare interface DurationClientOptionalParams extends ClientOptions { +} + +export declare interface Float64SecondsDurationProperty { + value: number; +} + +export declare interface FloatSecondsDurationArrayProperty { + value: number[]; +} + +export declare interface FloatSecondsDurationProperty { + value: number; +} + +export declare interface HeaderDefaultOptionalParams extends OperationOptions { +} + +export declare interface HeaderFloat64SecondsOptionalParams extends OperationOptions { +} + +export declare interface HeaderFloatSecondsOptionalParams extends OperationOptions { +} + +export declare interface HeaderInt32SecondsOptionalParams extends OperationOptions { +} + +export declare interface HeaderIso8601ArrayOptionalParams extends OperationOptions { +} + +export declare interface HeaderIso8601OptionalParams extends OperationOptions { +} + +export declare interface HeaderOperations { + float64Seconds: (duration: number, options?: HeaderFloat64SecondsOptionalParams) => Promise; + floatSeconds: (duration: number, options?: HeaderFloatSecondsOptionalParams) => Promise; + int32Seconds: (duration: number, options?: HeaderInt32SecondsOptionalParams) => Promise; + iso8601Array: (duration: string[], options?: HeaderIso8601ArrayOptionalParams) => Promise; + iso8601: (duration: string, options?: HeaderIso8601OptionalParams) => Promise; + default: (duration: string, options?: HeaderDefaultOptionalParams) => Promise; +} + +export declare interface Int32SecondsDurationProperty { + value: number; +} + +export declare interface ISO8601DurationProperty { + value: string; +} + +export declare interface PropertyDefaultOptionalParams extends OperationOptions { +} + +export declare interface PropertyFloat64SecondsOptionalParams extends OperationOptions { +} + +export declare interface PropertyFloatSecondsArrayOptionalParams extends OperationOptions { +} + +export declare interface PropertyFloatSecondsOptionalParams extends OperationOptions { +} + +export declare interface PropertyInt32SecondsOptionalParams extends OperationOptions { +} + +export declare interface PropertyIso8601OptionalParams extends OperationOptions { +} + +export declare interface PropertyOperations { + floatSecondsArray: (body: FloatSecondsDurationArrayProperty, options?: PropertyFloatSecondsArrayOptionalParams) => Promise; + float64Seconds: (body: Float64SecondsDurationProperty, options?: PropertyFloat64SecondsOptionalParams) => Promise; + floatSeconds: (body: FloatSecondsDurationProperty, options?: PropertyFloatSecondsOptionalParams) => Promise; + int32Seconds: (body: Int32SecondsDurationProperty, options?: PropertyInt32SecondsOptionalParams) => Promise; + iso8601: (body: ISO8601DurationProperty, options?: PropertyIso8601OptionalParams) => Promise; + default: (body: DefaultDurationProperty, options?: PropertyDefaultOptionalParams) => Promise; +} + +export declare interface QueryDefaultOptionalParams extends OperationOptions { +} + +export declare interface QueryFloat64SecondsOptionalParams extends OperationOptions { +} + +export declare interface QueryFloatSecondsOptionalParams extends OperationOptions { +} + +export declare interface QueryInt32SecondsArrayOptionalParams extends OperationOptions { +} + +export declare interface QueryInt32SecondsOptionalParams extends OperationOptions { +} + +export declare interface QueryIso8601OptionalParams extends OperationOptions { +} + +export declare interface QueryOperations { + int32SecondsArray: (input: number[], options?: QueryInt32SecondsArrayOptionalParams) => Promise; + float64Seconds: (input: number, options?: QueryFloat64SecondsOptionalParams) => Promise; + floatSeconds: (input: number, options?: QueryFloatSecondsOptionalParams) => Promise; + int32Seconds: (input: number, options?: QueryInt32SecondsOptionalParams) => Promise; + iso8601: (input: string, options?: QueryIso8601OptionalParams) => Promise; + default: (input: string, options?: QueryDefaultOptionalParams) => Promise; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/tspconfig.yaml new file mode 100644 index 0000000000..5e79235d5a --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/duration/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/encode-duration" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/src/index.d.ts new file mode 100644 index 0000000000..287846bfd0 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/src/index.d.ts @@ -0,0 +1,42 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class NumericClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: NumericClientOptionalParams); + readonly property: PropertyOperations; +} + +export declare interface NumericClientOptionalParams extends ClientOptions { +} + +export declare interface PropertyOperations { + uint8AsString: (value: Uint8AsStringProperty, options?: PropertyUint8AsStringOptionalParams) => Promise; + uint32AsStringOptional: (value: Uint32AsStringProperty, options?: PropertyUint32AsStringOptionalOptionalParams) => Promise; + safeintAsString: (value: SafeintAsStringProperty, options?: PropertySafeintAsStringOptionalParams) => Promise; +} + +export declare interface PropertySafeintAsStringOptionalParams extends OperationOptions { +} + +export declare interface PropertyUint32AsStringOptionalOptionalParams extends OperationOptions { +} + +export declare interface PropertyUint8AsStringOptionalParams extends OperationOptions { +} + +export declare interface SafeintAsStringProperty { + value: string; +} + +export declare interface Uint32AsStringProperty { + value?: string; +} + +export declare interface Uint8AsStringProperty { + value: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/tspconfig.yaml new file mode 100644 index 0000000000..79b6db8847 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/encode/numeric/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/encode-numeric" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/src/index.d.ts new file mode 100644 index 0000000000..819ac7181b --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/src/index.d.ts @@ -0,0 +1,34 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class BasicClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: BasicClientOptionalParams); + readonly implicitBody: ImplicitBodyOperations; + readonly explicitBody: ExplicitBodyOperations; +} + +export declare interface BasicClientOptionalParams extends ClientOptions { +} + +export declare interface ExplicitBodyOperations { + simple: (body: User, options?: ExplicitBodySimpleOptionalParams) => Promise; +} + +export declare interface ExplicitBodySimpleOptionalParams extends OperationOptions { +} + +export declare interface ImplicitBodyOperations { + simple: (name: string, options?: ImplicitBodySimpleOptionalParams) => Promise; +} + +export declare interface ImplicitBodySimpleOptionalParams extends OperationOptions { +} + +export declare interface User { + name: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/tspconfig.yaml new file mode 100644 index 0000000000..04e23a2fa0 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/basic/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + enableOperationGroup: true + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/parameterBasic" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/src/index.d.ts new file mode 100644 index 0000000000..666db44d14 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/src/index.d.ts @@ -0,0 +1,40 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface BodyModel { + name: string; +} + +export declare class BodyOptionalityClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: BodyOptionalityClientOptionalParams); + readonly optionalExplicit: OptionalExplicitOperations; + requiredImplicit(name: string, options?: RequiredImplicitOptionalParams): Promise; + requiredExplicit(body: BodyModel, options?: RequiredExplicitOptionalParams): Promise; +} + +export declare interface BodyOptionalityClientOptionalParams extends ClientOptions { +} + +export declare interface OptionalExplicitOmitOptionalParams extends OperationOptions { + body?: BodyModel; +} + +export declare interface OptionalExplicitOperations { + omit: (options?: OptionalExplicitOmitOptionalParams) => Promise; + set: (options?: OptionalExplicitSetOptionalParams) => Promise; +} + +export declare interface OptionalExplicitSetOptionalParams extends OperationOptions { + body?: BodyModel; +} + +export declare interface RequiredExplicitOptionalParams extends OperationOptions { +} + +export declare interface RequiredImplicitOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/tspconfig.yaml new file mode 100644 index 0000000000..5211db2f94 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/body-optionality/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/body-optionality" + description: "Parameter Body Optionality Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/src/index.d.ts new file mode 100644 index 0000000000..4de5b37875 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/src/index.d.ts @@ -0,0 +1,46 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class CollectionFormatClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: CollectionFormatClientOptionalParams); + readonly header: HeaderOperations; + readonly query: QueryOperations; +} + +export declare interface CollectionFormatClientOptionalParams extends ClientOptions { +} + +export declare interface HeaderCsvOptionalParams extends OperationOptions { +} + +export declare interface HeaderOperations { + csv: (colors: string[], options?: HeaderCsvOptionalParams) => Promise; +} + +export declare interface QueryCsvOptionalParams extends OperationOptions { +} + +export declare interface QueryMultiOptionalParams extends OperationOptions { +} + +export declare interface QueryOperations { + csv: (colors: string[], options?: QueryCsvOptionalParams) => Promise; + pipes: (colors: string[], options?: QueryPipesOptionalParams) => Promise; + tsv: (colors: string[], options?: QueryTsvOptionalParams) => Promise; + ssv: (colors: string[], options?: QuerySsvOptionalParams) => Promise; + multi: (colors: string[], options?: QueryMultiOptionalParams) => Promise; +} + +export declare interface QueryPipesOptionalParams extends OperationOptions { +} + +export declare interface QuerySsvOptionalParams extends OperationOptions { +} + +export declare interface QueryTsvOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/tspconfig.yaml new file mode 100644 index 0000000000..2f1425ae7b --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/collection-format/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/azure-collection-format" + description: "Azure Collection Format Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/src/index.d.ts new file mode 100644 index 0000000000..c57d6c8d7f --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/src/index.d.ts @@ -0,0 +1,68 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface AliasOperations { + spreadParameterWithInnerAlias: (id: string, name: string, age: number, xMsTestHeader: string, options?: AliasSpreadParameterWithInnerAliasOptionalParams) => Promise; + spreadWithMultipleParameters: (id: string, xMsTestHeader: string, requiredString: string, requiredIntList: number[], options?: AliasSpreadWithMultipleParametersOptionalParams) => Promise; + spreadAsRequestParameter: (id: string, xMsTestHeader: string, name: string, options?: AliasSpreadAsRequestParameterOptionalParams) => Promise; + spreadParameterWithInnerModel: (id: string, name: string, xMsTestHeader: string, options?: AliasSpreadParameterWithInnerModelOptionalParams) => Promise; + spreadAsRequestBody: (name: string, options?: AliasSpreadAsRequestBodyOptionalParams) => Promise; +} + +export declare interface AliasSpreadAsRequestBodyOptionalParams extends OperationOptions { +} + +export declare interface AliasSpreadAsRequestParameterOptionalParams extends OperationOptions { +} + +export declare interface AliasSpreadParameterWithInnerAliasOptionalParams extends OperationOptions { +} + +export declare interface AliasSpreadParameterWithInnerModelOptionalParams extends OperationOptions { +} + +export declare interface AliasSpreadWithMultipleParametersOptionalParams extends OperationOptions { + optionalInt?: number; + optionalStringList?: string[]; +} + +export declare interface BodyParameter { + name: string; +} + +export declare interface ModelOperations { + spreadCompositeRequestMix: (name: string, testHeader: string, prop: string, options?: ModelSpreadCompositeRequestMixOptionalParams) => Promise; + spreadCompositeRequest: (name: string, testHeader: string, body: BodyParameter, options?: ModelSpreadCompositeRequestOptionalParams) => Promise; + spreadCompositeRequestWithoutBody: (name: string, testHeader: string, options?: ModelSpreadCompositeRequestWithoutBodyOptionalParams) => Promise; + spreadCompositeRequestOnlyWithBody: (body: BodyParameter, options?: ModelSpreadCompositeRequestOnlyWithBodyOptionalParams) => Promise; + spreadAsRequestBody: (name: string, options?: ModelSpreadAsRequestBodyOptionalParams) => Promise; +} + +export declare interface ModelSpreadAsRequestBodyOptionalParams extends OperationOptions { +} + +export declare interface ModelSpreadCompositeRequestMixOptionalParams extends OperationOptions { +} + +export declare interface ModelSpreadCompositeRequestOnlyWithBodyOptionalParams extends OperationOptions { +} + +export declare interface ModelSpreadCompositeRequestOptionalParams extends OperationOptions { +} + +export declare interface ModelSpreadCompositeRequestWithoutBodyOptionalParams extends OperationOptions { +} + +export declare class SpreadClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: SpreadClientOptionalParams); + readonly alias: AliasOperations; + readonly model: ModelOperations; +} + +export declare interface SpreadClientOptionalParams extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/tspconfig.yaml new file mode 100644 index 0000000000..8bdacb7b73 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/parameters/spread/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + enableOperationGroup: true + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/parameterSpread" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/src/index.d.ts new file mode 100644 index 0000000000..a1bac61e87 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/src/index.d.ts @@ -0,0 +1,42 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class ContentNegotiationClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: ContentNegotiationClientOptionalParams); + readonly differentBody: DifferentBodyOperations; + readonly sameBody: SameBodyOperations; +} + +export declare interface ContentNegotiationClientOptionalParams extends ClientOptions { +} + +export declare interface DifferentBodyGetAvatarAsJsonOptionalParams extends OperationOptions { +} + +export declare interface DifferentBodyGetAvatarAsPngOptionalParams extends OperationOptions { +} + +export declare interface DifferentBodyOperations { + getAvatarAsJson: (options?: DifferentBodyGetAvatarAsJsonOptionalParams) => Promise; + getAvatarAsPng: (options?: DifferentBodyGetAvatarAsPngOptionalParams) => Promise; +} + +export declare interface PngImageAsJson { + content: Uint8Array; +} + +export declare interface SameBodyGetAvatarAsJpegOptionalParams extends OperationOptions { +} + +export declare interface SameBodyGetAvatarAsPngOptionalParams extends OperationOptions { +} + +export declare interface SameBodyOperations { + getAvatarAsJpeg: (options?: SameBodyGetAvatarAsJpegOptionalParams) => Promise; + getAvatarAsPng: (options?: SameBodyGetAvatarAsPngOptionalParams) => Promise; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/tspconfig.yaml new file mode 100644 index 0000000000..ce814cfea1 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/content-negotiation/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/payload-content-negotiation" + description: "Payload Content Negotiation Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/src/index.d.ts new file mode 100644 index 0000000000..7539463102 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/src/index.d.ts @@ -0,0 +1,34 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class MediaTypeClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: MediaTypeClientOptionalParams); + readonly stringBody: StringBodyOperations; +} + +export declare interface MediaTypeClientOptionalParams extends ClientOptions { +} + +export declare interface StringBodyGetAsJsonOptionalParams extends OperationOptions { +} + +export declare interface StringBodyGetAsTextOptionalParams extends OperationOptions { +} + +export declare interface StringBodyOperations { + getAsJson: (options?: StringBodyGetAsJsonOptionalParams) => Promise; + sendAsJson: (text: string, options?: StringBodySendAsJsonOptionalParams) => Promise; + getAsText: (options?: StringBodyGetAsTextOptionalParams) => Promise; + sendAsText: (text: string, options?: StringBodySendAsTextOptionalParams) => Promise; +} + +export declare interface StringBodySendAsJsonOptionalParams extends OperationOptions { +} + +export declare interface StringBodySendAsTextOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/tspconfig.yaml new file mode 100644 index 0000000000..3350b799f7 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/media-type/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/payload-mediaType" + description: "Payload Media Type Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/src/index.d.ts new file mode 100644 index 0000000000..e42f7e5a66 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/src/index.d.ts @@ -0,0 +1,35 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class PageableClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: PageableClientOptionalParams); + readonly serverDrivenPagination: ServerDrivenPaginationOperations; +} + +export declare interface PageableClientOptionalParams extends ClientOptions { +} + +export declare interface Pet { + id: string; + name: string; +} + +export declare interface ServerDrivenPaginationLinkOptionalParams extends OperationOptions { +} + +export declare interface ServerDrivenPaginationOperations { + link: (options?: ServerDrivenPaginationLinkOptionalParams) => Promise<{ + pets: Pet[]; + links: { + next?: string; + prev?: string; + first?: string; + last?: string; + }; + }>; +} + +export { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/tspconfig.yaml similarity index 95% rename from packages/typespec-ts/test/modularIntegration/generated/payload/pageable/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/tspconfig.yaml index 7113b4f0f5..a4eb1f45bf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/pageable/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/payload/pageable/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true isModularLibrary: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml index 12922e2306..fa32decf06 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-main/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml similarity index 94% rename from packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml index 0986098b8f..94048f2646 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/resiliency/srv-driven-old/tspconfig.yaml @@ -4,6 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false + flavor: azure azureSdkForJs: false isModularLibrary: true hierarchyClient: false diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/src/index.d.ts new file mode 100644 index 0000000000..4898f205ec --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/src/index.d.ts @@ -0,0 +1,26 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface GetOptionalParams extends OperationOptions { +} + +export declare class JsonClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: JsonClientOptionalParams); + get(options?: GetOptionalParams): Promise; + send(body: JsonEncodedNameModel, options?: SendOptionalParams): Promise; +} + +export declare interface JsonClientOptionalParams extends ClientOptions { +} + +export declare interface JsonEncodedNameModel { + defaultName: boolean; +} + +export declare interface SendOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml new file mode 100644 index 0000000000..e47b9bdfc5 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: SerializationEncodedNameJsonClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/serialization-encoded-name-json" + description: "Serialization Encoded Name Json Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/src/index.d.ts new file mode 100644 index 0000000000..26662d6d1e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/src/index.d.ts @@ -0,0 +1,18 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class NotDefinedClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, options?: NotDefinedClientOptionalParams); + valid(options?: ValidOptionalParams): Promise; +} + +export declare interface NotDefinedClientOptionalParams extends ClientOptions { +} + +export declare interface ValidOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml new file mode 100644 index 0000000000..c72c917559 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: NotDefinedParamInServerEndpointClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/notdefinedparam" + description: "NotDefinedParameter Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/src/index.d.ts new file mode 100644 index 0000000000..90f3fe2998 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/src/index.d.ts @@ -0,0 +1,25 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class MultipleClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, options?: MultipleClientOptionalParams); + withOperationPathParam(keyword: string, options?: WithOperationPathParamOptionalParams): Promise; + noOperationParams(options?: NoOperationParamsOptionalParams): Promise; +} + +export declare interface MultipleClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +export declare interface NoOperationParamsOptionalParams extends OperationOptions { +} + +export declare type Versions = "v1.0"; + +export declare interface WithOperationPathParamOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/tspconfig.yaml new file mode 100644 index 0000000000..ff87767004 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/multiple/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: MultipleParamInServerPathClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/multipleparam" + description: "MultipleParameter Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/src/index.d.ts new file mode 100644 index 0000000000..3bf8a1a437 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/src/index.d.ts @@ -0,0 +1,18 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface MyOpOptionalParams extends OperationOptions { +} + +export declare class SingleClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, options?: SingleClientOptionalParams); + myOp(options?: MyOpOptionalParams): Promise; +} + +export declare interface SingleClientOptionalParams extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/tspconfig.yaml new file mode 100644 index 0000000000..c17a07d55e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/path/single/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: SingleParamInServerPathClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/singleparam" + description: "SingleParameter Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/src/index.d.ts new file mode 100644 index 0000000000..00b750b873 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/src/index.d.ts @@ -0,0 +1,26 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class NotVersionedClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, options?: NotVersionedClientOptionalParams); + withPathApiVersion(apiVersion: string, options?: WithPathApiVersionOptionalParams): Promise; + withQueryApiVersion(apiVersion: string, options?: WithQueryApiVersionOptionalParams): Promise; + withoutApiVersion(options?: WithoutApiVersionOptionalParams): Promise; +} + +export declare interface NotVersionedClientOptionalParams extends ClientOptions { +} + +export declare interface WithoutApiVersionOptionalParams extends OperationOptions { +} + +export declare interface WithPathApiVersionOptionalParams extends OperationOptions { +} + +export declare interface WithQueryApiVersionOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/tspconfig.yaml new file mode 100644 index 0000000000..e113f46e8a --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/not-versioned/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: NotVersionedParamInServerVersionsClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/not-versioned" + description: "NotVersioned Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/src/index.d.ts new file mode 100644 index 0000000000..b2be835076 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -0,0 +1,36 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare enum KnownVersions { + v2021_01_01_preview = "2021-01-01-preview", + v2022_12_01_preview = "2022-12-01-preview" +} + +export declare class VersionedClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, options?: VersionedClientOptionalParams); + withQueryOldApiVersion(options?: WithQueryOldApiVersionOptionalParams): Promise; + withPathApiVersion(options?: WithPathApiVersionOptionalParams): Promise; + withQueryApiVersion(options?: WithQueryApiVersionOptionalParams): Promise; + withoutApiVersion(options?: WithoutApiVersionOptionalParams): Promise; +} + +export declare interface VersionedClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +export declare interface WithoutApiVersionOptionalParams extends OperationOptions { +} + +export declare interface WithPathApiVersionOptionalParams extends OperationOptions { +} + +export declare interface WithQueryApiVersionOptionalParams extends OperationOptions { +} + +export declare interface WithQueryOldApiVersionOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/tspconfig.yaml new file mode 100644 index 0000000000..04050aa4ee --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/server/versions/versioned/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersionedParamInServerVersionsClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versioned" + description: "Versioned Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/src/index.d.ts new file mode 100644 index 0000000000..21e9bdb2f7 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/src/index.d.ts @@ -0,0 +1,18 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface ImmediateSuccessOptionalParams extends OperationOptions { +} + +export declare class RepeatabilityClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: RepeatabilityClientOptionalParams); + immediateSuccess(repeatabilityRequestID: string, repeatabilityFirstSent: Date, options?: ImmediateSuccessOptionalParams): Promise; +} + +export declare interface RepeatabilityClientOptionalParams extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/tspconfig.yaml new file mode 100644 index 0000000000..807e63da4b --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/special-headers/repeatability/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isModularLibrary: true + hierarchyClient: false + "emitter-output-dir": "{project-root}" + packageDetails: + name: "@msinternal/headers-repeatability" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/special-words/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/special-words/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/special-words/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/special-words/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/special-words/src/index.d.ts new file mode 100644 index 0000000000..1cdcb34aa9 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/special-words/src/index.d.ts @@ -0,0 +1,570 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface And { + name: string; +} + +export declare interface As { + name: string; +} + +export declare interface Assert { + name: string; +} + +export declare interface Async { + name: string; +} + +export declare interface Await { + name: string; +} + +export declare interface Break { + name: string; +} + +export declare interface Class { + name: string; +} + +export declare interface Constructor { + name: string; +} + +export declare interface Continue { + name: string; +} + +export declare interface Def { + name: string; +} + +export declare interface Del { + name: string; +} + +export declare interface Elif { + name: string; +} + +export declare interface Else { + name: string; +} + +export declare interface Except { + name: string; +} + +export declare interface Exec { + name: string; +} + +export declare interface Finally { + name: string; +} + +export declare interface For { + name: string; +} + +export declare interface From { + name: string; +} + +export declare interface GlobalModel { + name: string; +} + +export declare interface If { + name: string; +} + +export declare interface Import { + name: string; +} + +export declare interface In { + name: string; +} + +export declare interface Is { + name: string; +} + +export declare interface Lambda { + name: string; +} + +export declare interface ModelPropertiesOperations { + sameAsModel: (body: SameAsModel, options?: ModelPropertiesSameAsModelOptionalParams) => Promise; +} + +export declare interface ModelPropertiesSameAsModelOptionalParams extends OperationOptions { +} + +export declare interface ModelsOperations { + withYield: (body: Yield, options?: ModelsWithYieldOptionalParams) => Promise; + withWith: (body: With, options?: ModelsWithWithOptionalParams) => Promise; + withWhile: (body: While, options?: ModelsWithWhileOptionalParams) => Promise; + withTry: (body: Try, options?: ModelsWithTryOptionalParams) => Promise; + withReturn: (body: Return, options?: ModelsWithReturnOptionalParams) => Promise; + withRaise: (body: Raise, options?: ModelsWithRaiseOptionalParams) => Promise; + withPass: (body: Pass, options?: ModelsWithPassOptionalParams) => Promise; + withOr: (body: Or, options?: ModelsWithOrOptionalParams) => Promise; + withNot: (body: Not, options?: ModelsWithNotOptionalParams) => Promise; + withLambda: (body: Lambda, options?: ModelsWithLambdaOptionalParams) => Promise; + withIs: (body: Is, options?: ModelsWithIsOptionalParams) => Promise; + withIn: (body: In, options?: ModelsWithInOptionalParams) => Promise; + withImport: (body: Import, options?: ModelsWithImportOptionalParams) => Promise; + withIf: (body: If, options?: ModelsWithIfOptionalParams) => Promise; + withGlobal: (body: GlobalModel, options?: ModelsWithGlobalOptionalParams) => Promise; + withFrom: (body: From, options?: ModelsWithFromOptionalParams) => Promise; + withFor: (body: For, options?: ModelsWithForOptionalParams) => Promise; + withFinally: (body: Finally, options?: ModelsWithFinallyOptionalParams) => Promise; + withExec: (body: Exec, options?: ModelsWithExecOptionalParams) => Promise; + withExcept: (body: Except, options?: ModelsWithExceptOptionalParams) => Promise; + withElse: (body: Else, options?: ModelsWithElseOptionalParams) => Promise; + withElif: (body: Elif, options?: ModelsWithElifOptionalParams) => Promise; + withDel: (body: Del, options?: ModelsWithDelOptionalParams) => Promise; + withDef: (body: Def, options?: ModelsWithDefOptionalParams) => Promise; + withContinue: (body: Continue, options?: ModelsWithContinueOptionalParams) => Promise; + withConstructor: (body: Constructor, options?: ModelsWithConstructorOptionalParams) => Promise; + withClass: (body: Class, options?: ModelsWithClassOptionalParams) => Promise; + withBreak: (body: Break, options?: ModelsWithBreakOptionalParams) => Promise; + withAwait: (body: Await, options?: ModelsWithAwaitOptionalParams) => Promise; + withAsync: (body: Async, options?: ModelsWithAsyncOptionalParams) => Promise; + withAssert: (body: Assert, options?: ModelsWithAssertOptionalParams) => Promise; + withAs: (body: As, options?: ModelsWithAsOptionalParams) => Promise; + withAnd: (body: And, options?: ModelsWithAndOptionalParams) => Promise; +} + +export declare interface ModelsWithAndOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithAsOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithAssertOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithAsyncOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithAwaitOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithBreakOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithClassOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithConstructorOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithContinueOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithDefOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithDelOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithElifOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithElseOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithExceptOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithExecOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithFinallyOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithForOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithFromOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithGlobalOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithIfOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithImportOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithInOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithIsOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithLambdaOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithNotOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithOrOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithPassOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithRaiseOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithReturnOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithTryOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithWhileOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithWithOptionalParams extends OperationOptions { +} + +export declare interface ModelsWithYieldOptionalParams extends OperationOptions { +} + +export declare interface Not { + name: string; +} + +export declare interface OperationsAndOptionalParams extends OperationOptions { +} + +export declare interface OperationsAsOptionalParams extends OperationOptions { +} + +export declare interface OperationsAssertOptionalParams extends OperationOptions { +} + +export declare interface OperationsAsyncOptionalParams extends OperationOptions { +} + +export declare interface OperationsAwaitOptionalParams extends OperationOptions { +} + +export declare interface OperationsBreakOptionalParams extends OperationOptions { +} + +export declare interface OperationsClassOptionalParams extends OperationOptions { +} + +export declare interface OperationsConstructorOptionalParams extends OperationOptions { +} + +export declare interface OperationsContinueOptionalParams extends OperationOptions { +} + +export declare interface OperationsDefOptionalParams extends OperationOptions { +} + +export declare interface OperationsDelOptionalParams extends OperationOptions { +} + +export declare interface OperationsElifOptionalParams extends OperationOptions { +} + +export declare interface OperationsElseOptionalParams extends OperationOptions { +} + +export declare interface OperationsExceptOptionalParams extends OperationOptions { +} + +export declare interface OperationsExecOptionalParams extends OperationOptions { +} + +export declare interface OperationsFinallyOptionalParams extends OperationOptions { +} + +export declare interface OperationsForOptionalParams extends OperationOptions { +} + +export declare interface OperationsFromOptionalParams extends OperationOptions { +} + +export declare interface OperationsGlobalOptionalParams extends OperationOptions { +} + +export declare interface OperationsIfOptionalParams extends OperationOptions { +} + +export declare interface OperationsImportOptionalParams extends OperationOptions { +} + +export declare interface OperationsInOptionalParams extends OperationOptions { +} + +export declare interface OperationsIsOptionalParams extends OperationOptions { +} + +export declare interface OperationsLambdaOptionalParams extends OperationOptions { +} + +export declare interface OperationsNotOptionalParams extends OperationOptions { +} + +export declare interface OperationsOperations { + yield: (options?: OperationsYieldOptionalParams) => Promise; + with: (options?: OperationsWithOptionalParams) => Promise; + while: (options?: OperationsWhileOptionalParams) => Promise; + try: (options?: OperationsTryOptionalParams) => Promise; + return: (options?: OperationsReturnOptionalParams) => Promise; + raise: (options?: OperationsRaiseOptionalParams) => Promise; + pass: (options?: OperationsPassOptionalParams) => Promise; + or: (options?: OperationsOrOptionalParams) => Promise; + not: (options?: OperationsNotOptionalParams) => Promise; + lambda: (options?: OperationsLambdaOptionalParams) => Promise; + is: (options?: OperationsIsOptionalParams) => Promise; + in: (options?: OperationsInOptionalParams) => Promise; + import: (options?: OperationsImportOptionalParams) => Promise; + if: (options?: OperationsIfOptionalParams) => Promise; + global: (options?: OperationsGlobalOptionalParams) => Promise; + from: (options?: OperationsFromOptionalParams) => Promise; + for: (options?: OperationsForOptionalParams) => Promise; + finally: (options?: OperationsFinallyOptionalParams) => Promise; + exec: (options?: OperationsExecOptionalParams) => Promise; + except: (options?: OperationsExceptOptionalParams) => Promise; + else: (options?: OperationsElseOptionalParams) => Promise; + elif: (options?: OperationsElifOptionalParams) => Promise; + del: (options?: OperationsDelOptionalParams) => Promise; + def: (options?: OperationsDefOptionalParams) => Promise; + continue: (options?: OperationsContinueOptionalParams) => Promise; + constructor: (options?: OperationsConstructorOptionalParams) => Promise; + class: (options?: OperationsClassOptionalParams) => Promise; + break: (options?: OperationsBreakOptionalParams) => Promise; + await: (options?: OperationsAwaitOptionalParams) => Promise; + async: (options?: OperationsAsyncOptionalParams) => Promise; + assert: (options?: OperationsAssertOptionalParams) => Promise; + as: (options?: OperationsAsOptionalParams) => Promise; + and: (options?: OperationsAndOptionalParams) => Promise; +} + +export declare interface OperationsOrOptionalParams extends OperationOptions { +} + +export declare interface OperationsPassOptionalParams extends OperationOptions { +} + +export declare interface OperationsRaiseOptionalParams extends OperationOptions { +} + +export declare interface OperationsReturnOptionalParams extends OperationOptions { +} + +export declare interface OperationsTryOptionalParams extends OperationOptions { +} + +export declare interface OperationsWhileOptionalParams extends OperationOptions { +} + +export declare interface OperationsWithOptionalParams extends OperationOptions { +} + +export declare interface OperationsYieldOptionalParams extends OperationOptions { +} + +export declare interface Or { + name: string; +} + +export declare interface ParametersOperations { + withCancellationToken: (cancellationToken: string, options?: ParametersWithCancellationTokenOptionalParams) => Promise; + withYield: (yieldParam: string, options?: ParametersWithYieldOptionalParams) => Promise; + withWith: (withParam: string, options?: ParametersWithWithOptionalParams) => Promise; + withWhile: (whileParam: string, options?: ParametersWithWhileOptionalParams) => Promise; + withTry: (tryParam: string, options?: ParametersWithTryOptionalParams) => Promise; + withReturn: (returnParam: string, options?: ParametersWithReturnOptionalParams) => Promise; + withRaise: (raise: string, options?: ParametersWithRaiseOptionalParams) => Promise; + withPass: (pass: string, options?: ParametersWithPassOptionalParams) => Promise; + withOr: (or: string, options?: ParametersWithOrOptionalParams) => Promise; + withNot: (not: string, options?: ParametersWithNotOptionalParams) => Promise; + withLambda: (lambda: string, options?: ParametersWithLambdaOptionalParams) => Promise; + withIs: (is: string, options?: ParametersWithIsOptionalParams) => Promise; + withIn: (inParam: string, options?: ParametersWithInOptionalParams) => Promise; + withImport: (importParam: string, options?: ParametersWithImportOptionalParams) => Promise; + withIf: (ifParam: string, options?: ParametersWithIfOptionalParams) => Promise; + withGlobal: (global: string, options?: ParametersWithGlobalOptionalParams) => Promise; + withFrom: (fromParam: string, options?: ParametersWithFromOptionalParams) => Promise; + withFor: (forParam: string, options?: ParametersWithForOptionalParams) => Promise; + withFinally: (finallyParam: string, options?: ParametersWithFinallyOptionalParams) => Promise; + withExec: (exec: string, options?: ParametersWithExecOptionalParams) => Promise; + withExcept: (except: string, options?: ParametersWithExceptOptionalParams) => Promise; + withElse: (elseParam: string, options?: ParametersWithElseOptionalParams) => Promise; + withElif: (elif: string, options?: ParametersWithElifOptionalParams) => Promise; + withDel: (del: string, options?: ParametersWithDelOptionalParams) => Promise; + withDef: (def: string, options?: ParametersWithDefOptionalParams) => Promise; + withContinue: (continueParam: string, options?: ParametersWithContinueOptionalParams) => Promise; + withConstructor: (constructorParam: string, options?: ParametersWithConstructorOptionalParams) => Promise; + withClass: (classParam: string, options?: ParametersWithClassOptionalParams) => Promise; + withBreak: (breakParam: string, options?: ParametersWithBreakOptionalParams) => Promise; + withAwait: (awaitParam: string, options?: ParametersWithAwaitOptionalParams) => Promise; + withAsync: (asyncParam: string, options?: ParametersWithAsyncOptionalParams) => Promise; + withAssert: (assertParam: string, options?: ParametersWithAssertOptionalParams) => Promise; + withAs: (asParam: string, options?: ParametersWithAsOptionalParams) => Promise; + withAnd: (and: string, options?: ParametersWithAndOptionalParams) => Promise; +} + +export declare interface ParametersWithAndOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithAsOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithAssertOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithAsyncOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithAwaitOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithBreakOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithCancellationTokenOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithClassOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithConstructorOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithContinueOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithDefOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithDelOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithElifOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithElseOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithExceptOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithExecOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithFinallyOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithForOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithFromOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithGlobalOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithIfOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithImportOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithInOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithIsOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithLambdaOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithNotOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithOrOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithPassOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithRaiseOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithReturnOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithTryOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithWhileOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithWithOptionalParams extends OperationOptions { +} + +export declare interface ParametersWithYieldOptionalParams extends OperationOptions { +} + +export declare interface Pass { + name: string; +} + +export declare interface Raise { + name: string; +} + +export declare interface Return { + name: string; +} + +export declare interface SameAsModel { + sameAsModel: string; +} + +export declare class SpecialWordsClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: SpecialWordsClientOptionalParams); + readonly parameters: ParametersOperations; + readonly operations: OperationsOperations; + readonly modelProperties: ModelPropertiesOperations; + readonly models: ModelsOperations; +} + +export declare interface SpecialWordsClientOptionalParams extends ClientOptions { +} + +export declare interface Try { + name: string; +} + +export declare interface While { + name: string; +} + +export declare interface With { + name: string; +} + +export declare interface Yield { + name: string; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/special-words/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/special-words/tspconfig.yaml new file mode 100644 index 0000000000..017f4a5ba1 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/special-words/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: SpecialWordsClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/special-words" + description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/array/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/array/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/array/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/array/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/array/src/index.d.ts new file mode 100644 index 0000000000..6cbb0f1789 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/array/src/index.d.ts @@ -0,0 +1,187 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class ArrayClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: ArrayClientOptionalParams); + readonly nullableModelValue: NullableModelValueOperations; + readonly nullableStringValue: NullableStringValueOperations; + readonly nullableBooleanValue: NullableBooleanValueOperations; + readonly nullableInt32Value: NullableInt32ValueOperations; + readonly nullableFloatValue: NullableFloatValueOperations; + readonly modelValue: ModelValueOperations; + readonly unknownValue: UnknownValueOperations; + readonly durationValue: DurationValueOperations; + readonly datetimeValue: DatetimeValueOperations; + readonly float32Value: Float32ValueOperations; + readonly stringValue: StringValueOperations; + readonly booleanValue: BooleanValueOperations; + readonly int64Value: Int64ValueOperations; + readonly int32Value: Int32ValueOperations; +} + +export declare interface ArrayClientOptionalParams extends ClientOptions { +} + +export declare interface BooleanValueGetOptionalParams extends OperationOptions { +} + +export declare interface BooleanValueOperations { + put: (body: boolean[], options?: BooleanValuePutOptionalParams) => Promise; + get: (options?: BooleanValueGetOptionalParams) => Promise; +} + +export declare interface BooleanValuePutOptionalParams extends OperationOptions { +} + +export declare interface DatetimeValueGetOptionalParams extends OperationOptions { +} + +export declare interface DatetimeValueOperations { + put: (body: Date[], options?: DatetimeValuePutOptionalParams) => Promise; + get: (options?: DatetimeValueGetOptionalParams) => Promise; +} + +export declare interface DatetimeValuePutOptionalParams extends OperationOptions { +} + +export declare interface DurationValueGetOptionalParams extends OperationOptions { +} + +export declare interface DurationValueOperations { + put: (body: string[], options?: DurationValuePutOptionalParams) => Promise; + get: (options?: DurationValueGetOptionalParams) => Promise; +} + +export declare interface DurationValuePutOptionalParams extends OperationOptions { +} + +export declare interface Float32ValueGetOptionalParams extends OperationOptions { +} + +export declare interface Float32ValueOperations { + put: (body: number[], options?: Float32ValuePutOptionalParams) => Promise; + get: (options?: Float32ValueGetOptionalParams) => Promise; +} + +export declare interface Float32ValuePutOptionalParams extends OperationOptions { +} + +export declare interface InnerModel { + property: string; + children?: InnerModel[]; +} + +export declare interface Int32ValueGetOptionalParams extends OperationOptions { +} + +export declare interface Int32ValueOperations { + put: (body: number[], options?: Int32ValuePutOptionalParams) => Promise; + get: (options?: Int32ValueGetOptionalParams) => Promise; +} + +export declare interface Int32ValuePutOptionalParams extends OperationOptions { +} + +export declare interface Int64ValueGetOptionalParams extends OperationOptions { +} + +export declare interface Int64ValueOperations { + put: (body: number[], options?: Int64ValuePutOptionalParams) => Promise; + get: (options?: Int64ValueGetOptionalParams) => Promise; +} + +export declare interface Int64ValuePutOptionalParams extends OperationOptions { +} + +export declare interface ModelValueGetOptionalParams extends OperationOptions { +} + +export declare interface ModelValueOperations { + put: (body: InnerModel[], options?: ModelValuePutOptionalParams) => Promise; + get: (options?: ModelValueGetOptionalParams) => Promise; +} + +export declare interface ModelValuePutOptionalParams extends OperationOptions { +} + +export declare interface NullableBooleanValueGetOptionalParams extends OperationOptions { +} + +export declare interface NullableBooleanValueOperations { + put: (body: (boolean | null)[], options?: NullableBooleanValuePutOptionalParams) => Promise; + get: (options?: NullableBooleanValueGetOptionalParams) => Promise<(boolean | null)[]>; +} + +export declare interface NullableBooleanValuePutOptionalParams extends OperationOptions { +} + +export declare interface NullableFloatValueGetOptionalParams extends OperationOptions { +} + +export declare interface NullableFloatValueOperations { + put: (body: (number | null)[], options?: NullableFloatValuePutOptionalParams) => Promise; + get: (options?: NullableFloatValueGetOptionalParams) => Promise<(number | null)[]>; +} + +export declare interface NullableFloatValuePutOptionalParams extends OperationOptions { +} + +export declare interface NullableInt32ValueGetOptionalParams extends OperationOptions { +} + +export declare interface NullableInt32ValueOperations { + put: (body: (number | null)[], options?: NullableInt32ValuePutOptionalParams) => Promise; + get: (options?: NullableInt32ValueGetOptionalParams) => Promise<(number | null)[]>; +} + +export declare interface NullableInt32ValuePutOptionalParams extends OperationOptions { +} + +export declare interface NullableModelValueGetOptionalParams extends OperationOptions { +} + +export declare interface NullableModelValueOperations { + put: (body: (InnerModel | null)[], options?: NullableModelValuePutOptionalParams) => Promise; + get: (options?: NullableModelValueGetOptionalParams) => Promise<(InnerModel | null)[]>; +} + +export declare interface NullableModelValuePutOptionalParams extends OperationOptions { +} + +export declare interface NullableStringValueGetOptionalParams extends OperationOptions { +} + +export declare interface NullableStringValueOperations { + put: (body: (string | null)[], options?: NullableStringValuePutOptionalParams) => Promise; + get: (options?: NullableStringValueGetOptionalParams) => Promise<(string | null)[]>; +} + +export declare interface NullableStringValuePutOptionalParams extends OperationOptions { +} + +export declare interface StringValueGetOptionalParams extends OperationOptions { +} + +export declare interface StringValueOperations { + put: (body: string[], options?: StringValuePutOptionalParams) => Promise; + get: (options?: StringValueGetOptionalParams) => Promise; +} + +export declare interface StringValuePutOptionalParams extends OperationOptions { +} + +export declare interface UnknownValueGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownValueOperations { + put: (body: any[], options?: UnknownValuePutOptionalParams) => Promise; + get: (options?: UnknownValueGetOptionalParams) => Promise; +} + +export declare interface UnknownValuePutOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/array/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/array/tspconfig.yaml new file mode 100644 index 0000000000..236d9e4de2 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/array/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/arrays-item-types" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/src/index.d.ts new file mode 100644 index 0000000000..7f436b2287 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/src/index.d.ts @@ -0,0 +1,151 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface BooleanValueGetOptionalParams extends OperationOptions { +} + +export declare interface BooleanValueOperations { + put: (body: Record, options?: BooleanValuePutOptionalParams) => Promise; + get: (options?: BooleanValueGetOptionalParams) => Promise>; +} + +export declare interface BooleanValuePutOptionalParams extends OperationOptions { +} + +export declare interface DatetimeValueGetOptionalParams extends OperationOptions { +} + +export declare interface DatetimeValueOperations { + put: (body: Record, options?: DatetimeValuePutOptionalParams) => Promise; + get: (options?: DatetimeValueGetOptionalParams) => Promise>; +} + +export declare interface DatetimeValuePutOptionalParams extends OperationOptions { +} + +export declare class DictionaryClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: DictionaryClientOptionalParams); + readonly nullableFloatValue: NullableFloatValueOperations; + readonly recursiveModelValue: RecursiveModelValueOperations; + readonly modelValue: ModelValueOperations; + readonly unknownValue: UnknownValueOperations; + readonly durationValue: DurationValueOperations; + readonly datetimeValue: DatetimeValueOperations; + readonly float32Value: Float32ValueOperations; + readonly stringValue: StringValueOperations; + readonly booleanValue: BooleanValueOperations; + readonly int64Value: Int64ValueOperations; + readonly int32Value: Int32ValueOperations; +} + +export declare interface DictionaryClientOptionalParams extends ClientOptions { +} + +export declare interface DurationValueGetOptionalParams extends OperationOptions { +} + +export declare interface DurationValueOperations { + put: (body: Record, options?: DurationValuePutOptionalParams) => Promise; + get: (options?: DurationValueGetOptionalParams) => Promise>; +} + +export declare interface DurationValuePutOptionalParams extends OperationOptions { +} + +export declare interface Float32ValueGetOptionalParams extends OperationOptions { +} + +export declare interface Float32ValueOperations { + put: (body: Record, options?: Float32ValuePutOptionalParams) => Promise; + get: (options?: Float32ValueGetOptionalParams) => Promise>; +} + +export declare interface Float32ValuePutOptionalParams extends OperationOptions { +} + +export declare interface InnerModel { + property: string; + children?: Record; +} + +export declare interface Int32ValueGetOptionalParams extends OperationOptions { +} + +export declare interface Int32ValueOperations { + put: (body: Record, options?: Int32ValuePutOptionalParams) => Promise; + get: (options?: Int32ValueGetOptionalParams) => Promise>; +} + +export declare interface Int32ValuePutOptionalParams extends OperationOptions { +} + +export declare interface Int64ValueGetOptionalParams extends OperationOptions { +} + +export declare interface Int64ValueOperations { + put: (body: Record, options?: Int64ValuePutOptionalParams) => Promise; + get: (options?: Int64ValueGetOptionalParams) => Promise>; +} + +export declare interface Int64ValuePutOptionalParams extends OperationOptions { +} + +export declare interface ModelValueGetOptionalParams extends OperationOptions { +} + +export declare interface ModelValueOperations { + put: (body: Record, options?: ModelValuePutOptionalParams) => Promise; + get: (options?: ModelValueGetOptionalParams) => Promise>; +} + +export declare interface ModelValuePutOptionalParams extends OperationOptions { +} + +export declare interface NullableFloatValueGetOptionalParams extends OperationOptions { +} + +export declare interface NullableFloatValueOperations { + put: (body: Record, options?: NullableFloatValuePutOptionalParams) => Promise; + get: (options?: NullableFloatValueGetOptionalParams) => Promise>; +} + +export declare interface NullableFloatValuePutOptionalParams extends OperationOptions { +} + +export declare interface RecursiveModelValueGetOptionalParams extends OperationOptions { +} + +export declare interface RecursiveModelValueOperations { + put: (body: Record, options?: RecursiveModelValuePutOptionalParams) => Promise; + get: (options?: RecursiveModelValueGetOptionalParams) => Promise>; +} + +export declare interface RecursiveModelValuePutOptionalParams extends OperationOptions { +} + +export declare interface StringValueGetOptionalParams extends OperationOptions { +} + +export declare interface StringValueOperations { + put: (body: Record, options?: StringValuePutOptionalParams) => Promise; + get: (options?: StringValueGetOptionalParams) => Promise>; +} + +export declare interface StringValuePutOptionalParams extends OperationOptions { +} + +export declare interface UnknownValueGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownValueOperations { + put: (body: Record, options?: UnknownValuePutOptionalParams) => Promise; + get: (options?: UnknownValueGetOptionalParams) => Promise>; +} + +export declare interface UnknownValuePutOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/tspconfig.yaml new file mode 100644 index 0000000000..c4c72682a2 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/dictionary/tspconfig.yaml @@ -0,0 +1,19 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + # temporary only support legacy client for additional properties in modular + compatibilityMode: true + packageDetails: + name: "@msinternal/dictionary" + description: "Dictionary Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/src/index.d.ts new file mode 100644 index 0000000000..0b6947054e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/src/index.d.ts @@ -0,0 +1,36 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare type DaysOfWeekExtensibleEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; + +export declare class ExtensibleClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: ExtensibleClientOptionalParams); + readonly string: StringOperations; +} + +export declare interface ExtensibleClientOptionalParams extends ClientOptions { +} + +export declare interface StringGetKnownValueOptionalParams extends OperationOptions { +} + +export declare interface StringGetUnknownValueOptionalParams extends OperationOptions { +} + +export declare interface StringOperations { + putUnknownValue: (body: DaysOfWeekExtensibleEnum, options?: StringPutUnknownValueOptionalParams) => Promise; + putKnownValue: (body: DaysOfWeekExtensibleEnum, options?: StringPutKnownValueOptionalParams) => Promise; + getUnknownValue: (options?: StringGetUnknownValueOptionalParams) => Promise; + getKnownValue: (options?: StringGetKnownValueOptionalParams) => Promise; +} + +export declare interface StringPutKnownValueOptionalParams extends OperationOptions { +} + +export declare interface StringPutUnknownValueOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/tspconfig.yaml new file mode 100644 index 0000000000..f68847e139 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/extensible/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/extensible-enums" + description: "Extensible Enums Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/src/index.d.ts new file mode 100644 index 0000000000..f5fe843f17 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/src/index.d.ts @@ -0,0 +1,32 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare type DaysOfWeekEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; + +export declare class FixedClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: FixedClientOptionalParams); + readonly string: StringOperations; +} + +export declare interface FixedClientOptionalParams extends ClientOptions { +} + +export declare interface StringGetKnownValueOptionalParams extends OperationOptions { +} + +export declare interface StringOperations { + putUnknownValue: (body: DaysOfWeekEnum, options?: StringPutUnknownValueOptionalParams) => Promise; + putKnownValue: (body: DaysOfWeekEnum, options?: StringPutKnownValueOptionalParams) => Promise; + getKnownValue: (options?: StringGetKnownValueOptionalParams) => Promise; +} + +export declare interface StringPutKnownValueOptionalParams extends OperationOptions { +} + +export declare interface StringPutUnknownValueOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/tspconfig.yaml new file mode 100644 index 0000000000..6ea0bdede5 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/enum/fixed/tspconfig.yaml @@ -0,0 +1,15 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/fixed-enums" + description: "Enums Fixed Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/src/index.d.ts new file mode 100644 index 0000000000..ef81818e57 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/src/index.d.ts @@ -0,0 +1,35 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class EmptyClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: EmptyClientOptionalParams); + postRoundTripEmpty(body: EmptyInputOutput, options?: PostRoundTripEmptyOptionalParams): Promise; + getEmpty(options?: GetEmptyOptionalParams): Promise; + putEmpty(input: EmptyInput, options?: PutEmptyOptionalParams): Promise; +} + +export declare interface EmptyClientOptionalParams extends ClientOptions { +} + +export declare interface EmptyInput { +} + +export declare interface EmptyInputOutput { +} + +export declare interface EmptyOutput { +} + +export declare interface GetEmptyOptionalParams extends OperationOptions { +} + +export declare interface PostRoundTripEmptyOptionalParams extends OperationOptions { +} + +export declare interface PutEmptyOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/tspconfig.yaml new file mode 100644 index 0000000000..a308284cd2 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/empty/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isModularLibrary: true + hierarchyClient: false + "emitter-output-dir": "{project-root}" + packageDetails: + name: "@msinternal/modular-model-empty" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts new file mode 100644 index 0000000000..20a1c6d030 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts @@ -0,0 +1,72 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface Cobra extends Snake { + kind: "cobra"; +} + +export declare interface Dog { + kind: DogKind; + weight: number; +} + +export declare type DogKind = "golden"; + +export declare type DogUnion = Golden | Dog; + +export declare class EnumDiscriminatorClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: EnumDiscriminatorClientOptionalParams); + getFixedModelWrongDiscriminator(options?: GetFixedModelWrongDiscriminatorOptionalParams): Promise; + getFixedModelMissingDiscriminator(options?: GetFixedModelMissingDiscriminatorOptionalParams): Promise; + putFixedModel(input: SnakeUnion, options?: PutFixedModelOptionalParams): Promise; + getFixedModel(options?: GetFixedModelOptionalParams): Promise; + getExtensibleModelWrongDiscriminator(options?: GetExtensibleModelWrongDiscriminatorOptionalParams): Promise; + getExtensibleModelMissingDiscriminator(options?: GetExtensibleModelMissingDiscriminatorOptionalParams): Promise; + putExtensibleModel(input: DogUnion, options?: PutExtensibleModelOptionalParams): Promise; + getExtensibleModel(options?: GetExtensibleModelOptionalParams): Promise; +} + +export declare interface EnumDiscriminatorClientOptionalParams extends ClientOptions { +} + +export declare interface GetExtensibleModelMissingDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface GetExtensibleModelOptionalParams extends OperationOptions { +} + +export declare interface GetExtensibleModelWrongDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface GetFixedModelMissingDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface GetFixedModelOptionalParams extends OperationOptions { +} + +export declare interface GetFixedModelWrongDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface Golden extends Dog { + kind: "golden"; +} + +export declare interface PutExtensibleModelOptionalParams extends OperationOptions { +} + +export declare interface PutFixedModelOptionalParams extends OperationOptions { +} + +export declare interface Snake { + kind: SnakeKind; + length: number; +} + +export declare type SnakeKind = "cobra"; + +export declare type SnakeUnion = Cobra | Snake; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml new file mode 100644 index 0000000000..3a10f8dd06 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/model-inheritance-enum-discriminator" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts new file mode 100644 index 0000000000..64bf16dfe4 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts @@ -0,0 +1,67 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface Fish { + kind: string; + age: number; +} + +export declare type FishUnion = SharkUnion | Salmon | Fish; + +export declare interface GetMissingDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface GetModelOptionalParams extends OperationOptions { +} + +export declare interface GetRecursiveModelOptionalParams extends OperationOptions { +} + +export declare interface GetWrongDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface GoblinShark extends Shark { + sharktype: "goblin"; +} + +export declare class NestedDiscriminatorClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: NestedDiscriminatorClientOptionalParams); + getWrongDiscriminator(options?: GetWrongDiscriminatorOptionalParams): Promise; + getMissingDiscriminator(options?: GetMissingDiscriminatorOptionalParams): Promise; + putRecursiveModel(input: FishUnion, options?: PutRecursiveModelOptionalParams): Promise; + getRecursiveModel(options?: GetRecursiveModelOptionalParams): Promise; + putModel(input: FishUnion, options?: PutModelOptionalParams): Promise; + getModel(options?: GetModelOptionalParams): Promise; +} + +export declare interface NestedDiscriminatorClientOptionalParams extends ClientOptions { +} + +export declare interface PutModelOptionalParams extends OperationOptions { +} + +export declare interface PutRecursiveModelOptionalParams extends OperationOptions { +} + +export declare interface Salmon extends Fish { + kind: "salmon"; + friends?: FishUnion[]; + hate?: Record; + partner?: FishUnion; +} + +export declare interface SawShark extends Shark { + sharktype: "saw"; +} + +export declare interface Shark extends Fish { + kind: "shark"; + sharktype: string; +} + +export declare type SharkUnion = SawShark | GoblinShark | Shark; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml new file mode 100644 index 0000000000..81b3dbb7fc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/model-inheritance-nested-discriminator" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts new file mode 100644 index 0000000000..b41328d759 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts @@ -0,0 +1,38 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface Cat extends Pet { + age: number; +} + +export declare interface GetValidOptionalParams extends OperationOptions { +} + +export declare class NotDiscriminatedClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: NotDiscriminatedClientOptionalParams); + putValid(input: Siamese, options?: PutValidOptionalParams): Promise; + getValid(options?: GetValidOptionalParams): Promise; + postValid(input: Siamese, options?: PostValidOptionalParams): Promise; +} + +export declare interface NotDiscriminatedClientOptionalParams extends ClientOptions { +} + +export declare interface Pet { + name: string; +} + +export declare interface PostValidOptionalParams extends OperationOptions { +} + +export declare interface PutValidOptionalParams extends OperationOptions { +} + +export declare interface Siamese extends Cat { + smart: boolean; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml new file mode 100644 index 0000000000..dda4084518 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/model-inheritance-not-discriminated" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts new file mode 100644 index 0000000000..c6777a5ecb --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts @@ -0,0 +1,31 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +declare interface Element_2 { + extension?: Extension[]; +} +export { Element_2 as Element } + +export declare interface Extension extends Element_2 { + level: number; +} + +export declare interface GetOptionalParams extends OperationOptions { +} + +export declare interface PutOptionalParams extends OperationOptions { +} + +export declare class RecursiveClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: RecursiveClientOptionalParams); + get(options?: GetOptionalParams): Promise; + put(input: Extension, options?: PutOptionalParams): Promise; +} + +export declare interface RecursiveClientOptionalParams extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml new file mode 100644 index 0000000000..06b24e9f27 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isModularLibrary: true + hierarchyClient: false + "emitter-output-dir": "{project-root}" + packageDetails: + name: "@msinternal/model-inheritance-recursive" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts new file mode 100644 index 0000000000..1af2d7be19 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts @@ -0,0 +1,79 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface Bird { + kind: string; + wingspan: number; +} + +export declare type BirdUnion = SeaGull | Sparrow | Goose | Eagle | Bird; + +export declare interface Dinosaur { + kind: string; + size: number; +} + +export declare type DinosaurUnion = TRex | Dinosaur; + +export declare interface Eagle extends Bird { + kind: "eagle"; + friends?: BirdUnion[]; + hate?: Record; + partner?: BirdUnion; +} + +export declare interface GetLegacyModelOptionalParams extends OperationOptions { +} + +export declare interface GetMissingDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface GetModelOptionalParams extends OperationOptions { +} + +export declare interface GetRecursiveModelOptionalParams extends OperationOptions { +} + +export declare interface GetWrongDiscriminatorOptionalParams extends OperationOptions { +} + +export declare interface Goose extends Bird { + kind: "goose"; +} + +export declare interface PutModelOptionalParams extends OperationOptions { +} + +export declare interface PutRecursiveModelOptionalParams extends OperationOptions { +} + +export declare interface SeaGull extends Bird { + kind: "seagull"; +} + +export declare class SingleDiscriminatorClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: SingleDiscriminatorClientOptionalParams); + getLegacyModel(options?: GetLegacyModelOptionalParams): Promise; + getWrongDiscriminator(options?: GetWrongDiscriminatorOptionalParams): Promise; + getMissingDiscriminator(options?: GetMissingDiscriminatorOptionalParams): Promise; + putRecursiveModel(input: BirdUnion, options?: PutRecursiveModelOptionalParams): Promise; + getRecursiveModel(options?: GetRecursiveModelOptionalParams): Promise; + putModel(input: BirdUnion, options?: PutModelOptionalParams): Promise; + getModel(options?: GetModelOptionalParams): Promise; +} + +export declare interface SingleDiscriminatorClientOptionalParams extends ClientOptions { +} + +export declare interface Sparrow extends Bird { + kind: "sparrow"; +} + +export declare interface TRex extends Dinosaur { + kind: "t-rex"; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml new file mode 100644 index 0000000000..8eb58cb902 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml @@ -0,0 +1,16 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + isModularLibrary: true + packageDetails: + name: "@msinternal/model-inheritance-single-discriminator" + description: "Model Inheritance Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/src/index.d.ts similarity index 84% rename from packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/src/index.d.ts index dd6ad6fec4..6331da3ee0 100644 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/src/index.d.ts +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@typespec/ts-http-runtime'; -import { OperationOptions } from '@typespec/ts-http-runtime'; -import { Pipeline } from '@typespec/ts-http-runtime'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; export declare interface InputAndOutputOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/tspconfig.yaml new file mode 100644 index 0000000000..f93fa362f0 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/model/usage/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isModularLibrary: true + hierarchyClient: false + "emitter-output-dir": "{project-root}" + packageDetails: + name: "@msinternal/modular-model-usage" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/src/index.d.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/src/index.d.ts rename to packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/src/index.d.ts diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/tspconfig.yaml similarity index 96% rename from packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/tspconfig.yaml rename to packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/tspconfig.yaml index d3e7732112..c0c82de712 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/additional-properties/tspconfig.yaml +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/additional-properties/tspconfig.yaml @@ -6,6 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false + flavor: azure azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/src/index.d.ts new file mode 100644 index 0000000000..2fdba31b3f --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/src/index.d.ts @@ -0,0 +1,193 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface BytesGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface BytesGetNullOptionalParams extends OperationOptions { +} + +export declare interface BytesOperations { + patchNull: (body: BytesProperty, options?: BytesPatchNullOptionalParams) => Promise; + patchNonNull: (body: BytesProperty, options?: BytesPatchNonNullOptionalParams) => Promise; + getNull: (options?: BytesGetNullOptionalParams) => Promise; + getNonNull: (options?: BytesGetNonNullOptionalParams) => Promise; +} + +export declare interface BytesPatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface BytesPatchNullOptionalParams extends OperationOptions { +} + +export declare interface BytesProperty { + requiredProperty: string; + nullableProperty: Uint8Array | null; +} + +export declare interface CollectionsByteGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsByteGetNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsByteOperations { + patchNull: (body: CollectionsByteProperty, options?: CollectionsBytePatchNullOptionalParams) => Promise; + patchNonNull: (body: CollectionsByteProperty, options?: CollectionsBytePatchNonNullOptionalParams) => Promise; + getNull: (options?: CollectionsByteGetNullOptionalParams) => Promise; + getNonNull: (options?: CollectionsByteGetNonNullOptionalParams) => Promise; +} + +export declare interface CollectionsBytePatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsBytePatchNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsByteProperty { + requiredProperty: string; + nullableProperty: Uint8Array[] | null; +} + +export declare interface CollectionsModelGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelGetNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelOperations { + patchNull: (body: CollectionsModelProperty, options?: CollectionsModelPatchNullOptionalParams) => Promise; + patchNonNull: (body: CollectionsModelProperty, options?: CollectionsModelPatchNonNullOptionalParams) => Promise; + getNull: (options?: CollectionsModelGetNullOptionalParams) => Promise; + getNonNull: (options?: CollectionsModelGetNonNullOptionalParams) => Promise; +} + +export declare interface CollectionsModelPatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelPatchNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelProperty { + requiredProperty: string; + nullableProperty: InnerModel[] | null; +} + +export declare interface CollectionsStringGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsStringGetNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsStringOperations { + patchNull: (body: CollectionsStringProperty, options?: CollectionsStringPatchNullOptionalParams) => Promise; + patchNonNull: (body: CollectionsStringProperty, options?: CollectionsStringPatchNonNullOptionalParams) => Promise; + getNull: (options?: CollectionsStringGetNullOptionalParams) => Promise; + getNonNull: (options?: CollectionsStringGetNonNullOptionalParams) => Promise; +} + +export declare interface CollectionsStringPatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsStringPatchNullOptionalParams extends OperationOptions { +} + +export declare interface CollectionsStringProperty { + requiredProperty: string; + nullableProperty: string[] | null; +} + +export declare interface DatetimeGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface DatetimeGetNullOptionalParams extends OperationOptions { +} + +export declare interface DatetimeOperations { + patchNull: (body: DatetimeProperty, options?: DatetimePatchNullOptionalParams) => Promise; + patchNonNull: (body: DatetimeProperty, options?: DatetimePatchNonNullOptionalParams) => Promise; + getNull: (options?: DatetimeGetNullOptionalParams) => Promise; + getNonNull: (options?: DatetimeGetNonNullOptionalParams) => Promise; +} + +export declare interface DatetimePatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface DatetimePatchNullOptionalParams extends OperationOptions { +} + +export declare interface DatetimeProperty { + requiredProperty: string; + nullableProperty: Date | null; +} + +export declare interface DurationGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface DurationGetNullOptionalParams extends OperationOptions { +} + +export declare interface DurationOperations { + patchNull: (body: DurationProperty, options?: DurationPatchNullOptionalParams) => Promise; + patchNonNull: (body: DurationProperty, options?: DurationPatchNonNullOptionalParams) => Promise; + getNull: (options?: DurationGetNullOptionalParams) => Promise; + getNonNull: (options?: DurationGetNonNullOptionalParams) => Promise; +} + +export declare interface DurationPatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface DurationPatchNullOptionalParams extends OperationOptions { +} + +export declare interface DurationProperty { + requiredProperty: string; + nullableProperty: string | null; +} + +export declare interface InnerModel { + property: string; +} + +export declare class NullableClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: NullableClientOptionalParams); + readonly collectionsString: CollectionsStringOperations; + readonly collectionsModel: CollectionsModelOperations; + readonly collectionsByte: CollectionsByteOperations; + readonly duration: DurationOperations; + readonly datetime: DatetimeOperations; + readonly bytes: BytesOperations; + readonly string: StringOperations; +} + +export declare interface NullableClientOptionalParams extends ClientOptions { +} + +export declare interface StringGetNonNullOptionalParams extends OperationOptions { +} + +export declare interface StringGetNullOptionalParams extends OperationOptions { +} + +export declare interface StringOperations { + patchNull: (body: StringProperty, options?: StringPatchNullOptionalParams) => Promise; + patchNonNull: (body: StringProperty, options?: StringPatchNonNullOptionalParams) => Promise; + getNull: (options?: StringGetNullOptionalParams) => Promise; + getNonNull: (options?: StringGetNonNullOptionalParams) => Promise; +} + +export declare interface StringPatchNonNullOptionalParams extends OperationOptions { +} + +export declare interface StringPatchNullOptionalParams extends OperationOptions { +} + +export declare interface StringProperty { + requiredProperty: string; + nullableProperty: string | null; +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/tspconfig.yaml new file mode 100644 index 0000000000..60a9360ef4 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/nullable/tspconfig.yaml @@ -0,0 +1,19 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + # temporary only support legacy client for additional properties in modular + compatibilityMode: true + packageDetails: + name: "@msinternal/nullable-property" + description: "nullable Property Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/src/index.d.ts new file mode 100644 index 0000000000..464c6a85a1 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/src/index.d.ts @@ -0,0 +1,399 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface BooleanLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface BooleanLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface BooleanLiteralOperations { + putDefault: (body: BooleanLiteralProperty, options?: BooleanLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: BooleanLiteralProperty, options?: BooleanLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: BooleanLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: BooleanLiteralGetAllOptionalParams) => Promise; +} + +export declare interface BooleanLiteralProperty { + property?: true; +} + +export declare interface BooleanLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface BooleanLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface BytesGetAllOptionalParams extends OperationOptions { +} + +export declare interface BytesGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface BytesOperations { + putDefault: (body: BytesProperty, options?: BytesPutDefaultOptionalParams) => Promise; + putAll: (body: BytesProperty, options?: BytesPutAllOptionalParams) => Promise; + getDefault: (options?: BytesGetDefaultOptionalParams) => Promise; + getAll: (options?: BytesGetAllOptionalParams) => Promise; +} + +export declare interface BytesProperty { + property?: Uint8Array; +} + +export declare interface BytesPutAllOptionalParams extends OperationOptions { +} + +export declare interface BytesPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface CollectionsByteGetAllOptionalParams extends OperationOptions { +} + +export declare interface CollectionsByteGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface CollectionsByteOperations { + putDefault: (body: CollectionsByteProperty, options?: CollectionsBytePutDefaultOptionalParams) => Promise; + putAll: (body: CollectionsByteProperty, options?: CollectionsBytePutAllOptionalParams) => Promise; + getDefault: (options?: CollectionsByteGetDefaultOptionalParams) => Promise; + getAll: (options?: CollectionsByteGetAllOptionalParams) => Promise; +} + +export declare interface CollectionsByteProperty { + property?: Uint8Array[]; +} + +export declare interface CollectionsBytePutAllOptionalParams extends OperationOptions { +} + +export declare interface CollectionsBytePutDefaultOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelGetAllOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelOperations { + putDefault: (body: CollectionsModelProperty, options?: CollectionsModelPutDefaultOptionalParams) => Promise; + putAll: (body: CollectionsModelProperty, options?: CollectionsModelPutAllOptionalParams) => Promise; + getDefault: (options?: CollectionsModelGetDefaultOptionalParams) => Promise; + getAll: (options?: CollectionsModelGetAllOptionalParams) => Promise; +} + +export declare interface CollectionsModelProperty { + property?: StringProperty[]; +} + +export declare interface CollectionsModelPutAllOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface DatetimeGetAllOptionalParams extends OperationOptions { +} + +export declare interface DatetimeGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface DatetimeOperations { + putDefault: (body: DatetimeProperty, options?: DatetimePutDefaultOptionalParams) => Promise; + putAll: (body: DatetimeProperty, options?: DatetimePutAllOptionalParams) => Promise; + getDefault: (options?: DatetimeGetDefaultOptionalParams) => Promise; + getAll: (options?: DatetimeGetAllOptionalParams) => Promise; +} + +export declare interface DatetimeProperty { + property?: Date; +} + +export declare interface DatetimePutAllOptionalParams extends OperationOptions { +} + +export declare interface DatetimePutDefaultOptionalParams extends OperationOptions { +} + +export declare interface DurationGetAllOptionalParams extends OperationOptions { +} + +export declare interface DurationGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface DurationOperations { + putDefault: (body: DurationProperty, options?: DurationPutDefaultOptionalParams) => Promise; + putAll: (body: DurationProperty, options?: DurationPutAllOptionalParams) => Promise; + getDefault: (options?: DurationGetDefaultOptionalParams) => Promise; + getAll: (options?: DurationGetAllOptionalParams) => Promise; +} + +export declare interface DurationProperty { + property?: string; +} + +export declare interface DurationPutAllOptionalParams extends OperationOptions { +} + +export declare interface DurationPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface FloatLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface FloatLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface FloatLiteralOperations { + putDefault: (body: FloatLiteralProperty, options?: FloatLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: FloatLiteralProperty, options?: FloatLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: FloatLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: FloatLiteralGetAllOptionalParams) => Promise; +} + +export declare interface FloatLiteralProperty { + property?: 1.25; +} + +export declare interface FloatLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface FloatLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface IntLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface IntLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface IntLiteralOperations { + putDefault: (body: IntLiteralProperty, options?: IntLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: IntLiteralProperty, options?: IntLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: IntLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: IntLiteralGetAllOptionalParams) => Promise; +} + +export declare interface IntLiteralProperty { + property?: 1; +} + +export declare interface IntLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface IntLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export declare class OptionalClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: OptionalClientOptionalParams); + readonly requiredAndOptional: RequiredAndOptionalOperations; + readonly unionFloatLiteral: UnionFloatLiteralOperations; + readonly unionIntLiteral: UnionIntLiteralOperations; + readonly unionStringLiteral: UnionStringLiteralOperations; + readonly booleanLiteral: BooleanLiteralOperations; + readonly floatLiteral: FloatLiteralOperations; + readonly intLiteral: IntLiteralOperations; + readonly stringLiteral: StringLiteralOperations; + readonly collectionsModel: CollectionsModelOperations; + readonly collectionsByte: CollectionsByteOperations; + readonly plainTime: PlainTimeOperations; + readonly plainDate: PlainDateOperations; + readonly duration: DurationOperations; + readonly datetime: DatetimeOperations; + readonly bytes: BytesOperations; + readonly string: StringOperations; +} + +export declare interface OptionalClientOptionalParams extends ClientOptions { +} + +export declare interface PlainDateGetAllOptionalParams extends OperationOptions { +} + +export declare interface PlainDateGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface PlainDateOperations { + putDefault: (body: PlainDateProperty, options?: PlainDatePutDefaultOptionalParams) => Promise; + putAll: (body: PlainDateProperty, options?: PlainDatePutAllOptionalParams) => Promise; + getDefault: (options?: PlainDateGetDefaultOptionalParams) => Promise; + getAll: (options?: PlainDateGetAllOptionalParams) => Promise; +} + +export declare interface PlainDateProperty { + property?: string; +} + +export declare interface PlainDatePutAllOptionalParams extends OperationOptions { +} + +export declare interface PlainDatePutDefaultOptionalParams extends OperationOptions { +} + +export declare interface PlainTimeGetAllOptionalParams extends OperationOptions { +} + +export declare interface PlainTimeGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface PlainTimeOperations { + putDefault: (body: PlainTimeProperty, options?: PlainTimePutDefaultOptionalParams) => Promise; + putAll: (body: PlainTimeProperty, options?: PlainTimePutAllOptionalParams) => Promise; + getDefault: (options?: PlainTimeGetDefaultOptionalParams) => Promise; + getAll: (options?: PlainTimeGetAllOptionalParams) => Promise; +} + +export declare interface PlainTimeProperty { + property?: string; +} + +export declare interface PlainTimePutAllOptionalParams extends OperationOptions { +} + +export declare interface PlainTimePutDefaultOptionalParams extends OperationOptions { +} + +export declare interface RequiredAndOptionalGetAllOptionalParams extends OperationOptions { +} + +export declare interface RequiredAndOptionalGetRequiredOnlyOptionalParams extends OperationOptions { +} + +export declare interface RequiredAndOptionalOperations { + putRequiredOnly: (body: RequiredAndOptionalProperty, options?: RequiredAndOptionalPutRequiredOnlyOptionalParams) => Promise; + putAll: (body: RequiredAndOptionalProperty, options?: RequiredAndOptionalPutAllOptionalParams) => Promise; + getRequiredOnly: (options?: RequiredAndOptionalGetRequiredOnlyOptionalParams) => Promise; + getAll: (options?: RequiredAndOptionalGetAllOptionalParams) => Promise; +} + +export declare interface RequiredAndOptionalProperty { + optionalProperty?: string; + requiredProperty: number; +} + +export declare interface RequiredAndOptionalPutAllOptionalParams extends OperationOptions { +} + +export declare interface RequiredAndOptionalPutRequiredOnlyOptionalParams extends OperationOptions { +} + +export declare interface StringGetAllOptionalParams extends OperationOptions { +} + +export declare interface StringGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface StringLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface StringLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface StringLiteralOperations { + putDefault: (body: StringLiteralProperty, options?: StringLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: StringLiteralProperty, options?: StringLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: StringLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: StringLiteralGetAllOptionalParams) => Promise; +} + +export declare interface StringLiteralProperty { + property?: "hello"; +} + +export declare interface StringLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface StringLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface StringOperations { + putDefault: (body: StringProperty, options?: StringPutDefaultOptionalParams) => Promise; + putAll: (body: StringProperty, options?: StringPutAllOptionalParams) => Promise; + getDefault: (options?: StringGetDefaultOptionalParams) => Promise; + getAll: (options?: StringGetAllOptionalParams) => Promise; +} + +export declare interface StringProperty { + property?: string; +} + +export declare interface StringPutAllOptionalParams extends OperationOptions { +} + +export declare interface StringPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface UnionFloatLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface UnionFloatLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface UnionFloatLiteralOperations { + putDefault: (body: UnionFloatLiteralProperty, options?: UnionFloatLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: UnionFloatLiteralProperty, options?: UnionFloatLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: UnionFloatLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: UnionFloatLiteralGetAllOptionalParams) => Promise; +} + +export declare interface UnionFloatLiteralProperty { + property?: 1.25 | 2.375; +} + +export declare interface UnionFloatLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface UnionFloatLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface UnionIntLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface UnionIntLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface UnionIntLiteralOperations { + putDefault: (body: UnionIntLiteralProperty, options?: UnionIntLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: UnionIntLiteralProperty, options?: UnionIntLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: UnionIntLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: UnionIntLiteralGetAllOptionalParams) => Promise; +} + +export declare interface UnionIntLiteralProperty { + property?: 1 | 2; +} + +export declare interface UnionIntLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface UnionIntLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export declare interface UnionStringLiteralGetAllOptionalParams extends OperationOptions { +} + +export declare interface UnionStringLiteralGetDefaultOptionalParams extends OperationOptions { +} + +export declare interface UnionStringLiteralOperations { + putDefault: (body: UnionStringLiteralProperty, options?: UnionStringLiteralPutDefaultOptionalParams) => Promise; + putAll: (body: UnionStringLiteralProperty, options?: UnionStringLiteralPutAllOptionalParams) => Promise; + getDefault: (options?: UnionStringLiteralGetDefaultOptionalParams) => Promise; + getAll: (options?: UnionStringLiteralGetAllOptionalParams) => Promise; +} + +export declare interface UnionStringLiteralProperty { + property?: "hello" | "world"; +} + +export declare interface UnionStringLiteralPutAllOptionalParams extends OperationOptions { +} + +export declare interface UnionStringLiteralPutDefaultOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/tspconfig.yaml new file mode 100644 index 0000000000..23e4bfa4b0 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/optionality/tspconfig.yaml @@ -0,0 +1,19 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + enableOperationGroup: true + isModularLibrary: true + # temporary only support legacy client for additional properties in modular + compatibilityMode: true + packageDetails: + name: "@msinternal/optional-property" + description: "Optional Property Test Service" + version: "1.0.0" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/src/index.d.ts new file mode 100644 index 0000000000..857c4d2a2e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/src/index.d.ts @@ -0,0 +1,487 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface BooleanGetOptionalParams extends OperationOptions { +} + +export declare interface BooleanLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface BooleanLiteralOperations { + put: (body: BooleanLiteralProperty, options?: BooleanLiteralPutOptionalParams) => Promise; + get: (options?: BooleanLiteralGetOptionalParams) => Promise; +} + +export declare interface BooleanLiteralProperty { + property: true; +} + +export declare interface BooleanLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface BooleanOperations { + put: (body: BooleanProperty, options?: BooleanPutOptionalParams) => Promise; + get: (options?: BooleanGetOptionalParams) => Promise; +} + +export declare interface BooleanProperty { + property: boolean; +} + +export declare interface BooleanPutOptionalParams extends OperationOptions { +} + +export declare interface BytesGetOptionalParams extends OperationOptions { +} + +export declare interface BytesOperations { + put: (body: BytesProperty, options?: BytesPutOptionalParams) => Promise; + get: (options?: BytesGetOptionalParams) => Promise; +} + +export declare interface BytesProperty { + property: Uint8Array; +} + +export declare interface BytesPutOptionalParams extends OperationOptions { +} + +export declare interface CollectionsIntGetOptionalParams extends OperationOptions { +} + +export declare interface CollectionsIntOperations { + put: (body: CollectionsIntProperty, options?: CollectionsIntPutOptionalParams) => Promise; + get: (options?: CollectionsIntGetOptionalParams) => Promise; +} + +export declare interface CollectionsIntProperty { + property: number[]; +} + +export declare interface CollectionsIntPutOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelGetOptionalParams extends OperationOptions { +} + +export declare interface CollectionsModelOperations { + put: (body: CollectionsModelProperty, options?: CollectionsModelPutOptionalParams) => Promise; + get: (options?: CollectionsModelGetOptionalParams) => Promise; +} + +export declare interface CollectionsModelProperty { + property: InnerModel[]; +} + +export declare interface CollectionsModelPutOptionalParams extends OperationOptions { +} + +export declare interface CollectionsStringGetOptionalParams extends OperationOptions { +} + +export declare interface CollectionsStringOperations { + put: (body: CollectionsStringProperty, options?: CollectionsStringPutOptionalParams) => Promise; + get: (options?: CollectionsStringGetOptionalParams) => Promise; +} + +export declare interface CollectionsStringProperty { + property: string[]; +} + +export declare interface CollectionsStringPutOptionalParams extends OperationOptions { +} + +export declare interface DatetimeGetOptionalParams extends OperationOptions { +} + +export declare interface DatetimeOperations { + put: (body: DatetimeProperty, options?: DatetimePutOptionalParams) => Promise; + get: (options?: DatetimeGetOptionalParams) => Promise; +} + +export declare interface DatetimeProperty { + property: Date; +} + +export declare interface DatetimePutOptionalParams extends OperationOptions { +} + +export declare interface Decimal128GetOptionalParams extends OperationOptions { +} + +export declare interface Decimal128Operations { + put: (body: Decimal128Property, options?: Decimal128PutOptionalParams) => Promise; + get: (options?: Decimal128GetOptionalParams) => Promise; +} + +export declare interface Decimal128Property { + property: number; +} + +export declare interface Decimal128PutOptionalParams extends OperationOptions { +} + +export declare interface DecimalGetOptionalParams extends OperationOptions { +} + +export declare interface DecimalOperations { + put: (body: DecimalProperty, options?: DecimalPutOptionalParams) => Promise; + get: (options?: DecimalGetOptionalParams) => Promise; +} + +export declare interface DecimalProperty { + property: number; +} + +export declare interface DecimalPutOptionalParams extends OperationOptions { +} + +export declare interface DictionaryStringGetOptionalParams extends OperationOptions { +} + +export declare interface DictionaryStringOperations { + put: (body: DictionaryStringProperty, options?: DictionaryStringPutOptionalParams) => Promise; + get: (options?: DictionaryStringGetOptionalParams) => Promise; +} + +export declare interface DictionaryStringProperty { + property: Record; +} + +export declare interface DictionaryStringPutOptionalParams extends OperationOptions { +} + +export declare interface DurationGetOptionalParams extends OperationOptions { +} + +export declare interface DurationOperations { + put: (body: DurationProperty, options?: DurationPutOptionalParams) => Promise; + get: (options?: DurationGetOptionalParams) => Promise; +} + +export declare interface DurationProperty { + property: string; +} + +export declare interface DurationPutOptionalParams extends OperationOptions { +} + +export declare interface EnumGetOptionalParams extends OperationOptions { +} + +export declare interface EnumOperations { + put: (body: EnumProperty, options?: EnumPutOptionalParams) => Promise; + get: (options?: EnumGetOptionalParams) => Promise; +} + +export declare interface EnumProperty { + property: FixedInnerEnum; +} + +export declare interface EnumPutOptionalParams extends OperationOptions { +} + +export declare type ExtendedEnum = "value2"; + +export declare interface ExtensibleEnumGetOptionalParams extends OperationOptions { +} + +export declare interface ExtensibleEnumOperations { + put: (body: ExtensibleEnumProperty, options?: ExtensibleEnumPutOptionalParams) => Promise; + get: (options?: ExtensibleEnumGetOptionalParams) => Promise; +} + +export declare interface ExtensibleEnumProperty { + property: InnerEnum; +} + +export declare interface ExtensibleEnumPutOptionalParams extends OperationOptions { +} + +export declare type FixedInnerEnum = "ValueOne" | "ValueTwo"; + +export declare interface FloatGetOptionalParams extends OperationOptions { +} + +export declare interface FloatLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface FloatLiteralOperations { + put: (body: FloatLiteralProperty, options?: FloatLiteralPutOptionalParams) => Promise; + get: (options?: FloatLiteralGetOptionalParams) => Promise; +} + +export declare interface FloatLiteralProperty { + property: 43.125; +} + +export declare interface FloatLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface FloatOperations { + put: (body: FloatProperty, options?: FloatPutOptionalParams) => Promise; + get: (options?: FloatGetOptionalParams) => Promise; +} + +export declare interface FloatProperty { + property: number; +} + +export declare interface FloatPutOptionalParams extends OperationOptions { +} + +export declare type InnerEnum = "ValueOne" | "ValueTwo"; + +export declare interface InnerModel { + property: string; +} + +export declare interface IntGetOptionalParams extends OperationOptions { +} + +export declare interface IntLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface IntLiteralOperations { + put: (body: IntLiteralProperty, options?: IntLiteralPutOptionalParams) => Promise; + get: (options?: IntLiteralGetOptionalParams) => Promise; +} + +export declare interface IntLiteralProperty { + property: 42; +} + +export declare interface IntLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface IntOperations { + put: (body: IntProperty, options?: IntPutOptionalParams) => Promise; + get: (options?: IntGetOptionalParams) => Promise; +} + +export declare interface IntProperty { + property: number; +} + +export declare interface IntPutOptionalParams extends OperationOptions { +} + +export declare interface ModelGetOptionalParams extends OperationOptions { +} + +export declare interface ModelOperations { + put: (body: ModelProperty, options?: ModelPutOptionalParams) => Promise; + get: (options?: ModelGetOptionalParams) => Promise; +} + +export declare interface ModelProperty { + property: InnerModel; +} + +export declare interface ModelPutOptionalParams extends OperationOptions { +} + +export declare interface NeverGetOptionalParams extends OperationOptions { +} + +export declare interface NeverOperations { + put: (body: NeverProperty, options?: NeverPutOptionalParams) => Promise; + get: (options?: NeverGetOptionalParams) => Promise; +} + +export declare interface NeverProperty { +} + +export declare interface NeverPutOptionalParams extends OperationOptions { +} + +export declare interface StringGetOptionalParams extends OperationOptions { +} + +export declare interface StringLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface StringLiteralOperations { + put: (body: StringLiteralProperty, options?: StringLiteralPutOptionalParams) => Promise; + get: (options?: StringLiteralGetOptionalParams) => Promise; +} + +export declare interface StringLiteralProperty { + property: "hello"; +} + +export declare interface StringLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface StringOperations { + put: (body: StringProperty, options?: StringPutOptionalParams) => Promise; + get: (options?: StringGetOptionalParams) => Promise; +} + +export declare interface StringProperty { + property: string; +} + +export declare interface StringPutOptionalParams extends OperationOptions { +} + +export declare interface UnionEnumValueGetOptionalParams extends OperationOptions { +} + +export declare interface UnionEnumValueOperations { + put: (body: UnionEnumValueProperty, options?: UnionEnumValuePutOptionalParams) => Promise; + get: (options?: UnionEnumValueGetOptionalParams) => Promise; +} + +export declare interface UnionEnumValueProperty { + property: "value2"; +} + +export declare interface UnionEnumValuePutOptionalParams extends OperationOptions { +} + +export declare interface UnionFloatLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface UnionFloatLiteralOperations { + put: (body: UnionFloatLiteralProperty, options?: UnionFloatLiteralPutOptionalParams) => Promise; + get: (options?: UnionFloatLiteralGetOptionalParams) => Promise; +} + +export declare interface UnionFloatLiteralProperty { + property: 43.125 | 46.875; +} + +export declare interface UnionFloatLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface UnionIntLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface UnionIntLiteralOperations { + put: (body: UnionIntLiteralProperty, options?: UnionIntLiteralPutOptionalParams) => Promise; + get: (options?: UnionIntLiteralGetOptionalParams) => Promise; +} + +export declare interface UnionIntLiteralProperty { + property: 42 | 43; +} + +export declare interface UnionIntLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface UnionStringLiteralGetOptionalParams extends OperationOptions { +} + +export declare interface UnionStringLiteralOperations { + put: (body: UnionStringLiteralProperty, options?: UnionStringLiteralPutOptionalParams) => Promise; + get: (options?: UnionStringLiteralGetOptionalParams) => Promise; +} + +export declare interface UnionStringLiteralProperty { + property: "hello" | "world"; +} + +export declare interface UnionStringLiteralPutOptionalParams extends OperationOptions { +} + +export declare interface UnknownArrayGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownArrayOperations { + put: (body: UnknownArrayProperty, options?: UnknownArrayPutOptionalParams) => Promise; + get: (options?: UnknownArrayGetOptionalParams) => Promise; +} + +export declare interface UnknownArrayProperty { + property: any; +} + +export declare interface UnknownArrayPutOptionalParams extends OperationOptions { +} + +export declare interface UnknownDictGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownDictOperations { + put: (body: UnknownDictProperty, options?: UnknownDictPutOptionalParams) => Promise; + get: (options?: UnknownDictGetOptionalParams) => Promise; +} + +export declare interface UnknownDictProperty { + property: any; +} + +export declare interface UnknownDictPutOptionalParams extends OperationOptions { +} + +export declare interface UnknownIntGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownIntOperations { + put: (body: UnknownIntProperty, options?: UnknownIntPutOptionalParams) => Promise; + get: (options?: UnknownIntGetOptionalParams) => Promise; +} + +export declare interface UnknownIntProperty { + property: any; +} + +export declare interface UnknownIntPutOptionalParams extends OperationOptions { +} + +export declare interface UnknownStringGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownStringOperations { + put: (body: UnknownStringProperty, options?: UnknownStringPutOptionalParams) => Promise; + get: (options?: UnknownStringGetOptionalParams) => Promise; +} + +export declare interface UnknownStringProperty { + property: any; +} + +export declare interface UnknownStringPutOptionalParams extends OperationOptions { +} + +export declare class ValueTypesClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: ValueTypesClientOptionalParams); + readonly unionEnumValue: UnionEnumValueOperations; + readonly unionFloatLiteral: UnionFloatLiteralOperations; + readonly unionIntLiteral: UnionIntLiteralOperations; + readonly unionStringLiteral: UnionStringLiteralOperations; + readonly booleanLiteral: BooleanLiteralOperations; + readonly floatLiteral: FloatLiteralOperations; + readonly intLiteral: IntLiteralOperations; + readonly stringLiteral: StringLiteralOperations; + readonly unknownArray: UnknownArrayOperations; + readonly unknownDict: UnknownDictOperations; + readonly unknownInt: UnknownIntOperations; + readonly unknownString: UnknownStringOperations; + readonly never: NeverOperations; + readonly dictionaryString: DictionaryStringOperations; + readonly collectionsModel: CollectionsModelOperations; + readonly collectionsInt: CollectionsIntOperations; + readonly collectionsString: CollectionsStringOperations; + readonly model: ModelOperations; + readonly extensibleEnum: ExtensibleEnumOperations; + readonly enum: EnumOperations; + readonly duration: DurationOperations; + readonly datetime: DatetimeOperations; + readonly decimal128: Decimal128Operations; + readonly decimal: DecimalOperations; + readonly float: FloatOperations; + readonly int: IntOperations; + readonly bytes: BytesOperations; + readonly string: StringOperations; + readonly boolean: BooleanOperations; +} + +export declare interface ValueTypesClientOptionalParams extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/tspconfig.yaml new file mode 100644 index 0000000000..aa4a62521b --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/property/value-types/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + generateMetadata: true + generateTest: false + flavor: azure + azureSdkForJs: false + isModularLibrary: true + hierarchyClient: false + "emitter-output-dir": "{project-root}" + packageDetails: + name: "@msinternal/modular-model-propertyTypes" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/src/index.d.ts new file mode 100644 index 0000000000..8c32ce0c65 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/src/index.d.ts @@ -0,0 +1,106 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface BooleanGetOptionalParams extends OperationOptions { +} + +export declare interface BooleanOperations { + put: (body: boolean, options?: BooleanPutOptionalParams) => Promise; + get: (options?: BooleanGetOptionalParams) => Promise; +} + +export declare interface BooleanPutOptionalParams extends OperationOptions { +} + +export declare interface Decimal128TypeOperations { + requestParameter: (value: number, options?: Decimal128TypeRequestParameterOptionalParams) => Promise; + requestBody: (body: number, options?: Decimal128TypeRequestBodyOptionalParams) => Promise; + responseBody: (options?: Decimal128TypeResponseBodyOptionalParams) => Promise; +} + +export declare interface Decimal128TypeRequestBodyOptionalParams extends OperationOptions { +} + +export declare interface Decimal128TypeRequestParameterOptionalParams extends OperationOptions { +} + +export declare interface Decimal128TypeResponseBodyOptionalParams extends OperationOptions { +} + +export declare interface Decimal128VerifyOperations { + verify: (body: number, options?: Decimal128VerifyVerifyOptionalParams) => Promise; + prepareVerify: (options?: Decimal128VerifyPrepareVerifyOptionalParams) => Promise; +} + +export declare interface Decimal128VerifyPrepareVerifyOptionalParams extends OperationOptions { +} + +export declare interface Decimal128VerifyVerifyOptionalParams extends OperationOptions { +} + +export declare interface DecimalTypeOperations { + requestParameter: (value: number, options?: DecimalTypeRequestParameterOptionalParams) => Promise; + requestBody: (body: number, options?: DecimalTypeRequestBodyOptionalParams) => Promise; + responseBody: (options?: DecimalTypeResponseBodyOptionalParams) => Promise; +} + +export declare interface DecimalTypeRequestBodyOptionalParams extends OperationOptions { +} + +export declare interface DecimalTypeRequestParameterOptionalParams extends OperationOptions { +} + +export declare interface DecimalTypeResponseBodyOptionalParams extends OperationOptions { +} + +export declare interface DecimalVerifyOperations { + verify: (body: number, options?: DecimalVerifyVerifyOptionalParams) => Promise; + prepareVerify: (options?: DecimalVerifyPrepareVerifyOptionalParams) => Promise; +} + +export declare interface DecimalVerifyPrepareVerifyOptionalParams extends OperationOptions { +} + +export declare interface DecimalVerifyVerifyOptionalParams extends OperationOptions { +} + +export declare class ScalarClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: ScalarClientOptionalParams); + readonly decimal128Verify: Decimal128VerifyOperations; + readonly decimalVerify: DecimalVerifyOperations; + readonly decimal128Type: Decimal128TypeOperations; + readonly decimalType: DecimalTypeOperations; + readonly unknown: UnknownOperations; + readonly boolean: BooleanOperations; + readonly string: StringOperations; +} + +export declare interface ScalarClientOptionalParams extends ClientOptions { +} + +export declare interface StringGetOptionalParams extends OperationOptions { +} + +export declare interface StringOperations { + put: (body: string, options?: StringPutOptionalParams) => Promise; + get: (options?: StringGetOptionalParams) => Promise; +} + +export declare interface StringPutOptionalParams extends OperationOptions { +} + +export declare interface UnknownGetOptionalParams extends OperationOptions { +} + +export declare interface UnknownOperations { + put: (body: any, options?: UnknownPutOptionalParams) => Promise; + get: (options?: UnknownGetOptionalParams) => Promise; +} + +export declare interface UnknownPutOptionalParams extends OperationOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/tspconfig.yaml new file mode 100644 index 0000000000..040e88f25a --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/scalar/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: ScalarClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/scalar" + description: "Scalar client" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/union/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/type/union/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/union/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/type/union/src/index.d.ts new file mode 100644 index 0000000000..92dfc0452b --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/union/src/index.d.ts @@ -0,0 +1,194 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface Cat { + name: string; +} + +export declare interface Dog { + bark: string; +} + +export declare interface EnumsOnlyCases { + lr: "left" | "right" | "up" | "down"; + ud: "up" | "down"; +} + +export declare interface EnumsOnlyGetOptionalParams extends OperationOptions { +} + +export declare interface EnumsOnlyOperations { + send: (prop: EnumsOnlyCases, options?: EnumsOnlySendOptionalParams) => Promise; + get: (options?: EnumsOnlyGetOptionalParams) => Promise<{ + prop: EnumsOnlyCases; + }>; +} + +export declare interface EnumsOnlySendOptionalParams extends OperationOptions { +} + +export declare interface FloatsOnlyGetOptionalParams extends OperationOptions { +} + +export declare interface FloatsOnlyOperations { + send: (prop: 1.1 | 2.2 | 3.3, options?: FloatsOnlySendOptionalParams) => Promise; + get: (options?: FloatsOnlyGetOptionalParams) => Promise<{ + prop: 1.1 | 2.2 | 3.3; + }>; +} + +export declare interface FloatsOnlySendOptionalParams extends OperationOptions { +} + +export declare interface IntsOnlyGetOptionalParams extends OperationOptions { +} + +export declare interface IntsOnlyOperations { + send: (prop: 1 | 2 | 3, options?: IntsOnlySendOptionalParams) => Promise; + get: (options?: IntsOnlyGetOptionalParams) => Promise<{ + prop: 1 | 2 | 3; + }>; +} + +export declare interface IntsOnlySendOptionalParams extends OperationOptions { +} + +export declare enum KnownStringExtensibleNamedUnion { + OptionB = "b", + c = "c" +} + +export declare interface MixedLiteralsCases { + stringLiteral: "a" | 2 | 3.3 | true; + intLiteral: "a" | 2 | 3.3 | true; + floatLiteral: "a" | 2 | 3.3 | true; + booleanLiteral: "a" | 2 | 3.3 | true; +} + +export declare interface MixedLiteralsGetOptionalParams extends OperationOptions { +} + +export declare interface MixedLiteralsOperations { + send: (prop: MixedLiteralsCases, options?: MixedLiteralsSendOptionalParams) => Promise; + get: (options?: MixedLiteralsGetOptionalParams) => Promise<{ + prop: MixedLiteralsCases; + }>; +} + +export declare interface MixedLiteralsSendOptionalParams extends OperationOptions { +} + +export declare interface MixedTypesCases { + model: Cat | "a" | number | boolean; + literal: Cat | "a" | number | boolean; + int: Cat | "a" | number | boolean; + boolean: Cat | "a" | number | boolean; + array: (Cat | "a" | number | boolean)[]; +} + +export declare interface MixedTypesGetOptionalParams extends OperationOptions { +} + +export declare interface MixedTypesOperations { + send: (prop: MixedTypesCases, options?: MixedTypesSendOptionalParams) => Promise; + get: (options?: MixedTypesGetOptionalParams) => Promise<{ + prop: MixedTypesCases; + }>; +} + +export declare interface MixedTypesSendOptionalParams extends OperationOptions { +} + +export declare interface ModelsOnlyGetOptionalParams extends OperationOptions { +} + +export declare interface ModelsOnlyOperations { + send: (prop: Cat | Dog, options?: ModelsOnlySendOptionalParams) => Promise; + get: (options?: ModelsOnlyGetOptionalParams) => Promise<{ + prop: Cat | Dog; + }>; +} + +export declare interface ModelsOnlySendOptionalParams extends OperationOptions { +} + +export declare interface StringAndArrayCases { + string: string | string[]; + array: string | string[]; +} + +export declare interface StringAndArrayGetOptionalParams extends OperationOptions { +} + +export declare interface StringAndArrayOperations { + send: (prop: StringAndArrayCases, options?: StringAndArraySendOptionalParams) => Promise; + get: (options?: StringAndArrayGetOptionalParams) => Promise<{ + prop: StringAndArrayCases; + }>; +} + +export declare interface StringAndArraySendOptionalParams extends OperationOptions { +} + +export declare interface StringExtensibleGetOptionalParams extends OperationOptions { +} + +export declare interface StringExtensibleNamedGetOptionalParams extends OperationOptions { +} + +export declare interface StringExtensibleNamedOperations { + send: (prop: StringExtensibleNamedUnion, options?: StringExtensibleNamedSendOptionalParams) => Promise; + get: (options?: StringExtensibleNamedGetOptionalParams) => Promise<{ + prop: StringExtensibleNamedUnion; + }>; +} + +export declare interface StringExtensibleNamedSendOptionalParams extends OperationOptions { +} + +export declare type StringExtensibleNamedUnion = string; + +export declare interface StringExtensibleOperations { + send: (prop: string, options?: StringExtensibleSendOptionalParams) => Promise; + get: (options?: StringExtensibleGetOptionalParams) => Promise<{ + prop: string; + }>; +} + +export declare interface StringExtensibleSendOptionalParams extends OperationOptions { +} + +export declare interface StringsOnlyGetOptionalParams extends OperationOptions { +} + +export declare interface StringsOnlyOperations { + send: (prop: "a" | "b" | "c", options?: StringsOnlySendOptionalParams) => Promise; + get: (options?: StringsOnlyGetOptionalParams) => Promise<{ + prop: "a" | "b" | "c"; + }>; +} + +export declare interface StringsOnlySendOptionalParams extends OperationOptions { +} + +export declare class UnionClient { + private _client; + readonly pipeline: Pipeline; + constructor(options?: UnionClientOptionalParams); + readonly mixedTypes: MixedTypesOperations; + readonly mixedLiterals: MixedLiteralsOperations; + readonly stringAndArray: StringAndArrayOperations; + readonly enumsOnly: EnumsOnlyOperations; + readonly modelsOnly: ModelsOnlyOperations; + readonly floatsOnly: FloatsOnlyOperations; + readonly intsOnly: IntsOnlyOperations; + readonly stringExtensibleNamed: StringExtensibleNamedOperations; + readonly stringExtensible: StringExtensibleOperations; + readonly stringsOnly: StringsOnlyOperations; +} + +export declare interface UnionClientOptionalParams extends ClientOptions { +} + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/type/union/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/type/union/tspconfig.yaml new file mode 100644 index 0000000000..5ffaa09a82 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/type/union/tspconfig.yaml @@ -0,0 +1,18 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: UnionClient + isModularLibrary: true + hierarchyClient: false + experimentalExtensibleEnums: true + packageDetails: + name: "@msinternal/union" + description: "Union client" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/src/index.d.ts new file mode 100644 index 0000000000..94789a31a6 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/src/index.d.ts @@ -0,0 +1,48 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class AddedClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, version: Versions, options?: AddedClientOptionalParams); + v2InInterface(body: ModelV2, options?: V2InInterfaceOptionalParams): Promise; + v2(body: ModelV2, options?: V2OptionalParams): Promise; + v1(body: ModelV1, headerV2: string, options?: V1OptionalParams): Promise; +} + +export declare interface AddedClientOptionalParams extends ClientOptions { +} + +export declare type EnumV1 = "enumMemberV1" | "enumMemberV2"; + +export declare type EnumV2 = "enumMember"; + +export declare interface ModelV1 { + prop: string; + enumProp: EnumV1; + unionProp: UnionV1; +} + +export declare interface ModelV2 { + prop: string; + enumProp: EnumV2; + unionProp: UnionV2; +} + +export declare type UnionV1 = string | number; + +export declare type UnionV2 = string | number; + +export declare interface V1OptionalParams extends OperationOptions { +} + +export declare interface V2InInterfaceOptionalParams extends OperationOptions { +} + +export declare interface V2OptionalParams extends OperationOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/tspconfig.yaml new file mode 100644 index 0000000000..1670e3e148 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/added/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersioningAddedClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versionning-added" + description: "Versioning Added Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/src/index.d.ts new file mode 100644 index 0000000000..329eb2b8a6 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/src/index.d.ts @@ -0,0 +1,26 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class MadeOptionalClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, version: Versions, options?: MadeOptionalClientOptionalParams); + test(body: TestModel, options?: TestOptionalParams): Promise; +} + +export declare interface MadeOptionalClientOptionalParams extends ClientOptions { +} + +export declare interface TestModel { + prop: string; + changedProp?: string; +} + +export declare interface TestOptionalParams extends OperationOptions { + param?: string; +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/tspconfig.yaml new file mode 100644 index 0000000000..2c5ce7c3ef --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/madeOptional/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersioningMadeOptionalClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versionning-madeOptional" + description: "Versioning MadeOptional Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/src/index.d.ts new file mode 100644 index 0000000000..03b965f7ce --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/src/index.d.ts @@ -0,0 +1,41 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare type EnumV2 = "enumMemberV2"; + +export declare type EnumV3 = "enumMemberV1" | "enumMemberV2Preview"; + +export declare interface ModelV2 { + prop: string; + enumProp: EnumV2; + unionProp: UnionV2; +} + +export declare interface ModelV3 { + id: string; + enumProp: EnumV3; +} + +export declare interface ModelV3OptionalParams extends OperationOptions { +} + +export declare class RemovedClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, version: Versions, options?: RemovedClientOptionalParams); + modelV3(body: ModelV3, options?: ModelV3OptionalParams): Promise; + v2(body: ModelV2, options?: V2OptionalParams): Promise; +} + +export declare interface RemovedClientOptionalParams extends ClientOptions { +} + +export declare type UnionV2 = string | number; + +export declare interface V2OptionalParams extends OperationOptions { +} + +export declare type Versions = "v1" | "v2preview" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/tspconfig.yaml new file mode 100644 index 0000000000..d19da6e2f0 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/removed/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersioningRemovedClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versionning-removed" + description: "Versioning Removed Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/src/index.d.ts new file mode 100644 index 0000000000..f1ed550f89 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/src/index.d.ts @@ -0,0 +1,34 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare type NewEnum = "newEnumMember"; + +export declare interface NewModel { + newProp: string; + enumProp: NewEnum; + unionProp: NewUnion; +} + +export declare interface NewOpInNewInterfaceOptionalParams extends OperationOptions { +} + +export declare interface NewOpOptionalParams extends OperationOptions { +} + +export declare type NewUnion = string | number; + +export declare class RenamedFromClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, version: Versions, options?: RenamedFromClientOptionalParams); + newOpInNewInterface(body: NewModel, options?: NewOpInNewInterfaceOptionalParams): Promise; + newOp(body: NewModel, newQuery: string, options?: NewOpOptionalParams): Promise; +} + +export declare interface RenamedFromClientOptionalParams extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/tspconfig.yaml new file mode 100644 index 0000000000..41d502400e --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/renamedFrom/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersioningRenamedFromClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versionning-renamedFrom" + description: "Versioning Renamed Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts new file mode 100644 index 0000000000..ada90270f7 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts @@ -0,0 +1,20 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare class ReturnTypeChangedFromClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, version: Versions, options?: ReturnTypeChangedFromClientOptionalParams); + test(body: string, options?: TestOptionalParams): Promise; +} + +export declare interface ReturnTypeChangedFromClientOptionalParams extends ClientOptions { +} + +export declare interface TestOptionalParams extends OperationOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml new file mode 100644 index 0000000000..97013782df --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersioningReturnTypeChangedFromClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versionning-returnTypeChangedFrom" + description: "Versioning ReturnTypeChanged Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/.gitignore b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/.gitignore new file mode 100644 index 0000000000..39220655cc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/.gitignore @@ -0,0 +1,6 @@ +/** +!/src +/src/** +!/src/index.d.ts +!/.gitignore +!/tspconfig.yaml diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts new file mode 100644 index 0000000000..59c28ab532 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts @@ -0,0 +1,25 @@ +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; + +export declare interface TestModel { + prop: string; + changedProp: string; +} + +export declare interface TestOptionalParams extends OperationOptions { +} + +export declare class TypeChangedFromClient { + private _client; + readonly pipeline: Pipeline; + constructor(endpointParam: string, version: Versions, options?: TypeChangedFromClientOptionalParams); + test(body: TestModel, param: string, options?: TestOptionalParams): Promise; +} + +export declare interface TypeChangedFromClientOptionalParams extends ClientOptions { +} + +export declare type Versions = "v1" | "v2"; + +export { } diff --git a/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml new file mode 100644 index 0000000000..93de534504 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml @@ -0,0 +1,17 @@ +emit: + - "@azure-tools/typespec-ts" +options: + "@azure-tools/typespec-ts": + "emitter-output-dir": "{project-root}" + generateMetadata: true + generateTest: false + addCredentials: false + flavor: azure + azureSdkForJs: false + isTypeSpecTest: true + title: VersioningTypeChangedFromClient + isModularLibrary: true + hierarchyClient: false + packageDetails: + name: "@msinternal/versionning-typeChangedFrom" + description: "Versioning TypeChanged Test Service" diff --git a/packages/typespec-ts/test/azureModularIntegration/headersRepeatability.spec.ts b/packages/typespec-ts/test/azureModularIntegration/headersRepeatability.spec.ts new file mode 100644 index 0000000000..cc0ab0c5da --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/headersRepeatability.spec.ts @@ -0,0 +1,22 @@ +import { RepeatabilityClient } from "./generated/special-headers/repeatability/src/index.js"; +import { assert } from "chai"; + +describe("Repeatability Client", () => { + let client: RepeatabilityClient; + + beforeEach(() => { + client = new RepeatabilityClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should add client-request-id and date in header", async () => { + const requestID = "86aede1f-96fa-4e7f-b1e1-bf8a947cb804"; + const result = await client.immediateSuccess( + requestID, + new Date("Mon, 13 Nov 2023 14:38:00 GMT") + ); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/lroRpc.spec.ts b/packages/typespec-ts/test/azureModularIntegration/lroRpc.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/lroRpc.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/lroRpc.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/lroStardard.spec.ts b/packages/typespec-ts/test/azureModularIntegration/lroStardard.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/lroStardard.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/lroStardard.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/modelFlatten.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelFlatten.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/modelFlatten.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/modelFlatten.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/modelInheritanceEnumDiscriminator.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceEnumDiscriminator.spec.ts new file mode 100644 index 0000000000..037e62dd5c --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceEnumDiscriminator.spec.ts @@ -0,0 +1,67 @@ +import { + EnumDiscriminatorClient, + Snake, + Golden +} from "./generated/type/model/inheritance/enum-discriminator/src/index.js"; +import { assert } from "chai"; + +describe("EnumDiscriminatorClient Rest Client", () => { + let client: EnumDiscriminatorClient; + + beforeEach(() => { + client = new EnumDiscriminatorClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + const validBody: Golden = { + weight: 10, + kind: "golden" + }; + const validFixedEnumBody: Snake = { + length: 10, + kind: "cobra" + }; + it("should get extensible enum", async () => { + const result = await client.getExtensibleModel(); + assert.deepEqual(result, validBody); + }); + + it("should put extensible enum", async () => { + const result = await client.putExtensibleModel(validBody); + assert.isUndefined(result); + }); + + it("should get extensible enum if missing discriminator", async () => { + const result = await client.getExtensibleModelMissingDiscriminator(); + assert.deepEqual(result.weight, 10); + assert.isUndefined(result.kind); + }); + + it("should get extensible enum if wrong discriminator", async () => { + const result = await client.getExtensibleModelWrongDiscriminator(); + assert.deepEqual(result, { weight: 8, kind: "wrongKind" }); + }); + + it("should get fixed enum", async () => { + const result = await client.getFixedModel(); + assert.deepEqual(result, validFixedEnumBody); + }); + + it("should put fixed enum", async () => { + const result = await client.putFixedModel(validFixedEnumBody); + assert.isUndefined(result); + }); + + it("should get fixed enum if missing discriminator", async () => { + const result = await client.getFixedModelMissingDiscriminator(); + assert.deepEqual(result.length, 10); + assert.isUndefined(result.kind); + }); + + it("should get fixed enum if wrong discriminator", async () => { + const result = await client.getFixedModelWrongDiscriminator(); + assert.deepEqual(result, { length: 8, kind: "wrongKind" }); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/modelInheritanceNestedDiscriminator.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceNestedDiscriminator.spec.ts new file mode 100644 index 0000000000..2364811b67 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceNestedDiscriminator.spec.ts @@ -0,0 +1,123 @@ +import { + GoblinShark, + NestedDiscriminatorClient, + Salmon, + Shark +} from "./generated/type/model/inheritance/nested-discriminator/src/index.js"; +import { assert } from "chai"; + +describe("NestedDiscriminatorClient Rest Client", () => { + let client: NestedDiscriminatorClient; + + beforeEach(() => { + client = new NestedDiscriminatorClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + const validBody: GoblinShark = { + age: 1, + kind: "shark", + sharktype: "goblin" + }; + it("should get valid", async () => { + const result = await client.getModel(); + assert.strictEqual(result.age, 1); + assert.strictEqual(result.kind, "shark"); + assert.strictEqual((result as Shark).sharktype, "goblin"); + }); + + it("should put valid", async () => { + const result = await client.putModel(validBody); + assert.isUndefined(result); + }); + + const validRecursiveBody: Salmon = { + age: 1, + kind: "salmon", + partner: { + age: 2, + kind: "shark", + sharktype: "saw" + }, + friends: [ + { + age: 2, + kind: "salmon", + partner: { + age: 3, + kind: "salmon" + }, + hate: { + key1: { + age: 4, + kind: "salmon" + }, + key2: { + age: 2, + kind: "shark", + sharktype: "goblin" + } + } + }, + { + age: 3, + kind: "shark", + sharktype: "goblin" + } + ], + hate: { + key3: { + age: 3, + kind: "shark", + sharktype: "saw" + }, + key4: { + age: 2, + kind: "salmon", + friends: [ + { + age: 1, + kind: "salmon" + }, + { + age: 4, + kind: "shark", + sharktype: "goblin" + } + ] + } + } + }; + it("should get recursive body", async () => { + const result = await client.getRecursiveModel(); + assert.strictEqual( + JSON.stringify(result, Object.keys(result).sort()), + JSON.stringify(validRecursiveBody, Object.keys(validRecursiveBody).sort()) + ); + if (result.kind === "salmon") { + assert.strictEqual( + (result as Salmon).partner?.kind, + validRecursiveBody.partner?.kind + ); + } + }); + + it("should put recursive body", async () => { + const result = await client.putRecursiveModel(validRecursiveBody); + assert.isUndefined(result); + }); + + it("should get missing discriminator body", async () => { + const result = await client.getMissingDiscriminator(); + assert.strictEqual(result.age, 1); + assert.isUndefined(result.kind); + }); + + it("should get wrong discriminator body", async () => { + const result = await client.getWrongDiscriminator(); + assert.strictEqual(result.age, 1); + assert.strictEqual(result.kind, "wrongKind"); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/modelInheritanceNotDiscriminated.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceNotDiscriminated.spec.ts new file mode 100644 index 0000000000..3a5bb8e5e2 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceNotDiscriminated.spec.ts @@ -0,0 +1,32 @@ +import { + NotDiscriminatedClient, + Siamese +} from "./generated/type/model/inheritance/not-discriminated/src/index.js"; +import { assert } from "chai"; + +describe("NotDiscriminatedClient Rest Client", () => { + let client: NotDiscriminatedClient; + + beforeEach(() => { + client = new NotDiscriminatedClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + const validBody: Siamese = { name: "abc", age: 32, smart: true }; + it("should get valid", async () => { + const result = await client.getValid(); + assert.deepEqual(result, validBody); + }); + + it("should put valid", async () => { + const result = await client.putValid(validBody); + assert.deepEqual(result, validBody); + }); + + it("should post valid", async () => { + const result = await client.postValid(validBody); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/modelInheritanceRecursive.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceRecursive.spec.ts new file mode 100644 index 0000000000..c33a151204 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceRecursive.spec.ts @@ -0,0 +1,42 @@ +import { + Extension, + RecursiveClient +} from "./generated/type/model/inheritance/recursive/src/index.js"; +import { assert } from "chai"; + +const body: Extension = { + level: 0, + extension: [ + { + level: 1, + extension: [ + { + level: 2 + } + ] + }, + { + level: 1 + } + ] +}; +describe("Recursive Client", () => { + let client: RecursiveClient; + + beforeEach(() => { + client = new RecursiveClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("Inheritance Recursive put test", async () => { + const result = await client.put(body); + assert.isNotNull(result); + }); + + it("Inheritance Recursive get test", async () => { + const result = await client.get(); + assert.isNotNull(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/modelInheritanceSingleDiscriminator.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceSingleDiscriminator.spec.ts new file mode 100644 index 0000000000..92cb73b4ef --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelInheritanceSingleDiscriminator.spec.ts @@ -0,0 +1,77 @@ +import { + Eagle, + SingleDiscriminatorClient, + Sparrow +} from "./generated/type/model/inheritance/single-discriminator/src/index.js"; +import { assert } from "chai"; + +describe("SingleDiscriminatorClient Rest Client", () => { + let client: SingleDiscriminatorClient; + + beforeEach(() => { + client = new SingleDiscriminatorClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + const validBody: Sparrow = { + wingspan: 1, + kind: "sparrow" + }; + const validRecursiveBody: Eagle = { + wingspan: 5, + kind: "eagle", + partner: { + wingspan: 2, + kind: "goose" + }, + friends: [ + { + wingspan: 2, + kind: "seagull" + } + ], + hate: { + key3: { + wingspan: 1, + kind: "sparrow" + } + } + }; + it("should get model with single discriminator", async () => { + const result = await client.getModel(); + assert.deepEqual(result, validBody); + }); + + it("should put model with single discriminator", async () => { + const result = await client.putModel(validBody); + assert.isUndefined(result); + }); + + it("should get recursive model with single discriminator", async () => { + const result = await client.getRecursiveModel(); + assert.deepEqual(result, validRecursiveBody); + }); + + it("should put recursive model with single discriminator", async () => { + const result = await client.putRecursiveModel(validRecursiveBody); + assert.isUndefined(result); + }); + + it("should get if missing discriminator", async () => { + const result = await client.getMissingDiscriminator(); + assert.deepEqual(result.wingspan, 1); + assert.isUndefined(result.kind); + }); + + it("should get if wrong discriminator", async () => { + const result = await client.getWrongDiscriminator(); + assert.deepEqual(result, { wingspan: 1, kind: "wrongKind" }); + }); + + it("should get legacy model", async () => { + const result = await client.getLegacyModel(); + assert.deepEqual(result, { size: 20, kind: "t-rex" }); + }); +}); diff --git a/packages/typespec-ts/test/modularIntegration/modelPropertyAdditional.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelPropertyAdditional.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/modelPropertyAdditional.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/modelPropertyAdditional.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/modelPropertyType.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelPropertyType.spec.ts new file mode 100644 index 0000000000..0611505bff --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelPropertyType.spec.ts @@ -0,0 +1,392 @@ +import { assert } from "chai"; +import { ValueTypesClient } from "./generated/type//property/value-types/src/index.js"; +import { stringToUint8Array } from "@azure/core-util"; + +interface TypeDetail { + type: string; + defaultValue: any; + convertedToFn?: (_: any) => any; +} + +const testedTypes: TypeDetail[] = [ + { + type: "boolean", + defaultValue: true + }, + { + type: "string", + defaultValue: "hello" + }, + { + type: "bytes", + defaultValue: stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64") + }, + { + type: "int", + defaultValue: 42 + }, + { + type: "float", + defaultValue: 43.125 + }, + { + type: "decimal", + defaultValue: 0.33333 + }, + { + type: "decimal128", + defaultValue: 0.33333 + }, + { + type: "datetime", + defaultValue: new Date("2022-08-26T18:38:00Z") + }, + { + type: "duration", + defaultValue: "P123DT22H14M12.011S" + }, + { + type: "enum", + defaultValue: "ValueOne" + }, + { + type: "extensible-enum", + defaultValue: "UnknownValue" + }, + { + type: "model", + defaultValue: { property: "hello" } + }, + { + type: "collections/string", + defaultValue: ["hello", "world"] + }, + { + type: "collections/int", + defaultValue: [1, 2] + }, + { + type: "collections/model", + defaultValue: [{ property: "hello" }, { property: "world" }] + }, + { + type: "dictionary/string", + defaultValue: { k1: "hello", k2: "world" } + }, + { + type: "never", + defaultValue: undefined + }, + { + type: "unknown/string", + defaultValue: "hello" + }, + { + type: "unknown/int", + defaultValue: 42 + }, + { + type: "unknown/dict", + defaultValue: { k1: "hello", k2: 42 } + }, + { + type: "unknown/array", + defaultValue: ["hello", "world"] + }, + { + type: "string/literal", + defaultValue: "hello" + }, + { + type: "int/literal", + defaultValue: 42 + }, + { + type: "float/literal", + defaultValue: 43.125 + }, + { + type: "boolean/literal", + defaultValue: true + }, + { + type: "union/string/literal", + defaultValue: "world" + }, + { + type: "union/int/literal", + defaultValue: 42 + }, + { + type: "union/float/literal", + defaultValue: 46.875 + }, + { + type: "union-enum-value", + defaultValue: "value2" + } +]; + +describe("ModelsPropertyTypesClient Rest Client", () => { + let client: ValueTypesClient; + + beforeEach(() => { + client = new ValueTypesClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + for (let item of testedTypes) { + it(`should get a ${item.type} value`, async () => { + let result: any; + if (item.convertedToFn) { + item.defaultValue = item.convertedToFn(item.defaultValue); + } else { + item.defaultValue = item.defaultValue; + } + switch (item.type) { + case "boolean": + result = await client.boolean.get(); + break; + case "string": + result = await client.string.get(); + break; + case "bytes": + result = await client.bytes.get(); + break; + case "int": + result = await client.int.get(); + break; + case "float": + result = await client.float.get(); + break; + case "decimal": + result = await client.decimal.get(); + break; + case "decimal128": + result = await client.decimal128.get(); + break; + case "datetime": + result = await client.datetime.get(); + break; + case "duration": + result = await client.duration.get(); + break; + case "enum": + result = await client.enum.get(); + break; + case "extensible-enum": + result = await client.extensibleEnum.get(); + break; + case "model": + result = await client.model.get(); + break; + case "collections/string": + result = await client.collectionsString.get(); + break; + case "collections/int": + result = await client.collectionsInt.get(); + break; + case "collections/model": + result = await client.collectionsModel.get(); + break; + case "dictionary/string": + result = await client.dictionaryString.get(); + break; + case "never": + result = await client.never.get(); + break; + case "unknown/string": + result = await client.unknownString.get(); + break; + case "unknown/int": + result = await client.unknownInt.get(); + break; + case "unknown/dict": + result = await client.unknownDict.get(); + break; + case "unknown/array": + result = await client.unknownArray.get(); + break; + case "string/literal": + result = await client.stringLiteral.get(); + break; + case "int/literal": + result = await client.intLiteral.get(); + break; + case "float/literal": + result = await client.floatLiteral.get(); + break; + case "boolean/literal": + result = await client.booleanLiteral.get(); + break; + case "union/string/literal": + result = await client.unionStringLiteral.get(); + break; + case "union/int/literal": + result = await client.unionIntLiteral.get(); + break; + case "union/float/literal": + result = await client.unionFloatLiteral.get(); + break; + case "union-enum-value": + result = await client.unionEnumValue.get(); + break; + default: + throw new Error(`Unknown type ${item.type}`); + } + assert.deepEqual(result.property, item.defaultValue); + }); + } + for (let item of testedTypes) { + it(`should put a ${item.type} value`, async () => { + let result: any; + if (item.convertedToFn) { + item.defaultValue = item.convertedToFn(item.defaultValue); + } else { + item.defaultValue = item.defaultValue; + } + switch (item.type) { + case "boolean": + result = await client.boolean.put({ property: item.defaultValue }); + break; + case "string": + result = await client.string.put({ property: item.defaultValue }); + break; + case "bytes": + result = await client.bytes.put({ + property: item.defaultValue + }); + break; + case "int": + result = await client.int.put({ property: item.defaultValue }); + break; + case "float": + result = await client.float.put({ property: item.defaultValue }); + break; + case "decimal": + result = await client.decimal.put({ property: item.defaultValue }); + break; + case "decimal128": + result = await client.decimal128.put({ + property: item.defaultValue + }); + break; + case "datetime": + result = await client.datetime.put({ + property: item.defaultValue + }); + break; + case "duration": + result = await client.duration.put({ + property: item.defaultValue + }); + break; + case "enum": + result = await client.enum.put({ property: item.defaultValue }); + break; + case "extensible-enum": + result = await client.extensibleEnum.put({ + property: item.defaultValue + }); + break; + case "model": + result = await client.model.put({ + property: item.defaultValue + }); + break; + case "collections/string": + result = await client.collectionsString.put({ + property: item.defaultValue + }); + break; + case "collections/int": + result = await client.collectionsInt.put({ + property: item.defaultValue + }); + break; + case "collections/model": + result = await client.collectionsModel.put({ + property: item.defaultValue + }); + break; + case "dictionary/string": + result = await client.dictionaryString.put({ + property: item.defaultValue + }); + break; + case "never": + result = await client.never.put({ + property: item.defaultValue as never + }); + break; + case "unknown/string": + result = await client.unknownString.put({ + property: item.defaultValue + }); + break; + case "unknown/int": + result = await client.unknownInt.put({ + property: item.defaultValue + }); + break; + case "unknown/dict": + result = await client.unknownDict.put({ + property: item.defaultValue + }); + break; + case "unknown/array": + result = await client.unknownArray.put({ + property: item.defaultValue + }); + break; + case "string/literal": + result = await client.stringLiteral.put({ + property: item.defaultValue + }); + break; + case "int/literal": + result = await client.intLiteral.put({ + property: item.defaultValue + }); + break; + case "float/literal": + result = await client.floatLiteral.put({ + property: item.defaultValue + }); + break; + case "boolean/literal": + result = await client.booleanLiteral.put({ + property: item.defaultValue + }); + break; + case "union/string/literal": + result = await client.unionStringLiteral.put({ + property: item.defaultValue + }); + break; + case "union/int/literal": + result = await client.unionIntLiteral.put({ + property: item.defaultValue + }); + break; + case "union/float/literal": + result = await client.unionFloatLiteral.put({ + property: item.defaultValue + }); + break; + case "union-enum-value": + result = await client.unionEnumValue.put({ + property: item.defaultValue + }); + break; + default: + throw new Error(`Unknown type ${item.type}`); + } + assert.isUndefined(result); + }); + } +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/modelsEmpty.spec.ts b/packages/typespec-ts/test/azureModularIntegration/modelsEmpty.spec.ts new file mode 100644 index 0000000000..1bb7dbb5c1 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/modelsEmpty.spec.ts @@ -0,0 +1,31 @@ +import { EmptyClient } from "./generated/type/model/empty/src/index.js"; +import { assert } from "chai"; + +const body = {}; +describe("Empty Client", () => { + let client: EmptyClient; + + beforeEach(() => { + client = new EmptyClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should put empty value", async () => { + const result = await client.putEmpty(body); + assert.isUndefined(result); + }); + + it("should get empty value", async () => { + const result = await client.getEmpty(); + assert.isNotNull(result); + assert.strictEqual(JSON.stringify(result), JSON.stringify(body)); + }); + + it("should post round trip empty value", async () => { + const result = await client.postRoundTripEmpty(body); + assert.isNotNull(result); + assert.strictEqual(JSON.stringify(result), JSON.stringify(body)); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/nullableProperties.spec.ts b/packages/typespec-ts/test/azureModularIntegration/nullableProperties.spec.ts new file mode 100644 index 0000000000..aefa443ecd --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/nullableProperties.spec.ts @@ -0,0 +1,130 @@ +import { assert } from "chai"; +import { + CollectionsModelProperty, + NullableClient +} from "./generated/type/property/nullable/src/index.js"; +import { stringToUint8Array } from "@azure/core-util"; + +describe("NullableProperties Modular Client", () => { + let client: NullableClient; + + beforeEach(() => { + client = new NullableClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should handle nullable bytes", async () => { + const nonNull = { + requiredProperty: "foo", + nullableProperty: stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64") + }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.bytes.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.bytes.getNonNull(); + assert.deepEqual(result2, nonNull); + + await client.bytes.patchNull(nullProperty); + await client.bytes.patchNonNull(nonNull); + }); + + it("should handle collection bytes", async () => { + const nonNull = { + requiredProperty: "foo", + nullableProperty: [ + stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64"), + stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64") + ] + }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.collectionsByte.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.collectionsByte.getNonNull(); + assert.deepEqual(result2, nonNull); + + await client.collectionsByte.patchNull(nullProperty); + await client.collectionsByte.patchNonNull(nonNull); + }); + + it("should handle collection model", async () => { + const nonNull: CollectionsModelProperty = { + requiredProperty: "foo", + nullableProperty: [{ property: "hello" }, { property: "world" }] + }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.collectionsModel.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.collectionsModel.getNonNull(); + assert.deepEqual(result2, nonNull); + + await client.collectionsModel.patchNull(nullProperty); + await client.collectionsModel.patchNonNull(nonNull); + }); + it("should handle collection string", async () => { + const nonNull = { + requiredProperty: "foo", + nullableProperty: ["hello", "world"] + }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.collectionsString.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.collectionsString.getNonNull(); + assert.deepEqual(result2, nonNull); + + await client.collectionsString.patchNull(nullProperty); + await client.collectionsString.patchNonNull(nonNull); + }); + it("should handle nullable datetime", async () => { + const nonNull = { + requiredProperty: "foo", + nullableProperty: new Date("2022-08-26T18:38:00.000Z") + }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.datetime.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.datetime.getNonNull(); + assert.deepEqual(result2, nonNull); + + await client.datetime.patchNull(nullProperty); + await client.datetime.patchNonNull(nonNull); + }); + + it("should handle nullable duration", async () => { + const nonNull = { + requiredProperty: "foo", + nullableProperty: "P123DT22H14M12.011S" + }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.duration.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.duration.getNonNull(); + assert.deepEqual(result2, nonNull); + + client.duration.patchNull(nullProperty); + client.duration.patchNonNull(nonNull); + }); + + it("should handle nullable string", async () => { + const nonNull = { requiredProperty: "foo", nullableProperty: "hello" }; + const nullProperty = { requiredProperty: "foo", nullableProperty: null }; + const result = await client.string.getNull(); + assert.deepEqual(result, nullProperty); + + const result2 = await client.string.getNonNull(); + assert.deepEqual(result2, nonNull); + + await client.string.patchNull(nullProperty); + await client.string.patchNonNull(nonNull); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/optionalProperties.spec.ts b/packages/typespec-ts/test/azureModularIntegration/optionalProperties.spec.ts new file mode 100644 index 0000000000..32305a4c8c --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/optionalProperties.spec.ts @@ -0,0 +1,197 @@ +import { assert } from "chai"; +import { OptionalClient } from "./generated/type/property/optionality/src/index.js"; +import { stringToUint8Array } from "@azure/core-util"; + +describe("OptionalProperties Modular Client", () => { + let client: OptionalClient; + + beforeEach(() => { + client = new OptionalClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should handle optional boolean literal", async () => { + const result = await client.booleanLiteral.getAll(); + assert.isTrue(result.property); + const result2 = await client.booleanLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.booleanLiteral.putAll({ property: true }); + await client.booleanLiteral.putDefault({}); + }); + + it("should handle optional bytes", async () => { + const result = await client.bytes.getAll(); + assert.deepEqual( + result.property, + stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64") + ); + const result2 = await client.bytes.getDefault(); + assert.equal(result2.property, undefined); + + await client.bytes.putAll({ + property: stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64") + }); + + await client.bytes.putDefault({}); + }); + + it("should handle optional collections bytes", async () => { + const testValue = [ + stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64"), + stringToUint8Array("aGVsbG8sIHdvcmxkIQ==", "base64") + ]; + const result = await client.collectionsByte.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.collectionsByte.getDefault(); + assert.equal(result2.property, undefined); + await client.collectionsByte.putAll({ property: testValue }); + await client.collectionsByte.putDefault({}); + }); + + it("should handle optional collections model", async () => { + const testValue = [{ property: "hello" }, { property: "world" }]; + const result = await client.collectionsModel.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.collectionsModel.getDefault(); + assert.equal(result2.property, undefined); + await client.collectionsModel.putAll({ property: testValue }); + await client.collectionsModel.putDefault({}); + }); + + it("should handle optional datetime", async () => { + const testValue = new Date("2022-08-26T18:38:00Z"); + const result = await client.datetime.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.datetime.getDefault(); + assert.equal(result2.property, undefined); + await client.datetime.putAll({ property: testValue }); + await client.datetime.putDefault({}); + }); + + it("should handle optional duration", async () => { + const testValue = "P123DT22H14M12.011S"; + const result = await client.duration.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.duration.getDefault(); + assert.equal(result2.property, undefined); + await client.duration.putAll({ property: testValue }); + await client.duration.putDefault({}); + }); + + it("should handle optional plainDate", async () => { + const testValue = "2022-12-12"; + const result = await client.plainDate.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.plainDate.getDefault(); + assert.equal(result2.property, undefined); + const result3 = await client.plainDate.putAll({ property: testValue }); + assert.isUndefined(result3); + await client.plainDate.putDefault({}); + }); + + it("should handle optional plainTime", async () => { + const testValue = "13:06:12"; + const result = await client.plainTime.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.plainTime.getDefault(); + assert.equal(result2.property, undefined); + const result3 = await client.plainTime.putAll({ + property: testValue + }); + assert.isUndefined(result3); + await client.plainTime.putDefault({}); + }); + + it("should handle optional float", async () => { + const testValue = 1.25; + const result = await client.floatLiteral.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.floatLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.floatLiteral.putAll({ property: testValue }); + await client.floatLiteral.putDefault({}); + }); + + it("should handle optional int", async () => { + const testValue = 1; + const result = await client.intLiteral.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.intLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.intLiteral.putAll({ property: testValue }); + await client.intLiteral.putDefault({}); + }); + + it("should handle required and optional", async () => { + const allBody = { + optionalProperty: "hello", + requiredProperty: 42 + }; + const requiredOnlyBody = { + requiredProperty: 42, + optionalProperty: undefined + }; + + const result = await client.requiredAndOptional.getAll(); + assert.deepEqual(result, allBody); + const result2 = await client.requiredAndOptional.getRequiredOnly(); + assert.deepEqual(result2, requiredOnlyBody); + await client.requiredAndOptional.putAll(allBody); + await client.requiredAndOptional.putRequiredOnly(requiredOnlyBody); + }); + + it("should handle optional string", async () => { + const testValue = "hello"; + const result = await client.string.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.string.getDefault(); + assert.equal(result2.property, undefined); + await client.string.putAll({ property: testValue }); + await client.string.putDefault({}); + }); + + it("should handle optional string literal", async () => { + const testValue = "hello"; + const result = await client.stringLiteral.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.stringLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.stringLiteral.putAll({ property: testValue }); + await client.stringLiteral.putDefault({}); + }); + + it("should handle optional union float literal", async () => { + const testValue = 2.375; + const result = await client.unionFloatLiteral.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.unionFloatLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.unionFloatLiteral.putAll({ property: testValue }); + await client.unionFloatLiteral.putDefault({}); + }); + + it("should handle optional union int literal", async () => { + const testValue = 2; + const result = await client.unionIntLiteral.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.unionIntLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.unionIntLiteral.putAll({ property: testValue }); + await client.unionIntLiteral.putDefault({}); + }); + + it("should handle optional union string literal", async () => { + const testValue = "world"; + const result = await client.unionStringLiteral.getAll(); + assert.deepEqual(result.property, testValue); + const result2 = await client.unionStringLiteral.getDefault(); + assert.equal(result2.property, undefined); + await client.unionStringLiteral.putAll({ property: testValue }); + await client.unionStringLiteral.putDefault({}); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/payloadContentNegotiation.spec.ts b/packages/typespec-ts/test/azureModularIntegration/payloadContentNegotiation.spec.ts new file mode 100644 index 0000000000..ab702afc04 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/payloadContentNegotiation.spec.ts @@ -0,0 +1,48 @@ +import { assert } from "chai"; +import { uint8ArrayToString } from "@azure/core-util"; +import { ContentNegotiationClient } from "./generated/payload/content-negotiation/src/index.js"; + +import { readFileSync } from "fs"; +import { resolvePath } from "@typespec/compiler"; +import { fileURLToPath } from "url"; + +const root = resolvePath(fileURLToPath(import.meta.url), "../../../temp"); +const pngFile = readFileSync(resolvePath(root, "assets/image.png")); +const jpegImage = readFileSync(resolvePath(root, "assets/image.jpg")); + +describe("Payload Content Negotiation Client", () => { + let client: ContentNegotiationClient; + + beforeEach(() => { + client = new ContentNegotiationClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should get image/png for same body in content negotiation", async () => { + const result = await client.sameBody.getAvatarAsPng(); + assert.strictEqual(uint8ArrayToString(result, "utf-8"), pngFile.toString()); + }); + + it("should get image/jpeg for same body in content negotiation", async () => { + const result = await client.sameBody.getAvatarAsJpeg(); + assert.strictEqual( + uint8ArrayToString(result, "utf-8"), + jpegImage.toString() + ); + }); + + it("should get image/png for different body in content negotiation", async () => { + const result = await client.differentBody.getAvatarAsPng(); + assert.strictEqual(uint8ArrayToString(result, "utf-8"), pngFile.toString()); + }); + + it("should get application/json for different body in content negotiation", async () => { + const result = await client.differentBody.getAvatarAsJson(); + assert.strictEqual( + uint8ArrayToString(result.content, "utf-8"), + pngFile.toString() + ); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/payloadMediaType.spec.ts b/packages/typespec-ts/test/azureModularIntegration/payloadMediaType.spec.ts new file mode 100644 index 0000000000..8a3ae073c0 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/payloadMediaType.spec.ts @@ -0,0 +1,36 @@ +import { MediaTypeClient } from "./generated/payload/media-type/src/index.js"; +import { assert } from "chai"; + +describe("MediaType Client", () => { + let client: MediaTypeClient; + + beforeEach(() => { + client = new MediaTypeClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should getAsText", async () => { + const result = await client.stringBody.getAsText({ + requestOptions: { headers: { accept: "text/plain" } } + }); + assert.strictEqual(result, "{cat}"); + }); + + it("should sendAsText", async () => { + const result = await client.stringBody.sendAsText("{cat}"); + assert.isUndefined(result); + }); + + it("should getAsJson", async () => { + const result = await client.stringBody.getAsJson(); + console.log(result); + assert.strictEqual(result, "foo"); + }); + + it("should sendAsJson", async () => { + const result = await client.stringBody.sendAsJson("foo"); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/payloadPageable.spec.ts b/packages/typespec-ts/test/azureModularIntegration/payloadPageable.spec.ts new file mode 100644 index 0000000000..11a03d206d --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/payloadPageable.spec.ts @@ -0,0 +1,25 @@ +import { + PageableClient, +} from "./generated/payload/pageable/src/index.js"; +import { assert } from "chai"; + +describe("PageableClient Classical Client", () => { + let client: PageableClient; + + beforeEach(() => { + client = new PageableClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("Payload Pageable ServerDriven Pagination link", async () => { + const result = await client.serverDrivenPagination.link(); + assert.strictEqual(result.pets[0]?.id, '1'); + assert.strictEqual(result.pets[0]?.name, 'dog'); + assert.strictEqual(result.pets[1]?.id, '2'); + assert.strictEqual(result.pets[1]?.name, 'cat'); + assert.strictEqual(result.links.next, "http://localhost:3002/payload/pageable/server-driven-pagination/link/nextPage"); + }); + +}); \ No newline at end of file diff --git a/packages/typespec-ts/test/modularIntegration/resiliencySrvDrivenMain.spec.ts b/packages/typespec-ts/test/azureModularIntegration/resiliencySrvDrivenMain.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/resiliencySrvDrivenMain.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/resiliencySrvDrivenMain.spec.ts diff --git a/packages/typespec-ts/test/modularIntegration/resiliencySrvDrivenOld.spec.ts b/packages/typespec-ts/test/azureModularIntegration/resiliencySrvDrivenOld.spec.ts similarity index 100% rename from packages/typespec-ts/test/modularIntegration/resiliencySrvDrivenOld.spec.ts rename to packages/typespec-ts/test/azureModularIntegration/resiliencySrvDrivenOld.spec.ts diff --git a/packages/typespec-ts/test/azureModularIntegration/scalar.spec.ts b/packages/typespec-ts/test/azureModularIntegration/scalar.spec.ts new file mode 100644 index 0000000000..b6d524a713 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/scalar.spec.ts @@ -0,0 +1,127 @@ +import { assert } from "chai"; +import { ScalarClient } from "./generated/type/scalar/src/index.js"; +describe("Scalar Client", () => { + let client: ScalarClient; + + beforeEach(() => { + client = new ScalarClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get string value", async () => { + const result = await client.string.get({ + requestOptions: { + headers: { + accept: "text/plain" + } + } + }); + assert.strictEqual(result, "test"); + }); + + it("should put string value", async () => { + const result = await client.string.put("test", { + requestOptions: { + headers: { + "content-type": "text/plain" + } + } + }); + assert.isUndefined(result); + }); + + it("should get boolean value", async () => { + const result = await client.boolean.get(); + assert.strictEqual(result, true); + }); + + it("should put boolean value", async () => { + const result = await client.boolean.put(true); + assert.isUndefined(result); + }); + + it("should get unknown value", async () => { + const result = await client.unknown.get({ + requestOptions: { + headers: { + accept: "text/plain" + } + } + }); + assert.strictEqual(result, "test"); + }); + + it("should put unknown value", async () => { + const result = await client.unknown.put("test", { + requestOptions: { + headers: { + "content-type": "text/plain" + } + } + }); + assert.isUndefined(result); + }); + + it("should get decimal response body", async () => { + const result = await client.decimalType.responseBody(); + assert.strictEqual(result, 0.33333); + }); + + it("should put decimal request body", async () => { + const result = await client.decimalType.requestBody(0.33333); + assert.isUndefined(result); + }); + + it("should get decimal request parameter", async () => { + const result = await client.decimalType.requestParameter(0.33333); + assert.isUndefined(result); + }); + + it("should get decimal128 response body", async () => { + const result = await client.decimal128Type.responseBody(); + assert.strictEqual(result, 0.33333); + }); + + it("should put decimal128 request body", async () => { + const result = await client.decimal128Type.requestBody(0.33333); + assert.isUndefined(result); + }); + + it("should get decimal128 request parameter", async () => { + const result = await client.decimal128Type.requestParameter(0.33333); + assert.isUndefined(result); + }); + + it("should fail to post decimal verify", async () => { + try { + const getResult = await client.decimalVerify.prepareVerify(); + let total = 0; + getResult.forEach((decimal: number) => { + total += decimal; + }); + await client.decimalVerify.verify(total); + assert.fail("Expected an exception to be thrown."); + } catch (err) { + assert.strictEqual(JSON.parse(JSON.stringify(err)).statusCode, 400); + } + }); + + it("should fail to post decimal128 verify", async () => { + try { + const getResult = await client.decimal128Verify.prepareVerify(); + let total = 0; + getResult.forEach((decimal: number) => { + total += decimal; + }); + await client.decimal128Verify.verify(total); + assert.fail("Expected an exception to be thrown."); + } catch (err) { + assert.strictEqual(JSON.parse(JSON.stringify(err)).statusCode, 400); + } + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/serializationEncodeNameJson.spec.ts b/packages/typespec-ts/test/azureModularIntegration/serializationEncodeNameJson.spec.ts new file mode 100644 index 0000000000..6050a31a37 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/serializationEncodeNameJson.spec.ts @@ -0,0 +1,25 @@ +import { assert } from "chai"; +import { JsonClient } from "./generated/serialization/encoded-name/json/src/index.js"; +describe("NameAndEncodedName Client", () => { + let client: JsonClient; + + beforeEach(() => { + client = new JsonClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get encoded-name json property", async () => { + const result = await client.get(); + assert.strictEqual(result.defaultName, true); + }); + + it("should post encoded-name json property", async () => { + const result = await client.send({ defaultName: true }); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/server.spec.ts b/packages/typespec-ts/test/azureModularIntegration/server.spec.ts new file mode 100644 index 0000000000..57b31d1ac6 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/server.spec.ts @@ -0,0 +1,132 @@ +import { assert } from "chai"; +import { SingleClient } from "./generated/server/path/single/src/index.js"; +import { MultipleClient } from "./generated/server/path/multiple/src/index.js"; +import { NotVersionedClient } from "./generated/server/versions/not-versioned/src/index.js"; +import { VersionedClient } from "./generated/server/versions/versioned/src/index.js"; +describe("Single Server Path Client", () => { + let client: SingleClient; + + beforeEach(() => { + client = new SingleClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should work with no param", async () => { + const result = await client.myOp(); + assert.isUndefined(result); + }); +}); + +describe("Multiple Server Path Client", () => { + let client: MultipleClient; + + beforeEach(() => { + client = new MultipleClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should work with no param", async () => { + const result = await client.noOperationParams(); + assert.isUndefined(result); + }); + + it("should work with param", async () => { + const result = await client.withOperationPathParam("test"); + assert.isUndefined(result); + }); +}); + +describe("NotVersioned Server Version Client", () => { + let client: NotVersionedClient; + + beforeEach(() => { + client = new NotVersionedClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should work without apiVersion", async () => { + const result = await client.withoutApiVersion(); + assert.isUndefined(result); + }); + + it("should work with param", async () => { + const result = await client.withQueryApiVersion("v1.0"); + assert.isUndefined(result); + }); + + it("should work with path param", async () => { + const result = await client.withPathApiVersion("v1.0"); + assert.isUndefined(result); + }); +}); + +describe("Versioned Server Version Client", () => { + let client: VersionedClient; + + beforeEach(() => { + client = new VersionedClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should work without apiVersion", async () => { + const result = await client.withoutApiVersion(); + assert.isUndefined(result); + }); + + it("should work with param with default value", async () => { + const result = await client.withQueryApiVersion(); + assert.isUndefined(result); + }); + + it("should work with param with explicit value", async () => { + const client = new VersionedClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + }, + apiVersion: "2022-12-01-preview" + }); + const result = await client.withQueryApiVersion(); + assert.isUndefined(result); + }); + + it("should work with path param", async () => { + const client = new VersionedClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + }, + apiVersion: "2022-12-01-preview" + }); + const result = await client.withPathApiVersion(); + assert.isUndefined(result); + }); + + it("should work with param with old value", async () => { + const client = new VersionedClient("http://localhost:3002", { + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + }, + apiVersion: "2021-01-01-preview" + }); + const result = await client.withQueryOldApiVersion(); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/serverEndpointNotDefined.spec.ts b/packages/typespec-ts/test/azureModularIntegration/serverEndpointNotDefined.spec.ts new file mode 100644 index 0000000000..7c38eaaa51 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/serverEndpointNotDefined.spec.ts @@ -0,0 +1,17 @@ +import { assert } from "chai"; +import { NotDefinedClient } from "./generated/server/endpoint/not-defined/src/index.js"; +describe("NotDefined Server Endpoint Client", () => { + let client: NotDefinedClient; + + beforeEach(() => { + client = new NotDefinedClient("http://localhost:3000", { + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should work with not defined endpoint", async () => { + const result = await client.valid(); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/specialWords.spec.ts b/packages/typespec-ts/test/azureModularIntegration/specialWords.spec.ts new file mode 100644 index 0000000000..b36c762520 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/specialWords.spec.ts @@ -0,0 +1,486 @@ +import { assert } from "chai"; +import { SpecialWordsClient } from "./generated/special-words/src/index.js"; + +describe("Special Words Client", () => { + let client: SpecialWordsClient; + + beforeEach(() => { + client = new SpecialWordsClient({ + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + }); + }); + + it("should post modelProperties sameAsModel", async () => { + const result = await client.modelProperties.sameAsModel({ + sameAsModel: "ok" + }); + assert.equal(result, undefined); + }); + it("should get operations And", async () => { + const result = await client.operations.and(); + assert.equal(result, undefined); + }); + it("should get operations As", async () => { + const result = await client.operations.as(); + assert.equal(result, undefined); + }); + it("should get operations Assert", async () => { + const result = await client.operations.assert(); + assert.equal(result, undefined); + }); + it("should get operations Async", async () => { + const result = await client.operations.async(); + assert.equal(result, undefined); + }); + it("should get operations Await", async () => { + const result = await client.operations.await(); + assert.equal(result, undefined); + }); + it("should get operations Break", async () => { + const result = await client.operations.break(); + assert.equal(result, undefined); + }); + it("should get operations Class", async () => { + const result = await client.operations.class(); + assert.equal(result, undefined); + }); + it("should get operations Constructor", async () => { + const result = await client.operations.constructor(); + assert.equal(result, undefined); + }); + it("should get operations Continue", async () => { + const result = await client.operations.continue(); + assert.equal(result, undefined); + }); + it("should get operations Def", async () => { + const result = await client.operations.def(); + assert.equal(result, undefined); + }); + it("should get operations Del", async () => { + const result = await client.operations.del(); + assert.equal(result, undefined); + }); + it("should get operations Elif", async () => { + const result = await client.operations.elif(); + assert.equal(result, undefined); + }); + it("should get operations Else", async () => { + const result = await client.operations.else(); + assert.equal(result, undefined); + }); + it("should get operations Except", async () => { + const result = await client.operations.except(); + assert.equal(result, undefined); + }); + it("should get operations Exec", async () => { + const result = await client.operations.exec(); + assert.equal(result, undefined); + }); + it("should get operations Finally", async () => { + const result = await client.operations.finally(); + assert.equal(result, undefined); + }); + it("should get operations For", async () => { + const result = await client.operations.for(); + assert.equal(result, undefined); + }); + it("should get operations From", async () => { + const result = await client.operations.from(); + assert.equal(result, undefined); + }); + it("should get operations Global", async () => { + const result = await client.operations.global(); + assert.equal(result, undefined); + }); + it("should get operations If", async () => { + const result = await client.operations.if(); + assert.equal(result, undefined); + }); + it("should get operations Import", async () => { + const result = await client.operations.import(); + assert.equal(result, undefined); + }); + it("should get operations In", async () => { + const result = await client.operations.in(); + assert.equal(result, undefined); + }); + it("should get operations Is", async () => { + const result = await client.operations.is(); + assert.equal(result, undefined); + }); + it("should get operations Lambda", async () => { + const result = await client.operations.lambda(); + assert.equal(result, undefined); + }); + it("should get operations Not", async () => { + const result = await client.operations.not(); + assert.equal(result, undefined); + }); + it("should get operations Or", async () => { + const result = await client.operations.or(); + assert.equal(result, undefined); + }); + it("should get operations Pass", async () => { + const result = await client.operations.pass(); + assert.equal(result, undefined); + }); + it("should get operations Raise", async () => { + const result = await client.operations.raise(); + assert.equal(result, undefined); + }); + it("should get operations Return", async () => { + const result = await client.operations.return(); + assert.equal(result, undefined); + }); + it("should get operations Try", async () => { + const result = await client.operations.try(); + assert.equal(result, undefined); + }); + it("should get operations While", async () => { + const result = await client.operations.while(); + assert.equal(result, undefined); + }); + it("should get operations With", async () => { + const result = await client.operations.with(); + assert.equal(result, undefined); + }); + it("should get operations Yield", async () => { + const result = await client.operations.yield(); + assert.equal(result, undefined); + }); + it("should post parameters withAnd", async () => { + const result = await client.parameters.withAnd("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withAs", async () => { + const result = await client.parameters.withAs("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withAssert", async () => { + const result = await client.parameters.withAssert("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withAsync", async () => { + const result = await client.parameters.withAsync("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withAwait", async () => { + const result = await client.parameters.withAwait("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withBreak", async () => { + const result = await client.parameters.withBreak("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withClass", async () => { + const result = await client.parameters.withClass("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withConstructor", async () => { + const result = await client.parameters.withConstructor("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withContinue", async () => { + const result = await client.parameters.withContinue("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withDef", async () => { + const result = await client.parameters.withDef("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withDel", async () => { + const result = await client.parameters.withDel("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withElif", async () => { + const result = await client.parameters.withElif("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withElse", async () => { + const result = await client.parameters.withElse("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withExcept", async () => { + const result = await client.parameters.withExcept("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withExec", async () => { + const result = await client.parameters.withExec("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withFinally", async () => { + const result = await client.parameters.withFinally("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withFor", async () => { + const result = await client.parameters.withFor("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withFrom", async () => { + const result = await client.parameters.withFrom("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withGlobal", async () => { + const result = await client.parameters.withGlobal("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withIf", async () => { + const result = await client.parameters.withIf("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withImport", async () => { + const result = await client.parameters.withImport("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withIn", async () => { + const result = await client.parameters.withIn("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withIs", async () => { + const result = await client.parameters.withIs("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withLambda", async () => { + const result = await client.parameters.withLambda("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withNot", async () => { + const result = await client.parameters.withNot("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withOr", async () => { + const result = await client.parameters.withOr("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withPass", async () => { + const result = await client.parameters.withPass("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withRaise", async () => { + const result = await client.parameters.withRaise("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withReturn", async () => { + const result = await client.parameters.withReturn("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withTry", async () => { + const result = await client.parameters.withTry("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withWhile", async () => { + const result = await client.parameters.withWhile("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withWith", async () => { + const result = await client.parameters.withWith("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withYield", async () => { + const result = await client.parameters.withYield("ok"); + assert.equal(result, undefined); + }); + it("should post parameters withCancellationToken", async () => { + const result = await client.parameters.withCancellationToken("ok"); + assert.equal(result, undefined); + }); + it("should post models withAnd", async () => { + const result = await client.models.withAnd({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withAs", async () => { + const result = await client.models.withAs({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withAssert", async () => { + const result = await client.models.withAssert({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withAsync", async () => { + const result = await client.models.withAsync({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withAwait", async () => { + const result = await client.models.withAwait({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withBreak", async () => { + const result = await client.models.withBreak({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withClass", async () => { + const result = await client.models.withClass({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withConstructor", async () => { + const result = await client.models.withConstructor({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withContinue", async () => { + const result = await client.models.withContinue({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withDef", async () => { + const result = await client.models.withDef({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withDel", async () => { + const result = await client.models.withDel({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withElif", async () => { + const result = await client.models.withElif({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withElse", async () => { + const result = await client.models.withElse({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withExcept", async () => { + const result = await client.models.withExcept({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withExec", async () => { + const result = await client.models.withExec({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withFinally", async () => { + const result = await client.models.withFinally({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withFor", async () => { + const result = await client.models.withFor({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withFrom", async () => { + const result = await client.models.withFrom({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withGlobal", async () => { + const result = await client.models.withGlobal({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withIf", async () => { + const result = await client.models.withIf({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withImport", async () => { + const result = await client.models.withImport({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withIn", async () => { + const result = await client.models.withIn({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withIs", async () => { + const result = await client.models.withIs({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withLambda", async () => { + const result = await client.models.withLambda({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withNot", async () => { + const result = await client.models.withNot({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withOr", async () => { + const result = await client.models.withOr({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withPass", async () => { + const result = await client.models.withPass({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withRaise", async () => { + const result = await client.models.withRaise({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withReturn", async () => { + const result = await client.models.withReturn({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withTry", async () => { + const result = await client.models.withTry({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withWhile", async () => { + const result = await client.models.withWhile({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withWith", async () => { + const result = await client.models.withWith({ + name: "ok" + }); + assert.equal(result, undefined); + }); + it("should post models withYield", async () => { + const result = await client.models.withYield({ + name: "ok" + }); + assert.equal(result, undefined); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/spreadParameters.spec.ts b/packages/typespec-ts/test/azureModularIntegration/spreadParameters.spec.ts new file mode 100644 index 0000000000..4621185dce --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/spreadParameters.spec.ts @@ -0,0 +1,92 @@ +import { SpreadClient } from "./generated/parameters/spread/src/index.js"; +import { assert } from "chai"; +describe("SpreadClient Client", () => { + let client: SpreadClient; + + beforeEach(() => { + client = new SpreadClient({ + allowInsecureConnection: true, + endpoint: "http://localhost:3002" + }); + }); + + it("should spread named model", async () => { + const result = await client.model.spreadAsRequestBody("foo"); + assert.isUndefined(result); + }); + + it("should spread alias with only body param", async () => { + const result = await client.alias.spreadAsRequestBody("foo"); + assert.isUndefined(result); + }); + + it("should spread model composite request only with body", async () => { + const result = await client.model.spreadCompositeRequestOnlyWithBody({ + name: "foo" + }); + assert.isUndefined(result); + }); + + it("should spread model composite request without body", async () => { + const result = await client.model.spreadCompositeRequestWithoutBody( + "foo", + "bar" + ); + assert.isUndefined(result); + }); + + it("should spread model composite request ", async () => { + const result = await client.model.spreadCompositeRequest("foo", "bar", { + name: "foo" + }); + assert.isUndefined(result); + }); + + it("should spread model composite request mix", async () => { + const result = await client.model.spreadCompositeRequestMix( + "foo", + "bar", + "foo" + ); + assert.isUndefined(result); + }); + + it("should spread alias with mixed params", async () => { + const result = await client.alias.spreadAsRequestParameter( + "1", + "bar", + "foo" + ); + assert.isUndefined(result); + }); + + it("should spread alias with multiple-parameters", async () => { + const result = await client.alias.spreadWithMultipleParameters( + "1", + "bar", + "foo", + [1, 2], + { optionalInt: 1, optionalStringList: ["foo", "bar"] } + ); + assert.isUndefined(result); + }); + + it("should spread alias with inner-model-parameter", async () => { + const result = await client.alias.spreadParameterWithInnerModel( + "1", + "foo", + "bar", + ); + assert.isUndefined(result); + }); + + it("should spread alias with inner-alias-parameter", async () => { + const result = await client.alias.spreadParameterWithInnerAlias( + "1", + "foo", + 1, + "bar" + ); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/unions.spec.ts b/packages/typespec-ts/test/azureModularIntegration/unions.spec.ts new file mode 100644 index 0000000000..a1426e50e5 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/unions.spec.ts @@ -0,0 +1,142 @@ +import { assert } from "chai"; +import { UnionClient } from "./generated/type/union/src/index.js"; +describe("Type Union Client", () => { + let client: UnionClient; + + beforeEach(() => { + client = new UnionClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true, + retryOptions: { + maxRetries: 0 + } + }); + }); + + it("should get strings only union", async () => { + const result = await client.stringsOnly.get(); + assert.strictEqual(result.prop, "b"); + }); + it("should send strings only union", async () => { + const result = await client.stringsOnly.send("b"); + assert.isUndefined(result); + }); + + it("should get strings extensible union", async () => { + const result = await client.stringExtensible.get(); + assert.strictEqual(result.prop, "custom"); + }); + it("should send strings extensible union", async () => { + const result = await client.stringExtensible.send("custom"); + assert.isUndefined(result); + }); + + it("should get strings extensible named union", async () => { + const result = await client.stringExtensibleNamed.get(); + assert.strictEqual(result.prop, "custom"); + }); + it("should send strings extensible union", async () => { + const result = await client.stringExtensibleNamed.send("custom"); + assert.isUndefined(result); + }); + + it("should get ints only union", async () => { + const result = await client.intsOnly.get(); + assert.strictEqual(result.prop, 2); + }); + it("should send ints only union", async () => { + const result = await client.intsOnly.send(2); + assert.isUndefined(result); + }); + + it("should get floats only union", async () => { + const result = await client.floatsOnly.get(); + assert.strictEqual(result.prop, 2.2); + }); + it("should send floats only union", async () => { + const result = await client.floatsOnly.send(2.2); + assert.isUndefined(result); + }); + + it("should get models only union", async () => { + const result = await client.modelsOnly.get(); + assert.strictEqual( + JSON.stringify(result.prop), + JSON.stringify({ name: "test" }) + ); + }); + it("should send models only union", async () => { + const result = await client.modelsOnly.send({ name: "test" }); + assert.isUndefined(result); + }); + + it("should get enums only union", async () => { + const result = await client.enumsOnly.get(); + assert.strictEqual(result.prop.lr, "right"); + assert.strictEqual(result.prop.ud, "up"); + }); + it("should send enums only union", async () => { + const result = await client.enumsOnly.send({ lr: "right", ud: "up" }); + assert.isUndefined(result); + }); + + it("should get string and array union", async () => { + const result = await client.stringAndArray.get(); + assert.strictEqual(result.prop.string, "test"); + assert.strictEqual(result.prop.array[0], "test1"); + assert.strictEqual(result.prop.array[1], "test2"); + }); + it("should send string and array union", async () => { + const result = await client.stringAndArray.send({ + string: "test", + array: ["test1", "test2"] + }); + assert.isUndefined(result); + }); + + it("should get mixed literals union", async () => { + const result = await client.mixedLiterals.get(); + assert.strictEqual(result.prop.stringLiteral, "a"); + assert.strictEqual(result.prop.intLiteral, 2); + assert.strictEqual(result.prop.floatLiteral, 3.3); + assert.strictEqual(result.prop.booleanLiteral, true); + }); + it("should send mixed literals union", async () => { + const result = await client.mixedLiterals.send({ + stringLiteral: "a", + intLiteral: 2, + floatLiteral: 3.3, + booleanLiteral: true + }); + assert.isUndefined(result); + }); + + it("should get mixed types union", async () => { + const result = await client.mixedTypes.get(); + assert.strictEqual( + JSON.stringify(result.prop.model), + JSON.stringify({ name: "test" }) + ); + assert.strictEqual(result.prop.literal, "a"); + assert.strictEqual(result.prop.int, 2); + assert.strictEqual(result.prop.boolean, true); + + }); + it("should send mixed types union", async () => { + const result = await client.mixedTypes.send({ + model: { name: "test" }, + literal: "a", + int: 2, + boolean: true, + array: [ + { + name: "test" + }, + "a", + 2, + true + ] + }); + assert.isUndefined(result); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/usage.spec.ts b/packages/typespec-ts/test/azureModularIntegration/usage.spec.ts new file mode 100644 index 0000000000..6d24695add --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/usage.spec.ts @@ -0,0 +1,69 @@ +import { UsageClient } from "./generated/type/model/usage/src/index.js"; +import { assert } from "chai"; +import { + UsageContext, + createUsage, + input, + inputAndOutput, + output +} from "./generated/type/model/usage/src/api/index.js"; +const EXPECTED_VALUE = "example-value"; +describe("UsageContext Classical Client", () => { + let client: UsageClient; + + beforeEach(() => { + client = new UsageClient({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should input", async () => { + const result = await client.input({ requiredProp: EXPECTED_VALUE }); + assert.isUndefined(result); + }); + + it("should output", async () => { + const result = await client.output(); + assert.isNotNull(result); + assert.strictEqual(result.requiredProp, EXPECTED_VALUE); + }); + + it("should inputAndOutput", async () => { + const result = await client.inputAndOutput({ + requiredProp: EXPECTED_VALUE + }); + assert.isNotNull(result); + assert.strictEqual(result.requiredProp, EXPECTED_VALUE); + }); +}); + +describe("UsageContext API Operations", () => { + let context: UsageContext; + + beforeEach(() => { + context = createUsage({ + endpoint: "http://localhost:3002", + allowInsecureConnection: true + }); + }); + + it("should input", async () => { + const result = await input(context, { requiredProp: EXPECTED_VALUE }); + assert.isUndefined(result); + }); + + it("should inputAndOutput", async () => { + const result = await inputAndOutput(context, { + requiredProp: EXPECTED_VALUE + }); + assert.isNotNull(result); + assert.strictEqual(result.requiredProp, EXPECTED_VALUE); + }); + + it("should output", async () => { + const result = await output(context); + assert.isNotNull(result); + assert.strictEqual(result.requiredProp, EXPECTED_VALUE); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/versioningAdded.spec.ts b/packages/typespec-ts/test/azureModularIntegration/versioningAdded.spec.ts new file mode 100644 index 0000000000..544095d1fc --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/versioningAdded.spec.ts @@ -0,0 +1,45 @@ +import { assert } from "chai"; +import { AddedClient } from "./generated/versioning/added/src/index.js"; + +describe("VersioningAdded Rest Client", () => { + let client: AddedClient; + + beforeEach(() => { + client = new AddedClient("http://localhost:3002", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning added v1", async () => { + const result = await client.v1({ + prop: "foo", + enumProp: "enumMemberV2", + unionProp: 10 + }, "bar"); + assert.strictEqual(result.prop, "foo"); + assert.strictEqual(result.enumProp, "enumMemberV2"); + assert.strictEqual(result.unionProp, 10); + }); + + it("versioning added v2", async () => { + const result = await client.v2({ + prop: "foo", + enumProp: "enumMember", + unionProp: "bar" + }); + assert.strictEqual(result.prop, "foo"); + assert.strictEqual(result.enumProp, "enumMember"); + assert.strictEqual(result.unionProp, "bar"); + }); + + it("versioning added interface v2", async () => { + const result = await client.v2InInterface({ + prop: "foo", + enumProp: "enumMember", + unionProp: "bar" + }); + assert.strictEqual(result.prop, "foo"); + assert.strictEqual(result.enumProp, "enumMember"); + assert.strictEqual(result.unionProp, "bar"); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/versioningMadeOptional.spec.ts b/packages/typespec-ts/test/azureModularIntegration/versioningMadeOptional.spec.ts new file mode 100644 index 0000000000..b8996a37d3 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/versioningMadeOptional.spec.ts @@ -0,0 +1,17 @@ +import { assert } from "chai"; +import { MadeOptionalClient } from "./generated/versioning/madeOptional/src/index.js"; + +describe("VersioningMadeOptionalClient Rest Client", () => { + let client: MadeOptionalClient; + + beforeEach(() => { + client = new MadeOptionalClient("http://localhost:3002", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning madeOptional test", async () => { + const result = await client.test({ prop: "foo" }); + assert.strictEqual(result.prop, "foo"); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/versioningRemoved.spec.ts b/packages/typespec-ts/test/azureModularIntegration/versioningRemoved.spec.ts new file mode 100644 index 0000000000..20d99d3076 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/versioningRemoved.spec.ts @@ -0,0 +1,57 @@ +import { assert } from "chai"; +import { RemovedClient } from "./generated/versioning/removed/src/index.js"; + +describe("VersioningRemoved Rest Client", () => { + let client1: RemovedClient; + let client2: RemovedClient; + let clientPreview: RemovedClient; + + beforeEach(() => { + client1 = new RemovedClient("http://localhost:3002", "v1", { + allowInsecureConnection: true + }); + client2 = new RemovedClient("http://localhost:3002", "v2", { + allowInsecureConnection: true + }); + clientPreview = new RemovedClient("http://localhost:3002", "v2preview", { + allowInsecureConnection: true + }); + }); + + it("versioning removed test v2", async () => { + const result = await client2.v2({ + prop: "foo", + enumProp: "enumMemberV2", + unionProp: "bar" + }); + assert.strictEqual(result.prop, "foo"); + assert.strictEqual(result.enumProp, "enumMemberV2"); + assert.strictEqual(result.unionProp, "bar"); + }); + + it("versioning removed test modelV3", async () => { + const result = await client1.modelV3({ + id: "123", + enumProp: "enumMemberV1", + }); + assert.strictEqual(result.id, "123"); + assert.strictEqual(result.enumProp, "enumMemberV1"); + }); + + it("versioning removed test modelV3_V2", async () => { + const result = await client2.modelV3({ + id: "123", + enumProp: "enumMemberV1", + }); + assert.strictEqual(result.id, "123"); + assert.strictEqual(result.enumProp, "enumMemberV1"); + }); + + it("versioning removed test modelV33_V2preview", async () => { + const result = await clientPreview.modelV3({ + id: "123", + enumProp: "enumMemberV1", + }); + assert.strictEqual(result.id, "123"); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/versioningRenamedFrom.spec.ts b/packages/typespec-ts/test/azureModularIntegration/versioningRenamedFrom.spec.ts new file mode 100644 index 0000000000..6a269a7814 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/versioningRenamedFrom.spec.ts @@ -0,0 +1,34 @@ +import { assert } from "chai"; +import { RenamedFromClient } from "./generated/versioning/renamedFrom/src/index.js"; + +describe("VersioningRenamedFrom Rest Client", () => { + let client: RenamedFromClient; + + beforeEach(() => { + client = new RenamedFromClient("http://localhost:3002", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning RenamedFrom ewOp test", async () => { + const result = await client.newOp({ + newProp: "foo", + enumProp: "newEnumMember", + unionProp: 10 + }, "bar"); + assert.strictEqual(result.newProp, "foo"); + assert.strictEqual(result.enumProp, "newEnumMember"); + assert.strictEqual(result.unionProp, 10); + }); + + it("versioning renamedFrom newInterface test", async () => { + const result = await client.newOpInNewInterface({ + newProp: "foo", + enumProp: "newEnumMember", + unionProp: 10 + }); + assert.strictEqual(result.newProp, "foo"); + assert.strictEqual(result.enumProp, "newEnumMember"); + assert.strictEqual(result.unionProp, 10); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/versioningReturnTypeChangedFrom.spec.ts b/packages/typespec-ts/test/azureModularIntegration/versioningReturnTypeChangedFrom.spec.ts new file mode 100644 index 0000000000..10c2dd4201 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/versioningReturnTypeChangedFrom.spec.ts @@ -0,0 +1,21 @@ +import { assert } from "chai"; +import { ReturnTypeChangedFromClient } from "./generated/versioning/returnTypeChangedFrom/src/index.js"; + +describe("VersioningReturnTypeChangedFrom Rest Client", () => { + let client: ReturnTypeChangedFromClient; + + beforeEach(() => { + client = new ReturnTypeChangedFromClient("http://localhost:3002", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning returnTypeChangedFrom test", async () => { + const result = await client.test("test", { + requestOptions: { + headers: { "content-type": "text/plain" } + } + }); + assert.strictEqual(result, "test"); + }); +}); diff --git a/packages/typespec-ts/test/azureModularIntegration/versioningTypeChangedFrom.spec.ts b/packages/typespec-ts/test/azureModularIntegration/versioningTypeChangedFrom.spec.ts new file mode 100644 index 0000000000..0531078f39 --- /dev/null +++ b/packages/typespec-ts/test/azureModularIntegration/versioningTypeChangedFrom.spec.ts @@ -0,0 +1,21 @@ +import { assert } from "chai"; +import { TypeChangedFromClient } from "./generated/versioning/typeChangedFrom/src/index.js"; + +describe("VersioningTypeChangedFrom Rest Client", () => { + let client: TypeChangedFromClient; + + beforeEach(() => { + client = new TypeChangedFromClient("http://localhost:3002", "v2", { + allowInsecureConnection: true + }); + }); + + it("versioning typeChangedFrom test", async () => { + const result = await client.test({ + prop: "foo", + changedProp: "bar" + }, "baz"); + assert.strictEqual(result.prop, "foo"); + assert.strictEqual(result.changedProp, "bar"); + }); +}); diff --git a/packages/typespec-ts/test/commands/cadl-ranch-list.js b/packages/typespec-ts/test/commands/cadl-ranch-list.js index 1664efa44c..e247761181 100644 --- a/packages/typespec-ts/test/commands/cadl-ranch-list.js +++ b/packages/typespec-ts/test/commands/cadl-ranch-list.js @@ -1,4 +1,4 @@ -export const rlcTsps = [ +export const azureRlcTsps = [ { outputPath: "routes", inputPath: "routes" @@ -295,17 +295,213 @@ export const rlcTsps = [ { outputPath: "encode/numeric", inputPath: "encode/numeric" + }, + { + outputPath: "azure/payload/pageable", + inputPath: "azure/payload/pageable" + }, + { + outputPath: "azure/example/basic", + inputPath: "azure/example/basic" } ]; -export const nonBrandedRlcTsps = [ +export const rlcTsps = [ + { + outputPath: "routes", + inputPath: "routes" + }, + { + outputPath: "payload/multipart", + inputPath: "payload/multipart" + }, + { + outputPath: "union-body", + inputPath: "union-body" + }, + { + outputPath: "special-headers/repeatability", + inputPath: "special-headers/repeatability" + }, + { + outputPath: "parameters/body-optionality", + inputPath: "parameters/body-optionality" + }, + { + outputPath: "shared-route", + inputPath: "shared-route" + }, + { + outputPath: "type/array", + inputPath: "type/array" + }, + { + outputPath: "authentication/api-key", + inputPath: "authentication/api-key" + }, + { + outputPath: "authentication/http/custom", + inputPath: "authentication/http/custom" + }, + { + outputPath: "authentication/oauth2", + inputPath: "authentication/oauth2" + }, + { + outputPath: "authentication/union", + inputPath: "authentication/union" + }, + { + outputPath: "type/dictionary", + inputPath: "type/dictionary" + }, + { + outputPath: "type/enum/extensible", + inputPath: "type/enum/extensible" + }, + { + outputPath: "type/enum/fixed", + inputPath: "type/enum/fixed" + }, + { + outputPath: "type/model/inheritance/nested-discriminator", + inputPath: "type/model/inheritance/nested-discriminator" + }, + { + outputPath: "type/model/inheritance/not-discriminated", + inputPath: "type/model/inheritance/not-discriminated" + }, + { + outputPath: "type/model/inheritance/enum-discriminator", + inputPath: "type/model/inheritance/enum-discriminator" + }, + { + outputPath: "type/model/inheritance/single-discriminator", + inputPath: "type/model/inheritance/single-discriminator" + }, + { + outputPath: "type/model/inheritance/recursive", + inputPath: "type/model/inheritance/recursive" + }, + { + outputPath: "type/property/optionality", + inputPath: "type/property/optionality" + }, + { + outputPath: "type/property/nullable", + inputPath: "type/property/nullable" + }, + { + outputPath: "type/model/visibility", + inputPath: "type/model/visibility" + }, { - outputPath: "models/usage", + outputPath: "type/model/usage", inputPath: "type/model/usage" + }, + { + outputPath: "type/model/empty", + inputPath: "type/model/empty" + }, + { + outputPath: "type/union", + inputPath: "type/union" + }, + { + outputPath: "parameters/collection-format", + inputPath: "parameters/collection-format" + }, + { + outputPath: "parameters/spread", + inputPath: "parameters/spread" + }, + { + outputPath: "server/path/single", + inputPath: "server/path/single" + }, + { + outputPath: "server/path/multiple", + inputPath: "server/path/multiple" + }, + { + outputPath: "type/scalar", + inputPath: "type/scalar" + }, + { + outputPath: "payload/media-type", + inputPath: "payload/media-type" + }, + { + outputPath: "serialization/encoded-name/json", + inputPath: "serialization/encoded-name/json" + }, + { + outputPath: "server/endpoint/not-defined", + inputPath: "server/endpoint/not-defined" + }, + { + outputPath: "server/versions/versioned", + inputPath: "server/versions/versioned" + }, + { + outputPath: "server/versions/not-versioned", + inputPath: "server/versions/not-versioned" + }, + { + outputPath: "payload/content-negotiation", + inputPath: "payload/content-negotiation" + }, + { + outputPath: "parameters/basic", + inputPath: "parameters/basic" + }, + { + outputPath: "versioning/added", + inputPath: "versioning/added" + }, + { + outputPath: "versioning/madeOptional", + inputPath: "versioning/madeOptional" + }, + { + outputPath: "versioning/renamedFrom", + inputPath: "versioning/renamedFrom" + }, + { + outputPath: "versioning/returnTypeChangedFrom", + inputPath: "versioning/returnTypeChangedFrom" + }, + { + outputPath: "versioning/typeChangedFrom", + inputPath: "versioning/typeChangedFrom" + }, + { + outputPath: "encode/numeric", + inputPath: "encode/numeric" + }, + { + outputPath: "encode/datetime", + inputPath: "encode/datetime" + }, + { + outputPath: "encode/bytes", + inputPath: "encode/bytes" + }, + { + outputPath: "encode/duration", + inputPath: "encode/duration" + }, + { + outputPath: "special-words", + inputPath: "special-words" + }, + { + outputPath: "type/property/value-types", + inputPath: "type/property/value-types" } ]; -export const modularTsps = [ +export const azureModularTsps = [ { outputPath: "azure/client-generator-core/flatten-property", inputPath: "azure/client-generator-core/flatten-property" @@ -395,10 +591,6 @@ export const modularTsps = [ outputPath: "type/model/inheritance/single-discriminator", inputPath: "type/model/inheritance/single-discriminator" }, - { - outputPath: "payload/pageable", - inputPath: "payload/pageable" - }, { outputPath: "encode/bytes", inputPath: "encode/bytes" @@ -571,12 +763,189 @@ export const modularTsps = [ { outputPath: "encode/numeric", inputPath: "encode/numeric" + }, + { + outputPath: "payload/pageable", + inputPath: "payload/pageable" + }, + { + outputPath: "azure/payload/pageable", + inputPath: "azure/payload/pageable" } ]; -export const nonBrandedModularTsps = [ +export const modularTsps = [ + { + outputPath: "parameters/body-optionality", + inputPath: "parameters/body-optionality" + }, { - outputPath: "models/usage", + outputPath: "type/model/usage", inputPath: "type/model/usage" + }, + { + outputPath: "parameters/collection-format", + inputPath: "parameters/collection-format" + }, + { + outputPath: "type/dictionary", + inputPath: "type/dictionary" + }, + { + outputPath: "type/property/nullable", + inputPath: "type/property/nullable" + }, + { + outputPath: "type/property/optionality", + inputPath: "type/property/optionality" + }, + { + outputPath: "type/model/inheritance/nested-discriminator", + inputPath: "type/model/inheritance/nested-discriminator" + }, + { + outputPath: "type/model/inheritance/not-discriminated", + inputPath: "type/model/inheritance/not-discriminated" + }, + { + outputPath: "type/model/inheritance/enum-discriminator", + inputPath: "type/model/inheritance/enum-discriminator" + }, + { + outputPath: "type/model/inheritance/single-discriminator", + inputPath: "type/model/inheritance/single-discriminator" + }, + { + outputPath: "encode/bytes", + inputPath: "encode/bytes" + }, + { + outputPath: "encode/duration", + inputPath: "encode/duration" + }, + { + outputPath: "encode/datetime", + inputPath: "encode/datetime" + }, + { + outputPath: "parameters/spread", + inputPath: "parameters/spread" + }, + { + outputPath: "server/path/single", + inputPath: "server/path/single" + }, + { + outputPath: "authentication/api-key", + inputPath: "authentication/api-key" + }, + { + outputPath: "authentication/http/custom", + inputPath: "authentication/http/custom" + }, + { + outputPath: "server/path/multiple", + inputPath: "server/path/multiple" + }, + { + outputPath: "authentication/oauth2", + inputPath: "authentication/oauth2" + }, + { + outputPath: "authentication/union", + inputPath: "authentication/union" + }, + { + outputPath: "special-headers/repeatability", + inputPath: "special-headers/repeatability" + }, + { + outputPath: "type/model/empty", + inputPath: "type/model/empty" + }, + { + outputPath: "type/property/value-types", + inputPath: "type/property/value-types" + }, + { outputPath: "type/array", inputPath: "type/array" }, + { + outputPath: "type/model/inheritance/recursive", + inputPath: "type/model/inheritance/recursive" + }, + { + outputPath: "type/union", + inputPath: "type/union" + }, + { + outputPath: "payload/media-type", + inputPath: "payload/media-type" + }, + { + outputPath: "server/versions/versioned", + inputPath: "server/versions/versioned" + }, + { + outputPath: "server/versions/not-versioned", + inputPath: "server/versions/not-versioned" + }, + { + outputPath: "type/scalar", + inputPath: "type/scalar" + }, + { + outputPath: "serialization/encoded-name/json", + inputPath: "serialization/encoded-name/json" + }, + { + outputPath: "server/endpoint/not-defined", + inputPath: "server/endpoint/not-defined" + }, + { + outputPath: "special-words", + inputPath: "special-words" + }, + { + outputPath: "type/enum/extensible", + inputPath: "type/enum/extensible" + }, + { + outputPath: "type/enum/fixed", + inputPath: "type/enum/fixed" + }, + { + outputPath: "payload/content-negotiation", + inputPath: "payload/content-negotiation" + }, + { + outputPath: "parameters/basic", + inputPath: "parameters/basic" + }, + { + outputPath: "versioning/added", + inputPath: "versioning/added" + }, + { + outputPath: "versioning/madeOptional", + inputPath: "versioning/madeOptional" + }, + { + outputPath: "versioning/removed", + inputPath: "versioning/removed" + }, + { + outputPath: "versioning/renamedFrom", + inputPath: "versioning/renamedFrom" + }, + { + outputPath: "versioning/returnTypeChangedFrom", + inputPath: "versioning/returnTypeChangedFrom" + }, + { + outputPath: "versioning/typeChangedFrom", + inputPath: "versioning/typeChangedFrom" + }, + { + outputPath: "encode/numeric", + inputPath: "encode/numeric" } ]; diff --git a/packages/typespec-ts/test/commands/gen-cadl-ranch.js b/packages/typespec-ts/test/commands/gen-cadl-ranch.js index 13ede97e64..97b15fbe45 100644 --- a/packages/typespec-ts/test/commands/gen-cadl-ranch.js +++ b/packages/typespec-ts/test/commands/gen-cadl-ranch.js @@ -1,7 +1,7 @@ import { modularTsps, - nonBrandedModularTsps, - nonBrandedRlcTsps, + azureModularTsps, + azureRlcTsps, rlcTsps } from "./cadl-ranch-list.js"; import { runTypespec } from "./run.js"; @@ -16,14 +16,14 @@ async function generateTypeSpecs(tag = "rlc", isDebugging, pathFilter) { case "modular": list = modularTsps; break; - case "non-branded-rlc": - list = nonBrandedRlcTsps; + case "azure-rlc": + list = azureRlcTsps; break; - case "non-branded-modular": - list = nonBrandedModularTsps; + case "azure-modular": + list = azureModularTsps; break; default: - list = rlcTsps; + list = modularTsps; break; } diff --git a/packages/typespec-ts/test/commands/run.ts b/packages/typespec-ts/test/commands/run.ts index 8c07d9d0ab..48e94a02ca 100644 --- a/packages/typespec-ts/test/commands/run.ts +++ b/packages/typespec-ts/test/commands/run.ts @@ -216,7 +216,7 @@ async function runTypespecHelper(env: GenEnv): Promise { async function entryPath(): Promise { const specPath = joinPath( emitterRoot(), - "./temp/http", + "./temp/specs", env.sourceTypespec() ); const possibleEntryPaths = ["client.tsp", "main.tsp"].map((filename) => @@ -239,7 +239,7 @@ async function runTypespecHelper(env: GenEnv): Promise { } function flavor() { - return env.mode().includes("non-branded") ? "non-branded" : "branded"; + return env.mode().includes("azure") ? "azure" : "standard"; } function clientType() { return env.mode().includes("modular") ? "modular" : "rlc"; @@ -247,11 +247,11 @@ async function runTypespecHelper(env: GenEnv): Promise { function outputPath() { const subPath = { - "non-branded": { - modular: "nonBrandedIntegration/modular", - rlc: "nonBrandedIntegration/rlc" + standard: { + modular: "modularIntegration", + rlc: "integration" }, - branded: { modular: "modularIntegration", rlc: "integration" } + azure: { modular: "azureModularIntegration", rlc: "azureIntegration" } }[flavor()][clientType()]; const outputPath = joinPath( diff --git a/packages/typespec-ts/test/integration/collectionFormat.spec.ts b/packages/typespec-ts/test/integration/collectionFormat.spec.ts index 65ab7d6d9d..99c0be2ca0 100644 --- a/packages/typespec-ts/test/integration/collectionFormat.spec.ts +++ b/packages/typespec-ts/test/integration/collectionFormat.spec.ts @@ -85,6 +85,17 @@ describe("Collection Format Rest Client", () => { assert.strictEqual(result.status, "204"); }); + it("should serialize tsv format query array parameter", async () => { + const result = await client + .path("/parameters/collection-format/query/tsv") + .get({ + queryParameters: { + colors: colors.join("\t") + } + }); + assert.strictEqual(result.status, "204"); + }); + it("should serialize pipes format query array parameter", async () => { const result = await client .path("/parameters/collection-format/query/pipes") diff --git a/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts index 5fc0b799e1..de9843e1df 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/api-key/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { KeyCredential } from '@azure/core-auth'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { KeyCredential } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type AuthApiKeyClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml index fcf7239bc5..966e076176 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/api-key/tspconfig.yaml @@ -3,10 +3,10 @@ emit: options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthApiKeyClient packageDetails: - name: "@msinternal/auth-apikey" + name: "@unbranded/auth-apikey" description: "Auth api key Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts index 27928f70d8..2998619c59 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/http/custom/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { KeyCredential } from '@azure/core-auth'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { KeyCredential } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type AuthHttpCustomClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml index cd90c8cee8..708ad88746 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/http/custom/tspconfig.yaml @@ -3,10 +3,10 @@ emit: options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthHttpCustomClient packageDetails: - name: "@msinternal/auth-httpcustom" + name: "@unbranded/auth-httpcustom" description: "Auth Http Custom Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts index 1fd63f991c..93ab9bf8a0 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/oauth2/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; -import type { TokenCredential } from '@azure/core-auth'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; +import type { TokenCredential } from '@typespec/ts-http-runtime'; export declare type AuthOauth2Client = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml index 6f010339a7..7f66af592c 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/oauth2/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: true - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthOauth2Client packageDetails: - name: "@msinternal/auth-oauth2" + name: "@unbranded/auth-oauth2" description: "Auth oauth2 Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts b/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts index 3164bcc0dd..69826a9332 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/authentication/union/src/index.d.ts @@ -1,10 +1,10 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { KeyCredential } from '@azure/core-auth'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; -import type { TokenCredential } from '@azure/core-auth'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { KeyCredential } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; +import type { TokenCredential } from '@typespec/ts-http-runtime'; export declare type AuthUnionClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml index 4d76803e4e..da29489b1a 100644 --- a/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/authentication/union/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: true - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: AuthUnionClient packageDetails: - name: "@msinternal/auth-union" + name: "@unbranded/auth-union" description: "Auth Union Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts index 819afe802c..e18e541981 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/src/index.d.ts @@ -1,10 +1,10 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Base64BytesProperty { value: string; diff --git a/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml index 734e47351e..1141d953cf 100644 --- a/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/bytes/tspconfig.yaml @@ -4,10 +4,9 @@ options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" generateMetadata: true - generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-bytes" + name: "@unbranded/encode-bytes" diff --git a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts index f84dcf7f29..1962a0d4b9 100644 --- a/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/datetime/src/index.d.ts @@ -1,10 +1,10 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare function buildCsvCollection(items: string[] | number[]): string; diff --git a/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml index 010a839f0a..44a09ba726 100644 --- a/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/datetime/tspconfig.yaml @@ -4,10 +4,9 @@ options: "@azure-tools/typespec-ts": "emitter-output-dir": "{project-root}" generateMetadata: true - generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-datetime" + name: "@unbranded/encode-datetime" diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts index 42736307d5..df04308e86 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/duration/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare function buildCsvCollection(items: string[] | number[]): string; diff --git a/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml index 5b0e79e874..b4d65f1695 100644 --- a/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/duration/tspconfig.yaml @@ -5,8 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-duration" + name: "@unbranded/encode-duration" diff --git a/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts b/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts index 754b622f6b..468096b046 100644 --- a/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/encode/numeric/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: NumericClientOptions): NumericClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml index b6bd24941b..dd4c5dc131 100644 --- a/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/encode/numeric/tspconfig.yaml @@ -5,8 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/encode-numeric" + name: "@unbranded/encode-numeric" diff --git a/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts index 63b3b02083..b8e2fcb4d9 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/basic/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type BasicClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml index b9742c37ec..6b36a8e2af 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/basic/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true isTypeSpecTest: true packageDetails: - name: "@msinternal/parameterBasic" + name: "@unbranded/parameterBasic" diff --git a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts index 17563456de..8cc8e774b9 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BodyModel { name: string; diff --git a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml index ebfed5c478..4ce9910372 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/body-optionality/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true isTypeSpecTest: true packageDetails: - name: "@msinternal/collectionFormat" + name: "@unbranded/collectionFormat" diff --git a/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts index 97d913289d..c24d5610e4 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/collection-format/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare function buildCsvCollection(items: string[] | number[]): string; diff --git a/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml index 25e4be7579..da6eb41074 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/collection-format/tspconfig.yaml @@ -6,11 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true compatibilityQueryMultiFormat: true isTypeSpecTest: true title: CollectionFormatClient packageDetails: - name: "@msinternal/collectionFormat" + name: "@unbranded/collectionFormat" description: "CollectionFormat Test Service" diff --git a/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts b/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts index baa647880d..cee9289926 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/parameters/spread/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface AliasSpreadAsRequestBody { put(options: AliasSpreadAsRequestBodyParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml index 8d064e4dcd..35a8a193bf 100644 --- a/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/parameters/spread/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false enableOperationGroup: true isTypeSpecTest: true packageDetails: - name: "@msinternal/parameterSpread" + name: "@unbranded/parameterSpread" diff --git a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts index 34ae3fd4ca..119e34c057 100644 --- a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/src/index.d.ts @@ -1,10 +1,10 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type ContentNegotiationClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml index 936f5d0a1c..17a40e59f4 100644 --- a/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/content-negotiation/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/payload-content-negotiation" \ No newline at end of file + name: "@unbranded/payload-content-negotiation" diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts b/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts index 3f09ace33b..f5baeafba7 100644 --- a/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: MediaTypeClientOptions): MediaTypeClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml index a5b574817b..dd34458d64 100644 --- a/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/media-type/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/payload-media-type" + name: "@unbranded/payload-media-type" diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts b/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts index bf63630040..62f2b114b2 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Address { city: string; diff --git a/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml index 08196f9142..c65f8055ad 100644 --- a/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/payload/multipart/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/payload-multipart" + name: "@unbranded/payload-multipart" diff --git a/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts b/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts index 5d08b70677..dce58e7547 100644 --- a/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/routes/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: RoutesClientOptions): RoutesClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml index ba69ca1b18..027528c988 100644 --- a/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/routes/tspconfig.yaml @@ -5,9 +5,9 @@ options: "emitter-output-dir": "{project-root}" generateTest: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: RoutesClient packageDetails: - name: "@msinternal/routes" + name: "@unbranded/routes" description: "Routes Test Service" diff --git a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts index 42c1c812d7..b5cf7fed43 100644 --- a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: SerializationEncodedNameJsonClientOptions): SerializationEncodedNameJsonClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml index c63bf5394b..9d4b150b91 100644 --- a/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/serialization/encoded-name/json/tspconfig.yaml @@ -6,10 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: SerializationEncodedNameJsonClient enableOperationGroup: true packageDetails: - name: "@msinternal/serialization-encoded-name-json" + name: "@unbranded/serialization-encoded-name-json" description: "Serialization Encoded Name Json Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts index d83e5e08ec..b6d7ab1d23 100644 --- a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: NotDefinedParamInServerEndpointClientOptions): NotDefinedParamInServerEndpointClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml index 6ebd95f350..d020cf667a 100644 --- a/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/endpoint/not-defined/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: NotDefinedParamInServerEndpointClient packageDetails: - name: "@msinternal/notdefinedparam" + name: "@unbranded/notdefinedparam" description: "NotDefinedParameter Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts index c2d424a64d..d25450adb4 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, { apiVersion, ...options }?: MultipleParamInServerPathClientOptions): MultipleParamInServerPathClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml index 4298357b12..39d16dc36d 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/path/multiple/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: MultipleParamInServerPathClient packageDetails: - name: "@msinternal/multipleparam" + name: "@unbranded/multipleparam" description: "MultipleParameter Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts index e868628331..13f9a0329b 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/path/single/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: SingleParamInServerPathClientOptions): SingleParamInServerPathClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml index 56938c9e4c..5c27ee10ae 100644 --- a/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/path/single/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: SingleParamInServerPathClient packageDetails: - name: "@msinternal/singleparam" + name: "@unbranded/singleparam" description: "SingleParameter Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts index 02f064b0bd..d37ad18607 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: NotVersionedParamInServerVersionsClientOptions): NotVersionedParamInServerVersionsClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml index 0db07d2a01..cac48be5c5 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/versions/not-versioned/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: NotVersionedParamInServerVersionsClient packageDetails: - name: "@msinternal/not-versioned" + name: "@unbranded/not-versioned" description: "Not-versioned Test Service" diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts index 9f1d80128d..f47af935af 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, options?: VersionedParamInServerVersionsClientOptions): VersionedParamInServerVersionsClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml index 807c51f80b..4c7edd0d40 100644 --- a/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/server/versions/versioned/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true title: VersionedParamInServerVersionsClient packageDetails: - name: "@msinternal/versioned" + name: "@unbranded/versioned" description: "Versioned Test Service" diff --git a/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts b/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts index 6f63f54f83..0c677baa0c 100644 --- a/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/shared-route/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient($host: string, options?: SharedRouteClientOptions): SharedRouteClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml index 390011f6fa..3b047335e3 100644 --- a/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/shared-route/tspconfig.yaml @@ -5,7 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/media-types" + name: "@unbranded/media-types" diff --git a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts index 7506462e55..5cc3d6d564 100644 --- a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/src/index.d.ts @@ -1,10 +1,10 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeaders } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: RepeatabilityClientOptions): RepeatabilityClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml index b51d512152..0962a2746c 100644 --- a/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/special-headers/repeatability/tspconfig.yaml @@ -6,7 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/repeatable-header" + name: "@unbranded/repeatable-header" diff --git a/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts b/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts index 92a7505959..db24397493 100644 --- a/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/special-words/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface And { name: string; diff --git a/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml index 9ac3a40dd4..f8142c2564 100644 --- a/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/special-words/tspconfig.yaml @@ -7,9 +7,10 @@ options: generateTest: false addCredentials: false azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true title: SpecialWordsClient packageDetails: - name: "@msinternal/special-words" + name: "@unbranded/special-words" description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts index bf8e197caa..140c31adb3 100644 --- a/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/array/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type ArrayItemTypesClient = Client & { path: Routes; diff --git a/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml index 6b8ad9feff..f5a80ab302 100644 --- a/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/array/tspconfig.yaml @@ -6,12 +6,12 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: ArrayItemTypesClient enableOperationGroup: true packageDetails: - name: "@msinternal/array-itemtypes" + name: "@unbranded/array-itemtypes" description: "Array item-types Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts index 4a9686f097..b43b9e7a9f 100644 --- a/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/dictionary/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanValueGet { get(options?: BooleanValueGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml index 3a99986a91..537b8b6df0 100644 --- a/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/dictionary/tspconfig.yaml @@ -6,12 +6,12 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: DictClient enableOperationGroup: true packageDetails: - name: "@msinternal/dictionary" + name: "@unbranded/dictionary" description: "Dictionary Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts index 50cb50ba2a..8a2306e373 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/enum/extensible/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: ExtensibleClientOptions): ExtensibleClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml index 98963a616d..1f746f21a1 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/enum/extensible/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/extensible-enums" + name: "@unbranded/extensible-enums" description: "Extensible Enums Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts index 489b419611..3d0ff3de4a 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/enum/fixed/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: FixedClientOptions): FixedClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml index 99e61c06ed..5a8559f9b8 100644 --- a/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/enum/fixed/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/extensible-fixed" + name: "@unbranded/extensible-fixed" description: "Fixed Enums Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts index 5643f7d3e5..06959adce7 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/empty/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: EmptyClientOptions): EmptyClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml index c51cf5c73b..e9c60eee9b 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/empty/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/empty-model" + name: "@unbranded/empty-model" description: "Empty model Service" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts index 3b0565a66b..a41ae82257 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Cobra extends SnakeParent { kind: "cobra"; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml index 87dc7807c4..daaca4af1f 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance-enum-discriminator" + name: "@unbranded/model-inheritance-enum-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts index cdb3189d1d..b4239b6fa5 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: NestedDiscriminatorClientOptions): NestedDiscriminatorClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml index a5613954e7..eb3ee42145 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance" + name: "@unbranded/model-inheritance" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts index 4476baeabb..efdaf9189e 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Cat extends Pet { age: number; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml index c4048faf70..5e3e30d11d 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance-not-discriminated" + name: "@unbranded/model-inheritance-not-discriminated" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts index 977a95016b..51c60f48c3 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: RecursiveClientOptions): RecursiveClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml index 888b181216..f83b49f20a 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/recursive/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/inheritance-recursive" + name: "@unbranded/inheritance-recursive" description: "recursive Service" diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts index 9fd72ef0b2..0d7bf0dce2 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare type Bird = BirdParent | SeaGull | Sparrow | Goose | Eagle; diff --git a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml index 6fb5cb68cf..18374f2cd6 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/model-inheritance-single-discriminator" + name: "@unbranded/model-inheritance-single-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts index 58fad35d47..add3437667 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/usage/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: UsageClientOptions): UsageClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml index 3afa886288..fdbf7a79c0 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/usage/tspconfig.yaml @@ -7,8 +7,8 @@ options: generateTest: false addCredentials: false isTypeSpecTest: true - azureSdkForJs: false + isModularLibrary: false packageDetails: - name: "@msinternal/usage" + name: "@unbranded/usage" description: "Usage Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts index bf798db9a7..06b5ecbd78 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/model/visibility/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(options?: VisibilityClientOptions): VisibilityClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml index ec2f0be158..7fb2e7ef68 100644 --- a/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/model/visibility/tspconfig.yaml @@ -6,9 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true packageDetails: - name: "@msinternal/visibility" + name: "@unbranded/visibility" description: "Visibility Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts index 7d82ace333..2848e7abf6 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/nullable/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BytesGetNonNull { get(options?: BytesGetNonNullParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml index cce2c68f8d..453c26798d 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/property/nullable/tspconfig.yaml @@ -6,10 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/nullable-property" + name: "@unbranded/nullable-property" description: "Nullable Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts index 375f882bef..3a2727d2e6 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/optionality/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanLiteralGetAll { get(options?: BooleanLiteralGetAllParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml index 9fe1b41098..613e09cfc6 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/property/optionality/tspconfig.yaml @@ -6,10 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/optional-property" + name: "@unbranded/optional-property" description: "Optional Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts index b2427ae1b9..f0f358f015 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/property/value-types/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanLiteralGet { get(options?: BooleanLiteralGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml index e9f9208568..2b2657c1e4 100644 --- a/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/property/value-types/tspconfig.yaml @@ -7,9 +7,10 @@ options: generateTest: false addCredentials: false azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/property-types" + name: "@unbranded/property-types" description: "Property Types Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts index a1aaed24a0..63a8cb40d6 100644 --- a/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/scalar/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface BooleanModelGet { get(options?: BooleanModelGetParameters): StreamableMethod; diff --git a/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml index bdd42b8b22..ab2f084297 100644 --- a/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/scalar/tspconfig.yaml @@ -6,8 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true enableOperationGroup: true packageDetails: - name: "@msinternal/scalar" + name: "@unbranded/scalar" diff --git a/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts index 3998ae3d12..0fcdfdcb90 100644 --- a/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/type/union/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface Cat { name: string; diff --git a/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml index 6c2f4da2a0..0c39df57d5 100644 --- a/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/type/union/tspconfig.yaml @@ -5,11 +5,11 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: UnionsClient experimentalExtensibleEnums: true packageDetails: - name: "@msinternal/unions" + name: "@unbranded/unions" description: "Unions Test Service" diff --git a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts index 524b0c712b..ebef0f1128 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/union-body/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; export declare interface CommonRegistrationRequest { payMethod: PaymentMethods; diff --git a/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml index 8bd5a4a8fa..26590cdd45 100644 --- a/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/union-body/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: true addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: UnionBodyClient packageDetails: - name: "@msinternal/union-body" + name: "@unbranded/union-body" description: "Union Body Test Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts index 64aa1a8410..806abf19ac 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/added/src/index.d.ts @@ -1,9 +1,9 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RawHttpHeadersInput } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningAddedClientOptions): VersioningAddedClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml index 4f39a9aa30..f3fecaa5a3 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/added/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningAddedClient packageDetails: - name: "@msinternal/versioning-added" + name: "@unbranded/versioning-added" description: "Versioning Added Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts index 8add70364a..bb45e10034 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningMadeOptionalClientOptions): VersioningMadeOptionalClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml index ec693ec76f..4c13c8e7c1 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/madeOptional/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningMadeOptionalClient packageDetails: - name: "@msinternal/versioning-madeOptional" + name: "@unbranded/versioning-madeOptional" description: "Versioning MadeOptional Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts index aad88a477f..4957fa1f2e 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningRenamedFromClientOptions): VersioningRenamedFromClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml index ea3e7dddf6..c0e5e99b32 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/renamedFrom/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningRenamedFromClient packageDetails: - name: "@msinternal/versioning-renamedFrom" + name: "@unbranded/versioning-renamedFrom" description: "Versioning RenamedFrom Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts index 9e4161e665..f138a3ac74 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningReturnTypeChangedFromClientOptions): VersioningReturnTypeChangedFromClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml index 4a8c2f9f6c..0c3385a89a 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningReturnTypeChangedFromClient packageDetails: - name: "@msinternal/versioning-returnTypeChangedFrom" + name: "@unbranded/versioning-returnTypeChangedFrom" description: "Versioning ReturnTypeChangedFrom Service" diff --git a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts index 267cf511ee..f9847434ae 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/src/index.d.ts @@ -1,8 +1,8 @@ -import type { Client } from '@azure-rest/core-client'; -import type { ClientOptions } from '@azure-rest/core-client'; -import type { HttpResponse } from '@azure-rest/core-client'; -import type { RequestParameters } from '@azure-rest/core-client'; -import type { StreamableMethod } from '@azure-rest/core-client'; +import type { Client } from '@typespec/ts-http-runtime'; +import type { ClientOptions } from '@typespec/ts-http-runtime'; +import type { HttpResponse } from '@typespec/ts-http-runtime'; +import type { RequestParameters } from '@typespec/ts-http-runtime'; +import type { StreamableMethod } from '@typespec/ts-http-runtime'; declare function createClient(endpointParam: string, version: Versions, options?: VersioningTypeChangedFromClientOptions): VersioningTypeChangedFromClient; export default createClient; diff --git a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml index 66f56b3ca5..2abecf793c 100644 --- a/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/integration/generated/versioning/typeChangedFrom/tspconfig.yaml @@ -5,10 +5,10 @@ options: "emitter-output-dir": "{project-root}" generateTest: false addCredentials: false - azureSdkForJs: false + isModularLibrary: false isTypeSpecTest: true generateSample: true title: VersioningTypeChangedFromClient packageDetails: - name: "@msinternal/versioning-typeChangedFrom" + name: "@unbranded/versioning-typeChangedFrom" description: "Versioning TypeChangedFrom Service" diff --git a/packages/typespec-ts/test/integration/payloadPageable.spec.ts b/packages/typespec-ts/test/integration/payloadPageable.spec.ts deleted file mode 100644 index 9637d30485..0000000000 --- a/packages/typespec-ts/test/integration/payloadPageable.spec.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { assert } from "chai"; -import PageableClientFactory, { - PageableClient, - UserOutput, - paginate -} from "./generated/payload/pageable/src/index.js"; - -describe("Pageable Client", () => { - let client: PageableClient; - - beforeEach(() => { - client = PageableClientFactory({ - allowInsecureConnection: true, - retryOptions: { - maxRetries: 0 - } - }); - }); - - it("should get pagable list without skiptoken", async () => { - const result = await client - .path("/payload/pageable") - .get({ queryParameters: { maxpagesize: 3 } }); - assert.strictEqual(result.status, "200"); - assert.strictEqual(result.body.value[0]?.name, "user5"); - assert.strictEqual(result.body.value[1]?.name, "user6"); - assert.strictEqual(result.body.value[2]?.name, "user7"); - assert.strictEqual( - result.body.nextLink, - "http://localhost:3000/payload/pageable?skipToken=name-user7&maxpagesize=3" - ); - }); - - it("should get pagable list with skiptoken", async () => { - const result = await client - .path("/payload/pageable") - .get({ queryParameters: { maxpagesize: 3, skipToken: "name-user7" } }); - assert.strictEqual(result.status, "200"); - assert.strictEqual(result.body.value[0]?.name, "user8"); - }); - - it("should get pagable list with wrong skiptoken", async () => { - const result = await client - .path("/payload/pageable") - .get({ queryParameters: { maxpagesize: 3, skipToken: "wrong value" } }); - assert.strictEqual(result.status, "400"); - assert.strictEqual( - (result.body as any).message, - "Unsupported skipToken query parameter" - ); - assert.strictEqual( - (result.body as any).expected, - `Not provided for first page, "name-user7" for second page` - ); - assert.strictEqual((result.body as any).actual, "wrong value"); - }); - - it("should get pagable list", async () => { - const initialResponse = await client - .path("/payload/pageable") - .get({ queryParameters: { maxpagesize: 3 } }); - - const iter = paginate(client, initialResponse); - - let result: UserOutput[] = []; - for await (const item of iter) { - result.push(item); - } - - assert.deepEqual(result, [ - { name: "user5" }, - { name: "user6" }, - { name: "user7" }, - { name: "user8" } - ]); - }); -}); diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts index 519d8e6934..1a8c187551 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts @@ -1,7 +1,7 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { KeyCredential } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ApiKeyClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml index 96a97c860c..3672fc97c5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/tspconfig.yaml @@ -5,10 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-api-key" + name: "@unbranded/azure-api-key" description: "Azure API Key Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts index 5f729c295e..70b1f055b2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts @@ -1,7 +1,7 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { KeyCredential } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class CustomClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml index 4fe7f76e6f..d376908d99 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/tspconfig.yaml @@ -5,10 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-http-custom" + name: "@unbranded/azure-http-custom" description: "Azure Http Custom Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts index 028d21f5e9..70348651f7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts @@ -1,7 +1,7 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { TokenCredential } from '@azure/core-auth'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; +import { TokenCredential } from '@typespec/ts-http-runtime'; export declare interface InvalidOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml index 4360fa3fd0..b209ee6a49 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/tspconfig.yaml @@ -5,10 +5,8 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-oauth2" + name: "@unbranded/azure-oauth2" description: "Azure Oauth2 Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts index 96ce7bf62b..c8f8606866 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/src/index.d.ts @@ -1,8 +1,8 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { KeyCredential } from '@azure/core-auth'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { TokenCredential } from '@azure/core-auth'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { KeyCredential } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; +import { TokenCredential } from '@typespec/ts-http-runtime'; export declare class UnionClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml index 3fb83a573e..18528c761c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/union/tspconfig.yaml @@ -5,10 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-auth-union" - description: "Azure Auth Union Test Service" + name: "@unbranded/azure-auth-union" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts index b031f9cf37..88ab9583c1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Base64BytesProperty { value: Uint8Array; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml index 1d81b2c952..4ad37ff4e5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/bytes/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-bytes" + name: "@unbranded/encode-bytes" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts index 8ed5a8c89a..86d9569fe3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class DatetimeClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml index 001e59ab51..435c9bd32f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/datetime/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-datatime" + name: "@unbranded/encode-datatime" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts index a0dd0c9b57..8965a735bc 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface DefaultDurationProperty { value: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml index 727c2b53b7..ca533b2df4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/duration/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-duration" + name: "@unbranded/encode-duration" diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts index 287846bfd0..36a6f941a4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class NumericClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml index f867d3e667..fdd2eeb2fe 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/encode/numeric/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/encode-numeric" + name: "@unbranded/encode-numeric" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts index 819ac7181b..680a4251eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class BasicClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml index c1cacabe4a..66a1200bd2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/basic/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false enableOperationGroup: true isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/parameterBasic" + name: "@unbranded/parameterBasic" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts index 666db44d14..570d529906 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BodyModel { name: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml index 40fa7f26f6..1d0269ef66 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/body-optionality/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/body-optionality" + name: "@unbranded/body-optionality" description: "Parameter Body Optionality Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts index 4de5b37875..87f449f9c3 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class CollectionFormatClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml index c5b408db17..efd0f3f7db 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/collection-format/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/azure-collection-format" + name: "@unbranded/azure-collection-format" description: "Azure Collection Format Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts index c57d6c8d7f..07f162d45e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface AliasOperations { spreadParameterWithInnerAlias: (id: string, name: string, age: number, xMsTestHeader: string, options?: AliasSpreadParameterWithInnerAliasOptionalParams) => Promise; diff --git a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml index 6c55570de8..adb8ce8b9a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/parameters/spread/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false enableOperationGroup: true isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/parameterSpread" + name: "@unbranded/parameterSpread" diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts index a1bac61e87..b5b7e0f221 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ContentNegotiationClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml index 6e43646a11..d32010170f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/content-negotiation/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/payload-content-negotiation" + name: "@unbranded/payload-content-negotiation" description: "Payload Content Negotiation Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts index 7539463102..b6bade1d64 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class MediaTypeClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml index f2f1bc6d66..5fcdcd7704 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/payload/media-type/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/payload-mediaType" + name: "@unbranded/payload-mediaType" description: "Payload Media Type Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts index 4898f205ec..75984d9716 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface GetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml index be5f36c986..6991cfff72 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/serialization/encoded-name/json/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: SerializationEncodedNameJsonClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/serialization-encoded-name-json" + name: "@unbranded/serialization-encoded-name-json" description: "Serialization Encoded Name Json Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts index 26662d6d1e..df020c3387 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class NotDefinedClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml index e19a4c2337..ac27cf07d7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/endpoint/not-defined/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: NotDefinedParamInServerEndpointClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/notdefinedparam" + name: "@unbranded/notdefinedparam" description: "NotDefinedParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts index 90f3fe2998..929c106eba 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class MultipleClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml index c5ef84bbf8..4f5ebb1a47 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/multiple/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: MultipleParamInServerPathClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/multipleparam" + name: "@unbranded/multipleparam" description: "MultipleParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts index 3bf8a1a437..e7c8f60ccf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface MyOpOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml index ff45f2f128..b98318ec1f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/path/single/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: SingleParamInServerPathClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/singleparam" + name: "@unbranded/singleparam" description: "SingleParameter Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts index 00b750b873..4faf5b242a 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class NotVersionedClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml index 81d21cf77d..097ddf8f38 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/not-versioned/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: NotVersionedParamInServerVersionsClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/not-versioned" + name: "@unbranded/not-versioned" description: "NotVersioned Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts index b2be835076..08a98ad7f9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare enum KnownVersions { v2021_01_01_preview = "2021-01-01-preview", diff --git a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml index 6fdcf3e495..50f3457f57 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/server/versions/versioned/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersionedParamInServerVersionsClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versioned" + name: "@unbranded/versioned" description: "Versioned Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts index 21e9bdb2f7..498e18f0f9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface ImmediateSuccessOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml index fa92a6dace..debfcbd8be 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/special-headers/repeatability/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/headers-repeatability" + name: "@unbranded/headers-repeatability" diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts index 1cdcb34aa9..d15514dbc2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/special-words/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface And { name: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml index fdfa61f010..a1286921ea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/special-words/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: SpecialWordsClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/special-words" + name: "@unbranded/special-words" description: "Special Words Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts index 6cbb0f1789..e911c2d87d 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/array/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ArrayClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml index 56f18cfab5..18c62164b8 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/array/tspconfig.yaml @@ -5,9 +5,7 @@ options: "emitter-output-dir": "{project-root}" generateMetadata: true generateTest: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/arrays-item-types" + name: "@unbranded/arrays-item-types" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts index 7f436b2287..108c35088f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanValueGetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml index 60327cff7d..86d23b6456 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/dictionary/tspconfig.yaml @@ -6,13 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true # temporary only support legacy client for additional properties in modular compatibilityMode: true packageDetails: - name: "@msinternal/dictionary" + name: "@unbranded/dictionary" description: "Dictionary Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts index 0b6947054e..40b84b4b1c 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type DaysOfWeekExtensibleEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml index 3566336d74..1d9b3856cf 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/extensible/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/extensible-enums" + name: "@unbranded/extensible-enums" description: "Extensible Enums Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts index f5fe843f17..0070af7269 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type DaysOfWeekEnum = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml index 8e3a29dd9b..1dcd2bde62 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/enum/fixed/tspconfig.yaml @@ -6,9 +6,7 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/fixed-enums" + name: "@unbranded/fixed-enums" description: "Enums Fixed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts index ef81818e57..2952fce930 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class EmptyClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml index ae7bacef86..f13882436f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/empty/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/modular-model-empty" + name: "@unbranded/modular-model-empty" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts index 20a1c6d030..b774295bc5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Cobra extends Snake { kind: "cobra"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml index 073a21294e..4878328125 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/enum-discriminator/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-enum-discriminator" + name: "@unbranded/model-inheritance-enum-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts index 64bf16dfe4..7aa7b91781 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Fish { kind: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml index 7b0bdf9fb7..a47a9d1922 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/nested-discriminator/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-nested-discriminator" + name: "@unbranded/model-inheritance-nested-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts index b41328d759..77493a6b73 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Cat extends Pet { age: number; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml index 28df6de8d9..c6bb13e460 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/not-discriminated/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-not-discriminated" + name: "@unbranded/model-inheritance-not-discriminated" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts index c6777a5ecb..fe19c5b9da 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; declare interface Element_2 { extension?: Extension[]; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml index e8efa39fb6..dcead3e1b9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/recursive/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/model-inheritance-recursive" + name: "@unbranded/model-inheritance-recursive" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts index 1af2d7be19..9b0283851f 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Bird { kind: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml index 3e48c59304..74614eaf05 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/inheritance/single-discriminator/tspconfig.yaml @@ -6,10 +6,8 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true - isModularLibrary: true packageDetails: - name: "@msinternal/model-inheritance-single-discriminator" + name: "@unbranded/model-inheritance-single-discriminator" description: "Model Inheritance Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts index 6331da3ee0..dd6ad6fec4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface InputAndOutputOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml index 4772e70667..8651b4dc59 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/model/usage/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/modular-model-usage" + name: "@unbranded/modular-model-usage" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts index 2fdba31b3f..485b4ca5ea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BytesGetNonNullOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml index 989ea7a2ef..f5d1643bf9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/nullable/tspconfig.yaml @@ -6,13 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true # temporary only support legacy client for additional properties in modular compatibilityMode: true packageDetails: - name: "@msinternal/nullable-property" + name: "@unbranded/nullable-property" description: "nullable Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts index 464c6a85a1..aaad74b0f6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanLiteralGetAllOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml index d655511f02..8fa990db33 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/optionality/tspconfig.yaml @@ -6,13 +6,11 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true enableOperationGroup: true - isModularLibrary: true # temporary only support legacy client for additional properties in modular compatibilityMode: true packageDetails: - name: "@msinternal/optional-property" + name: "@unbranded/optional-property" description: "Optional Property Test Service" version: "1.0.0" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts index 857c4d2a2e..a3bae4b194 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanGetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml index d34d405313..77f5e79bea 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/property/value-types/tspconfig.yaml @@ -4,9 +4,7 @@ options: "@azure-tools/typespec-ts": generateMetadata: true generateTest: false - azureSdkForJs: false - isModularLibrary: true hierarchyClient: false "emitter-output-dir": "{project-root}" packageDetails: - name: "@msinternal/modular-model-propertyTypes" + name: "@unbranded/modular-model-propertyTypes" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts index 8c32ce0c65..2069909b63 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface BooleanGetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml index a5c5386cb0..1d16764ce9 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/scalar/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: ScalarClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/scalar" + name: "@unbranded/scalar" description: "Scalar client" diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts index 92dfc0452b..13b4e108e6 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface Cat { name: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml index e32cbbb3e4..c2ca9fa639 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/type/union/tspconfig.yaml @@ -6,12 +6,10 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: UnionClient - isModularLibrary: true hierarchyClient: false experimentalExtensibleEnums: true packageDetails: - name: "@msinternal/union" + name: "@unbranded/union" description: "Union client" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts index 94789a31a6..0f38becee2 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class AddedClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml index 6a3383b3fa..8c1436a662 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/added/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningAddedClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-added" + name: "@unbranded/versionning-added" description: "Versioning Added Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts index 329eb2b8a6..4b88e972eb 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class MadeOptionalClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml index 8a6c24db34..353ca983d5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/madeOptional/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningMadeOptionalClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-madeOptional" + name: "@unbranded/versionning-madeOptional" description: "Versioning MadeOptional Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts index 03b965f7ce..a68817b5c5 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type EnumV2 = "enumMemberV2"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml index 2fe3f4e2f9..d7369441b1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/removed/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningRemovedClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-removed" + name: "@unbranded/versionning-removed" description: "Versioning Removed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts index f1ed550f89..30e3a64b80 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare type NewEnum = "newEnumMember"; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml index 51ae79d53c..0ad76c8428 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/renamedFrom/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningRenamedFromClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-renamedFrom" + name: "@unbranded/versionning-renamedFrom" description: "Versioning Renamed Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts index ada90270f7..e210698c60 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare class ReturnTypeChangedFromClient { private _client; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml index e775c589bd..23208274c7 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/returnTypeChangedFrom/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningReturnTypeChangedFromClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-returnTypeChangedFrom" + name: "@unbranded/versionning-returnTypeChangedFrom" description: "Versioning ReturnTypeChanged Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts index 59c28ab532..92624395bd 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/src/index.d.ts @@ -1,6 +1,6 @@ -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; +import { ClientOptions } from '@typespec/ts-http-runtime'; +import { OperationOptions } from '@typespec/ts-http-runtime'; +import { Pipeline } from '@typespec/ts-http-runtime'; export declare interface TestModel { prop: string; diff --git a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml index 2dfcc997a6..7bdd7224e1 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml +++ b/packages/typespec-ts/test/modularIntegration/generated/versioning/typeChangedFrom/tspconfig.yaml @@ -6,11 +6,9 @@ options: generateMetadata: true generateTest: false addCredentials: false - azureSdkForJs: false isTypeSpecTest: true title: VersioningTypeChangedFromClient - isModularLibrary: true hierarchyClient: false packageDetails: - name: "@msinternal/versionning-typeChangedFrom" + name: "@unbranded/versionning-typeChangedFrom" description: "Versioning TypeChanged Test Service" diff --git a/packages/typespec-ts/test/modularIntegration/payloadPageable.spec.ts b/packages/typespec-ts/test/modularIntegration/payloadPageable.spec.ts deleted file mode 100644 index 283fa2b06c..0000000000 --- a/packages/typespec-ts/test/modularIntegration/payloadPageable.spec.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { - PageableClient, - User -} from "./generated/payload/pageable/src/index.js"; -import { assert } from "chai"; - -describe("PageableClient Classical Client", () => { - let client: PageableClient; - - beforeEach(() => { - client = new PageableClient({ - endpoint: "http://localhost:3002", - allowInsecureConnection: true - }); - }); - - it("should throw exceptions if no maxpagesize set", async () => { - const iter = client.list(); - const items = []; - try { - for await (const user of iter) { - items.push(user); - } - assert.fail("Should throw exception"); - } catch (err: any) { - assert.isNotNull(err); - assert.strictEqual( - err.message, - "Pagination failed with unexpected statusCode 400" - ); - } - }); - - it("should list all users if maxpagesize=3", async () => { - const iter = client.list({ - maxpagesize: 3 - }); - const items = []; - for await (const user of iter) { - items.push(user); - } - assert.strictEqual(items.length, 4); - }); - - it("should list all users byPage", async () => { - const iter = client.list({ - maxpagesize: 3 - }); - const items: User[] = []; - for await (const user of iter.byPage()) { - items.push(...user); - } - assert.strictEqual(items.length, 4); - }); - - it("should list left users byPage if continuationToken is set", async () => { - const iter = client.list({ - maxpagesize: 3 - }); - /** - * two pages: - * - 1st page has 3 items - * - 2nd page has 1 item - */ - const firstPage = await iter.byPage().next(); - assert.strictEqual(firstPage.done, false); - assert.strictEqual(firstPage.value.length, 3); - // initiate another iterator starting with 2nd page - const continuationToken = firstPage.value.continuationToken; - assert.strictEqual( - continuationToken, - "http://localhost:3002/payload/pageable?skipToken=name-user7&maxpagesize=3" - ); - const items: User[] = []; - for await (const pagedUsers of iter.byPage({ continuationToken })) { - items.push(...pagedUsers); - } - assert.strictEqual(items.length, 1); - }); - - it("maxPageSize param should be ignored", async () => { - const pagedIter = client - .list({ maxpagesize: 3 }) - .byPage({ maxPageSize: 10 } as any); - const items: User[] = (await pagedIter.next()).value; - assert.strictEqual(items.length, 3); - }); -}); diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/tspconfig.yaml b/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/tspconfig.yaml deleted file mode 100644 index 6b8ba8dd09..0000000000 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/generated/models/usage/tspconfig.yaml +++ /dev/null @@ -1,14 +0,0 @@ -emit: - - "@azure-tools/typespec-ts" -options: - "@azure-tools/typespec-ts": - "emitter-output-dir": "{project-root}" - generateMetadata: true - generateTest: false - isTypeSpecTest: true - branded: false - isModularLibrary: true - packageDetails: - name: "@msinternal/usage" - description: "Usage Test Service" - version: "1.0.0" diff --git a/packages/typespec-ts/test/nonBrandedIntegration/modular/usage.spec.ts b/packages/typespec-ts/test/nonBrandedIntegration/modular/usage.spec.ts deleted file mode 100644 index dd49c461f3..0000000000 --- a/packages/typespec-ts/test/nonBrandedIntegration/modular/usage.spec.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { UsageClient } from "./generated/models/usage/src/index.js"; -import { assert } from "chai"; -import { - UsageContext, - createUsage, - input, - inputAndOutput, - output -} from "./generated/models/usage/src/api/index.js"; -const EXPECTED_VALUE = "example-value"; -describe("UsageContext Classical Client", () => { - let client: UsageClient; - - beforeEach(() => { - client = new UsageClient({ - allowInsecureConnection: true, - endpoint: "http://localhost:3004" - }); - }); - - it("should input", async () => { - try { - const result = await client.input({ requiredProp: EXPECTED_VALUE }); - assert.isUndefined(result); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should output", async () => { - try { - const result = await client.output(); - assert.isNotNull(result); - assert.strictEqual(result.requiredProp, EXPECTED_VALUE); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should inputAndOutput", async () => { - try { - const result = await client.inputAndOutput({ - requiredProp: EXPECTED_VALUE - }); - assert.isNotNull(result); - assert.strictEqual(result.requiredProp, EXPECTED_VALUE); - } catch (err) { - assert.fail(err as string); - } - }); -}); - -describe("UsageContext API Operations", () => { - let context: UsageContext; - - beforeEach(() => { - context = createUsage({ - allowInsecureConnection: true, - endpoint: "http://localhost:3004" - }); - }); - - it("should input", async () => { - try { - const result = await input(context, { requiredProp: EXPECTED_VALUE }); - assert.isUndefined(result); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should inputAndOutput", async () => { - try { - const result = await inputAndOutput(context, { - requiredProp: EXPECTED_VALUE - }); - assert.isNotNull(result); - assert.strictEqual(result.requiredProp, EXPECTED_VALUE); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should output", async () => { - try { - const result = await output(context); - assert.isNotNull(result); - assert.strictEqual(result.requiredProp, EXPECTED_VALUE); - } catch (err) { - assert.fail(err as string); - } - }); -}); diff --git a/packages/typespec-ts/test/nonBrandedIntegration/rlc/usage.spec.ts b/packages/typespec-ts/test/nonBrandedIntegration/rlc/usage.spec.ts deleted file mode 100644 index da6dfd6392..0000000000 --- a/packages/typespec-ts/test/nonBrandedIntegration/rlc/usage.spec.ts +++ /dev/null @@ -1,50 +0,0 @@ -import TypeModelUsageClientFactory, { - UsageClient -} from "./generated/models/usage/src/index.js"; -import { assert } from "chai"; -describe("ModelsUsageClient Rest Client", () => { - let client: UsageClient; - const body = { - requiredProp: "example-value" - }; - - beforeEach(() => { - client = TypeModelUsageClientFactory({ - allowInsecureConnection: true, - endpoint: "http://localhost:3003" - }); - }); - - it("should post input model correctly", async () => { - try { - const result = await client.path("/type/model/usage/input").post({ - body - }); - assert.strictEqual(result.status, "204"); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should get output model correctly", async () => { - try { - const result = await client.path("/type/model/usage/output").get(); - assert.strictEqual(result.status, "200"); - assert.deepEqual(result.body, body); - } catch (err) { - assert.fail(err as string); - } - }); - - it("should get output model correctly", async () => { - try { - const result = await client - .path("/type/model/usage/input-output") - .post({ body }); - assert.strictEqual(result.status, "200"); - assert.deepEqual(result.body, body); - } catch (err) { - assert.fail(err as string); - } - }); -});