Azure-sdk-for-go: Unmarshal error of Future.Result() for network.VirtualNetworkGatewaysGetVpnProfilePackageURL

Created on 22 May 2020  路  12Comments  路  Source: Azure/azure-sdk-for-go

Bug Report

  • import path of package in question: .../services/network/mgmt/2020-03-01/network
  • SDK version: 42.1.0
  • output of go version: go version go1.14.2 darwin/amd64
  • What happened?
    An unmarshal error upon calling future.Result(*client) (code):
    network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture#Result: Failure responding to request: StatusCode=200 -- Original Error: Error occurred unmarshalling JSON - Error = 'json: cannot unmarshal string into Go value of type network.String' JSON = '"https://nfvprodsuppdb.blob.core.windows.net/vpnprofileimmutable/xxxxxxxxxxxxxx/vpnprofile/xxxxxxxxxxxxxx/vpnclientconfiguration.zip?sv=2017-04-17&sr=b&sig=xxxxxxxxxxxxxx&st=2020-05-22T07%3A58%3A15Z&se=2020-05-22T08%3A58%3A15Z&sp=r&fileExtension=.zip"'
  • What did you expect or want to happen?
    Go type network.String to work with containing "https://nfvprodsuppdb.blob.core.windows.net/vpnprofileimmutable/xxxxxxxxxxxxxx/vpnprofile/xxxxxxxxxxxxxx/vpnclientconfiguration.zip?sv=2017-04-17&sr=b&sig=xxxxxxxxxxxxxx&st=2020-05-22T07%3A58%3A15Z&se=2020-05-22T08%3A58%3A15Z&sp=r&fileExtension=.zip"
  • How can we reproduce it?
    Run make acctests SERVICE=web TESTARGS='-run=TestAccAzureRMAppServiceVirtualNetworkGatewayConnection_basic' against my branch and fork of the AzureRM TerraForm Provider/this PR: https://github.com/terraform-providers/terraform-provider-azurerm/pull/7048

    - Anything we should know about your environment.

Mgmt Network - VPN Gateway Service Attention customer-reported

Most helpful comment

@ArcturusZhang the swagger needs to be fixed. Can you please follow up with the RP about it?

All 12 comments

The problem is the same as https://github.com/Azure/azure-sdk-for-go/issues/5921, which is already open for more than half a year..

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

Hi @aristosvo thanks for this issue!

Last time in internal emails, we have come an agreement with the service team that they would change their format of the response. But apparently they have not made that change yet...

Hi @jhendrixMSFT do you have some recommendation here? Is it valid for us to make some workaround on the code gen?

@ArcturusZhang the swagger needs to be fixed. Can you please follow up with the RP about it?

@lilyjma @ArcturusZhang Can you please give me an update on the progress?

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

@ArcturusZhang: Any updates on swagger change?

@lilyjma sorry some of the comments may not be clear enough - we are expecting the service to return everything in a format of JSON rather than a plain string. But we did not get enough progress with the service team.

Please let me give them another ping on this.

@ArcturusZhang I might have been wrong about this requirement. According to spec, "some string" is a valid JSON string and we have a lot of other places where this is returned (a lot in the test server).

I think the codegen might be wrong here, i.e. this might be a bug where LROs and operations that return scalar values intersect. If you look at codegen in the test server for the non-LRO case, we unmarshall into the Value field.

https://github.com/Azure/autorest.go/blob/master/test/src/tests/generated/stringgroup/string.go#L87

For network we don't.

autorest.ByUnmarshallingJSON(&result),

I think the codegen should unmarshall that into result.String.

We appear to have the same issue in track 2.

Actually, it looks like track 2 does the right thing here.

@ArcturusZhang I might have been wrong about this requirement. According to spec, "some string" is a valid JSON string and we have a lot of other places where this is returned (a lot in the test server).

I think the codegen might be wrong here, i.e. this might be a bug where LROs and operations that return scalar values intersect. If you look at codegen in the test server for the non-LRO case, we unmarshall into the Value field.

https://github.com/Azure/autorest.go/blob/master/test/src/tests/generated/stringgroup/string.go#L87

For network we don't.

autorest.ByUnmarshallingJSON(&result),

I think the codegen should unmarshall that into result.String.

We appear to have the same issue in track 2.

Good to know. Let me have a look how to fix this in the code gen.

@ArcturusZhang Any news?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ncw picture ncw  路  4Comments

StrongMonkey picture StrongMonkey  路  4Comments

drosseau picture drosseau  路  4Comments

mbfrahry picture mbfrahry  路  4Comments

tiwood picture tiwood  路  4Comments