From 3c2aafe9143de8c34acf70284e00f298aeea61d8 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Fri, 29 Nov 2024 16:23:11 +0800 Subject: [PATCH] azure-http-specs, move pageable scenario to azure folder (#1925) Package of the generated code will be impacted. --- ...-specs_move-pageable-2024-10-28-14-25-5.md | 7 ++ packages/azure-http-specs/spec-summary.md | 88 +++++++++---------- .../{ => azure}/payload/pageable/main.tsp | 16 ++-- .../{ => azure}/payload/pageable/mockapi.ts | 10 +-- 4 files changed, 66 insertions(+), 55 deletions(-) create mode 100644 .chronus/changes/azure-specs_move-pageable-2024-10-28-14-25-5.md rename packages/azure-http-specs/specs/{ => azure}/payload/pageable/main.tsp (73%) rename packages/azure-http-specs/specs/{ => azure}/payload/pageable/mockapi.ts (81%) diff --git a/.chronus/changes/azure-specs_move-pageable-2024-10-28-14-25-5.md b/.chronus/changes/azure-specs_move-pageable-2024-10-28-14-25-5.md new file mode 100644 index 0000000000..7996b00a45 --- /dev/null +++ b/.chronus/changes/azure-specs_move-pageable-2024-10-28-14-25-5.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/azure-http-specs" +--- + +Move payload/pageable test scenario to azure folder \ No newline at end of file diff --git a/packages/azure-http-specs/spec-summary.md b/packages/azure-http-specs/spec-summary.md index 200e433552..458c3ff826 100644 --- a/packages/azure-http-specs/spec-summary.md +++ b/packages/azure-http-specs/spec-summary.md @@ -720,6 +720,50 @@ Expected response body: } ``` +### Azure_Payload_Pageable_list + +- Endpoint: `get /azure/payload/pageable` + +List users. + +SDK may hide the "maxpagesize" from API signature. The functionality of "maxpagesize" could be in related language Page model. + +Expected query parameter: +maxpagesize=3 + +Expected response body: + +```json +{ + "value": [ + { + "name": "user5" + }, + { + "name": "user6" + }, + { + "name": "user7" + } + ], + "nextLink": "{endpoint}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3" +} +``` + +Expected query parameter: +skipToken=name-user7 +maxpagesize=3 + +```json +{ + "value": [ + { + "name": "user8" + } + ] +} +``` + ### Azure_ResourceManager_CommonProperties_ManagedIdentity_createWithSystemAssigned - Endpoint: `put https://management.azure.com` @@ -1648,50 +1692,6 @@ client.group2.five(); client.group2.six(); ``` -### Payload_Pageable_list - -- Endpoint: `get /payload/pageable` - -List users. - -SDK may hide the "maxpagesize" from API signature. The functionality of "maxpagesize" could be in related language Page model. - -Expected query parameter: -maxpagesize=3 - -Expected response body: - -```json -{ - "value": [ - { - "name": "user5" - }, - { - "name": "user6" - }, - { - "name": "user7" - } - ], - "nextLink": "{endpoint}/payload/pageable?skipToken=name-user7&maxpagesize=3" -} -``` - -Expected query parameter: -skipToken=name-user7 -maxpagesize=3 - -```json -{ - "value": [ - { - "name": "user8" - } - ] -} -``` - ### Resiliency_ServiceDriven_addOperation - Endpoint: `delete /resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}/add-operation` diff --git a/packages/azure-http-specs/specs/payload/pageable/main.tsp b/packages/azure-http-specs/specs/azure/payload/pageable/main.tsp similarity index 73% rename from packages/azure-http-specs/specs/payload/pageable/main.tsp rename to packages/azure-http-specs/specs/azure/payload/pageable/main.tsp index 2b4bdb45cd..dfaf99353d 100644 --- a/packages/azure-http-specs/specs/payload/pageable/main.tsp +++ b/packages/azure-http-specs/specs/azure/payload/pageable/main.tsp @@ -1,15 +1,19 @@ import "@typespec/spector"; -import "@azure-tools/typespec-azure-core"; import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; -using TypeSpec.Versioning; -using Azure.Core; using Spector; +using TypeSpec.Versioning; +using global.Azure.Core; +using global.Azure.ClientGenerator.Core; @doc("Test describing pageable.") -@scenarioService("/payload/pageable") +@scenarioService("/azure/payload/pageable") @useDependency(global.Azure.Core.Versions.v1_0_Preview_2) -namespace Payload.Pageable; +namespace _Specs_.Azure.Payload.Pageable; + +@@clientNamespace(_Specs_.Azure.Payload.Pageable, "azure.payload.pageable", "java"); @doc("User model") model User { @@ -41,7 +45,7 @@ model User { "name":"user7" } ], - "nextLink": "{endpoint}/payload/pageable?skipToken=name-user7&maxpagesize=3" + "nextLink": "{endpoint}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3" } ``` diff --git a/packages/azure-http-specs/specs/payload/pageable/mockapi.ts b/packages/azure-http-specs/specs/azure/payload/pageable/mockapi.ts similarity index 81% rename from packages/azure-http-specs/specs/payload/pageable/mockapi.ts rename to packages/azure-http-specs/specs/azure/payload/pageable/mockapi.ts index b49386ba7d..25c154a65e 100644 --- a/packages/azure-http-specs/specs/payload/pageable/mockapi.ts +++ b/packages/azure-http-specs/specs/azure/payload/pageable/mockapi.ts @@ -17,7 +17,7 @@ function pageableHandler(req: MockRequest) { status: 200, body: json({ value: [{ name: "user5" }, { name: "user6" }, { name: "user7" }], - nextLink: `${req.baseUrl}/payload/pageable?skipToken=name-user7&maxpagesize=3`, + nextLink: `${req.baseUrl}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3`, }), } as const; } else if (skipToken === "name-user7") { @@ -35,9 +35,9 @@ function pageableHandler(req: MockRequest) { } } -Scenarios.Payload_Pageable_list = withServiceKeys(["firstPage", "secondPage"]).pass([ +Scenarios.Azure_Payload_Pageable_list = withServiceKeys(["firstPage", "secondPage"]).pass([ { - uri: "/payload/pageable", + uri: "/azure/payload/pageable", method: "get", request: { params: { @@ -48,14 +48,14 @@ Scenarios.Payload_Pageable_list = withServiceKeys(["firstPage", "secondPage"]).p status: 200, body: json({ value: [{ name: "user5" }, { name: "user6" }, { name: "user7" }], - nextLink: `/payload/pageable?skipToken=name-user7&maxpagesize=3`, + nextLink: `/azure/payload/pageable?skipToken=name-user7&maxpagesize=3`, }), }, handler: pageableHandler, kind: "MockApiDefinition", }, { - uri: "/payload/pageable", + uri: "/azure/payload/pageable", method: "get", request: { params: {