Azure / Azure/azure-rest-api-specs
Pageable LRO problem with `getActiveSessions` in `bastionHost.json` of network
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
When I use the GO SDK to test pageable LRO, I found the result of this operation is different from the swagger [here](https://github.com/Azure/azure-rest-api-specs/blob/8713239a8b6cfcd49cbf0c34638269b41cfe0ed7/specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/bastionHost.json#L477). The SDK log is as follows. You could see the final result return an array instead of defined list object.
```
[May 10 20:13:31.282641] Authentication: EnvironmentCredential will authenticate with ClientSecretCredential
[May 10 20:13:31.284650] Authentication: Managed Identity Credential will use IMDS managed identity
[May 10 20:13:31.284650] Retry:
=====> Try=1 POST https://management.azure.com/subscriptions/xxxxxxxxxxxx/resourceGroups/test/providers/Microsoft.Network/bastionHosts/test/getActiveSessions?api-version=2021-05-01
[May 10 20:13:32.240547] Request: ==> OUTGOING REQUEST (Try=1)
POST https://management.azure.com/subscriptions/xxxxxxxxxxxx/resourceGroups/test/providers/Microsoft.Network/bastionHosts/test/getActiveSessions?api-version=2021-05-01
Accept: application/json
Authorization: REDACTED
User-Agent: azsdk-go-armnetwork/v0.5.0 azsdk-go-azcore/v0.23.0 (go1.18; Windows_NT)
Request contained no body
[May 10 20:13:33.211667] Response: ==> REQUEST/RESPONSE (Try=1/969.2743ms, OpTime=971.6671ms) -- RESPONSE RECEIVED
POST https://management.azure.com/subscriptions/xxxxxxxxxxxx/resourceGroups/test/providers/Microsoft.Network/bastionHosts/test/getActiveSessions?api-version=2021-05-01
Accept: application/json
Authorization: REDACTED
User-Agent: azsdk-go-armnetwork/v0.5.0 azsdk-go-azcore/v0.23.0 (go1.18; Windows_NT)
--------------------------------------------------------------------------------
RESPONSE Status: 202 Accepted
Cache-Control: no-cache
Content-Length: 2
Content-Type: application/json; charset=utf-8
Date: Tue, 10 May 2022 12:13:32 GMT
Expires: -1
Location: REDACTED
Pragma: no-cache
Retry-After: 1
Server: Microsoft-HTTPAPI/2.0
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
X-Ms-Arm-Service-Request-Id: REDACTED
X-Ms-Correlation-Request-Id: REDACTED
X-Ms-Ratelimit-Remaining-Subscription-Writes: REDACTED
X-Ms-Request-Id: 73bbe97b-14f3-49a1-9d1e-8e9086e9944e
X-Ms-Routing-Request-Id: REDACTED
--------------------------------------------------------------------------------
[]
--------------------------------------------------------------------------------
[May 10 20:13:33.215942] Retry: response 202
[May 10 20:13:33.216576] LongRunningOperation: Using Location poller.
[May 10 20:13:33.217845] LongRunningOperation: BEGIN PollUntilDone() for *loc.Poller
[May 10 20:13:33.218454] LongRunningOperation: initial Retry-After delay for 1s
[May 10 20:13:34.233211] Retry:
=====> Try=1 GET https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Network/locations/eastus/operationResults/73bbe97b-14f3-49a1-9d1e-8e9086e9944e?api-version=2021-05-01
[May 10 20:13:34.233814] Request: ==> OUTGOING REQUEST (Try=1)
GET https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Network/locations/eastus/operationResults/73bbe97b-14f3-49a1-9d1e-8e9086e9944e?api-version=2021-05-01
Authorization: REDACTED
User-Agent: azsdk-go-armnetwork/v0.5.0 azsdk-go-azcore/v0.23.0 (go1.18; Windows_NT)
Request contained no body
[May 10 20:13:35.333169] Response: ==> REQUEST/RESPONSE (Try=1/1.0975919s, OpTime=1.0993601s) -- RESPONSE RECEIVED
GET https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Network/locations/eastus/operationResults/73bbe97b-14f3-49a1-9d1e-8e9086e9944e?api-version=2021-05-01
Authorization: REDACTED
User-Agent: azsdk-go-armnetwork/v0.5.0 azsdk-go-azcore/v0.23.0 (go1.18; Windows_NT)
--------------------------------------------------------------------------------
RESPONSE Status: 202 Accepted
Cache-Control: no-cache
Content-Length: 4
Content-Type: application/json; charset=utf-8
Date: Tue, 10 May 2022 12:13:34 GMT
Expires: -1
Location: REDACTED
Pragma: no-cache
Retry-After: 1
Server: Microsoft-HTTPAPI/2.0
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
X-Ms-Arm-Service-Request-Id: REDACTED
X-Ms-Correlation-Request-Id: REDACTED
X-Ms-Ratelimit-Remaining-Subscription-Reads: REDACTED
X-Ms-Request-Id: 73bbe97b-14f3-49a1-9d1e-8e9086e9944e
X-Ms-Routing-Request-Id: REDACTED
--------------------------------------------------------------------------------
null
--------------------------------------------------------------------------------
[May 10 20:13:35.344755] Retry: response 202
[May 10 20:13:35.345765] LongRunningOperation: Status InProgress
[May 10 20:13:35.346314] LongRunningOperation: Retry-After delay for 1s
[May 10 20:13:36.354059] Retry:
=====> Try=1 GET https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Network/locations/eastus/operationResults/73bbe97b-14f3-49a1-9d1e-8e9086e9944e?api-version=2021-05-01
[May 10 20:13:36.358059] Request: ==> OUTGOING REQUEST (Try=1)
GET https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Network/locations/eastus/operationResults/73bbe97b-14f3-49a1-9d1e-8e9086e9944e?api-version=2021-05-01
Authorization: REDACTED
User-Agent: azsdk-go-armnetwork/v0.5.0 azsdk-go-azcore/v0.23.0 (go1.18; Windows_NT)
Request contained no body
[May 10 20:13:36.736962] Response: ==> REQUEST/RESPONSE (Try=1/373.8714ms, OpTime=378.9041ms) -- RESPONSE RECEIVED
GET https://management.azure.com/subscriptions/xxxxxxxxxxxx/providers/Microsoft.Network/locations/eastus/operationResults/73bbe97b-14f3-49a1-9d1e-8e9086e9944e?api-version=2021-05-01
Authorization: REDACTED
User-Agent: azsdk-go-armnetwork/v0.5.0 azsdk-go-azcore/v0.23.0 (go1.18; Windows_NT)
--------------------------------------------------------------------------------
RESPONSE Status: 200 OK
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Tue, 10 May 2022 12:13:35 GMT
Expires: -1
Location: REDACTED
Pragma: no-cache
Server: Microsoft-HTTPAPI/2.0
Strict-Transport-Security: REDACTED
Vary: REDACTED
X-Content-Type-Options: REDACTED
X-Ms-Arm-Service-Request-Id: REDACTED
X-Ms-Correlation-Request-Id: REDACTED
X-Ms-Ratelimit-Remaining-Subscription-Reads: REDACTED
X-Ms-Request-Id: 73bbe97b-14f3-49a1-9d1e-8e9086e9944e
X-Ms-Routing-Request-Id: REDACTED
--------------------------------------------------------------------------------
[]
--------------------------------------------------------------------------------
[May 10 20:13:36.743562] Retry: response 200
[May 10 20:13:36.744377] LongRunningOperation: END PollUntilDone() for *loc.Poller: json: cannot unmarshal array into Go value of type map[string]interface {}, total time: 3.5265486s
2022/05/10 20:13:36 Failed to get LRO result for example specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionSessionsList.json: json: cannot unmarshal array into Go value of type map[string]interface {}
exit status 1
```
Contributor guide
Research direction
Start with specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/bastionHost.json at getActiveSessions and compare its response definition with the linked Swagger entry and the logged 202/200 payloads. Use examples/BastionSessionsList.json to reproduce the generated Go SDK result; done when the specification and example produce a result the pageable LRO can unmarshal consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100