Skip to content

Commit

Permalink
azure-http-specs, move pageable scenario to azure folder (#1925)
Browse files Browse the repository at this point in the history
Package of the generated code will be impacted.
  • Loading branch information
weidongxu-microsoft authored Nov 29, 2024
1 parent 3ae22de commit 3c2aafe
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@azure-tools/azure-http-specs"
---

Move payload/pageable test scenario to azure folder
88 changes: 44 additions & 44 deletions packages/azure-http-specs/spec-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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"
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down

0 comments on commit 3c2aafe

Please sign in to comment.