Skip to content

Commit df8dbee

Browse files
authored
Fix broken azappconfig pagers (Azure#19426)
* Fix broken azappconfig pagers The service returns the path plus query params in the next link, so we need to use a helper to construct the full URL. * rename swagger file
1 parent fe6922b commit df8dbee

File tree

5 files changed

+108
-4
lines changed

5 files changed

+108
-4
lines changed

sdk/data/azappconfig/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Breaking Changes
88

99
### Bugs Fixed
10+
* Fixed missing host URL when iterating over pages.
1011

1112
### Other Changes
1213
* Regenerated internal code with latest Autorest Go code generator.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"version": "1.0",
5+
"title": "Azure App Configuration"
6+
},
7+
"schemes": [
8+
"https"
9+
],
10+
"consumes": [
11+
"application/json"
12+
],
13+
"produces": [
14+
"application/json"
15+
],
16+
"paths": {
17+
"/{nextLink}": {
18+
"get": {
19+
"operationId": "GetNextPage",
20+
"x-ms-pageable": {
21+
"itemName": "items",
22+
"nextLinkName": "@nextLink",
23+
"operationName": "GetNextPage"
24+
},
25+
"parameters": [
26+
{
27+
"name": "nextLink",
28+
"in": "path",
29+
"required": true,
30+
"type": "string",
31+
"x-ms-skip-url-encoding": true
32+
}
33+
],
34+
"responses": {
35+
"200": {
36+
"description": "Success",
37+
"schema": {
38+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/e01d8afe9be7633ed36db014af16d47fec01f737/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json#/definitions/KeyListResult"
39+
},
40+
"headers": {
41+
"Sync-Token": {
42+
"description": "Enables real-time consistency between requests by providing the returned value in the next request made to the server.",
43+
"type": "string"
44+
}
45+
}
46+
},
47+
"default": {
48+
"description": "Error response describing why the operation failed",
49+
"schema": {
50+
"$ref": "https://github.com/Azure/azure-rest-api-specs/blob/e01d8afe9be7633ed36db014af16d47fec01f737/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json#/definitions/Error"
51+
}
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}

sdk/data/azappconfig/autorest.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ go: true
77
version: "^3.0.0"
88
input-file:
99
- https://github.com/Azure/azure-rest-api-specs/blob/e01d8afe9be7633ed36db014af16d47fec01f737/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/1.0/appconfiguration.json
10+
- appconfiguration_ext.json
1011
license-header: MICROSOFT_MIT_NO_VERSION
1112
clear-output-folder: true
1213
output-folder: internal/generated
@@ -65,3 +66,18 @@ directive:
6566
"modelAsString": true
6667
};
6768
```
69+
70+
### Fix up pagers
71+
```yaml
72+
directive:
73+
- from: swagger-document
74+
where: $.paths.*.get.x-ms-pageable
75+
transform: >
76+
$.operationName = "GetNextPage";
77+
- from: azureappconfiguration_client.go
78+
where: $
79+
transform: >
80+
return $.
81+
replace(/urlPath\s+:=\s+"\/\{nextLink\}"/, "urlPath := nextLink").
82+
replace(/\s+urlPath\s+=\s+strings\.ReplaceAll\(urlPath, "\{nextLink\}", nextLink\)/, "");
83+
```

sdk/data/azappconfig/internal/generated/azureappconfiguration_client.go

Lines changed: 27 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/data/azappconfig/internal/generated/response_types.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)