tombuildsstuff / kermit

Contains Track1 versions of the Azure/azure-sdk-for-go SDK's which aren't yet supported by hashicorp/go-azure-sdk
Mozilla Public License 2.0
4 stars 14 forks source link

[datafactory@2018-06-01]: `webactivities.headers` struct changed #381

Open ziyeqf opened 5 months ago

ziyeqf commented 5 months ago

affected file: https://github.com/tombuildsstuff/kermit/blob/main/sdk/datafactory/2018-06-01/datafactory/models.go the struct used to be interface{}

Headers interface{} `json:"headers,omitempty"`

but a string map now:

Headers map[string]*string `json:"headers"`

while my testing results shows the response from the service is not map[string]string format:

  1. edit on Portal, add an expression to the header
  2. call GET on the resource the headers in the response is :
                    "headers": {
                        "authorization": {
                            "type": "Expression",
                            "value": "@pipeline().parameters.test"
                        },
                        "content_type": "application/x-www-form-urlencoded"
                    }

It broke users' existing resources: https://github.com/hashicorp/terraform-provider-azurerm/issues/24758

Noticed there was a Swagger change: https://github.com/Azure/azure-rest-api-specs/commit/97cefc844971fe445d9a294cf68e2adfd63852ac#diff-d5aa9217e2132932fec24cba8c2a103430c34ed925739a4529a0acd16483803aR8246

I'm assuming the sdk change was caused by the Swagger change, so an issue on the rest api is also opened: https://github.com/Azure/azure-rest-api-specs/issues/27816

tombuildsstuff commented 5 months ago

@ziyeqf this looks like a case of an invalid Swagger definition - the Swagger extension being used there (x-ms-format) isn't valid i.e. defined in the list of autorest extensions?

Based on the naming here containing dfe (datafactory extension?) - is this a DataFactory specific extension? It's previous value prior to this change appears to have been ignored - and it's undocumented, so it's unclear what the behavioural expectation is for this field?

ziyeqf commented 3 months ago

@ziyeqf this looks like a case of an invalid Swagger definition - the Swagger extension being used there (x-ms-format) isn't valid i.e. defined in the list of autorest extensions?

Based on the naming here containing dfe (datafactory extension?) - is this a DataFactory specific extension? It's previous value prior to this change appears to have been ignored - and it's undocumented, so it's unclear what the behavioural expectation is for this field?

By digging into the autorest.csharp repo I think I understood a bit of x-ms-format and dfe-*.... It seems your assumption is correct, x-ms-format is a superset of format, added some extension. And the dfe- prefix is used to invovle the data factory dependency into generated csharp project.. I'm not sure about these conclusion... This extension is not documented and I suspect it targets on the dotnet sdk.

Some references:

  1. https://github.com/Azure/autorest.csharp/blob/139b9cc94af38f61081d0ad07e2f0e4fc47764e8/src/AutoRest.CSharp/Common/Input/CodeModelPartials.cs#L186C27-L186C36
  2. https://github.com/Azure/autorest.csharp/pull/2852/files#diff-17a28f89f3725d0ef8e50ca8efa027a425f0293377e7f8862c25b751868827b6
  3. https://github.com/Azure/autorest.csharp/blob/139b9cc94af38f61081d0ad07e2f0e4fc47764e8/src/AutoRest.CSharp/Common/Generation/Types/TypeFactory.cs#L337
  4. https://github.com/Azure/autorest.csharp/blob/139b9cc94af38f61081d0ad07e2f0e4fc47764e8/src/AutoRest.CSharp/Common/Input/CodeModelConverter.cs#L444
tombuildsstuff commented 3 months ago

@ziyeqf indeed, thanks for the link to the C# SDK - I was chatting with @stephybun about this one recently as a part of getting the Data Factory items into hashicorp/go-azure-sdk - I've opened https://github.com/hashicorp/pandora/issues/4026 to track fixing this in Pandora.