Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iotcentral has duplicate x-ms-discriminator-value for TileConfiguration #25931

Open
cataggar opened this issue Sep 22, 2023 · 1 comment
Open
Labels
IoT Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@cataggar
Copy link
Member

cataggar commented Sep 22, 2023

iotcentral package-2022-10-31-preview has duplicate "x-ms-discriminator-value": "command" inheriting from TileConfiguration. Based on the naming conventions, I think you may want to make the second "x-ms-discriminator-value": "commandTile".

    "CommandConfiguration": {
      "description": "Configuration specifying options for a command tile.",
      "x-ms-discriminator-value": "command",
      "allOf": [
        {
          "$ref": "#/definitions/TileConfiguration"
        }
      ],
      "type": "object",
      "properties": {
        "device": {
          "type": "string",
          "description": "The device id that the command is associated with"
        },
        "command": {
          "type": "string",
          "description": "The command id to associate the tile to"
        }
      },
    "CommandTileConfiguration": {
      "description": "Configuration specifying options for a command tile",
      "x-ms-discriminator-value": "command",
      "allOf": [
        {
          "$ref": "#/definitions/TileConfiguration"
        }
      ],
      "type": "object",
      "properties": {
        "group": {
          "description": "The ID of the device group to display",
          "type": "string"
        },
        "command": {
          "description": "The command to reference in the tile",
          "type": "string"
        },
        "device": {
          "description": "The device to reference in the tile"
        }
      },
      "required": [
        "group",
        "command",
        "device"
      ]
    },

I discovered this while working on Azure/azure-sdk-for-rust#1414.

error[E0631]: type mismatch in function arguments
    --> svc\iotcentral\src\package_2022_10_31_preview\models.rs:3019:10
     |
3017 |   #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
     |                                                ----------- required by a bound introduced by this call
3018 |   #[serde(tag = "type")]
3019 |   pub enum TileConfigurationUnion {
     |  __________^
3020 | |     #[serde(rename = "barChart")]
3021 | |     BarChart(BarChartConfiguration),
3022 | |     #[serde(rename = "command")]
3023 | |     Command(CommandConfiguration),
     | |     ------- found signature defined here
3024 | |     #[serde(rename = "command")]
3025 | |     Command(CommandTileConfiguration),
     | |___________^ expected due to this
@JackTn JackTn added IoT Service Attention Workflow: This issue is responsible by Azure service team. labels Sep 25, 2023
@cataggar
Copy link
Member Author

This looks like it was added in #20981. cc @yang-hai-feng @heaths

I possible fix would be to update:

    "CommandTileConfiguration": {
      "description": "Configuration specifying options for a command tile",
      "x-ms-discriminator-value": "command",

to:

    "CommandTileConfiguration": {
      "description": "Configuration specifying options for a command tile",
      "x-ms-discriminator-value": "commandTile",

This would need to be updated in the backend as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IoT Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants