Azure / azure-sdk-for-rust

This repository is for the active development of the Azure SDK for Rust. For consumers of the SDK we recommend visiting Docs.rs and looking up the docs for any of libraries in the SDK.
MIT License
711 stars 246 forks source link

`ManagedClusterUpgradeProfileProperties.agentPoolProfiles` is not marked as nullable #265

Open ZeWaka opened 3 years ago

ZeWaka commented 3 years ago

https://github.com/Azure/azure-sdk-for-rust/blob/8530b14828869e93f200894c7f79b6be3a3ed5e3/services/mgmt/containerservice/src/package_2021_03/models.rs#L1019-L1024

I can query this part of the API via a route such as azure_mgmt_containerservice::operations::managed_clusters::get_upgrade_profile().

Depending on the resources, of course, but I can get a null ("agentPoolProfiles": null) result for ManagedClusterUpgradeProfileProperties.agentPoolProfiles. This API/SDK will then error out during deserialization, throwing a:

Error: DeserializeError { source: Error("invalid type: null, expected a sequence", line: 18, column: 28)

for a JSON response like:

{
  "id": "/subscriptions/decafbad-d3ad-b33f-b000-deadf00dba11/resourcegroups/RedactedGroup/providers/Microsoft.ContainerService/managedClusters/RedactedCluster/upgradeprofiles/default",
  "name": "default",
  "type": "Microsoft.ContainerService/managedClusters/upgradeprofiles",
  "properties": {
   "controlPlaneProfile": {
    "kubernetesVersion": "1.18.17",
    "osType": "Linux",
    "upgrades": [
     {
      "kubernetesVersion": "1.19.7"
     },
     {
      "kubernetesVersion": "1.19.9"
     }
    ]
   },
   "agentPoolProfiles": null
  }
 }

Therefore, I believe this field (both, probably?) should be marked as an Option and skip_serializing_if = "Option::is_none")

However - this might be an error on the upstream api spec? re: https://github.com/Azure/azure-rest-api-specs/blob/1b0ed8edd58bb7c9ade9a27430759527bd4eec8e/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2020-03-01/managedClusters.json#L2187-L2193, it's not marked "x-nullable": true or non-required.

ctaggart commented 3 years ago

Probably something like https://github.com/serde-rs/serde/issues/1098 is needed for a type is "x-nullable": true.