Azure / Azure/azure-rest-api-specs

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

Open
#25,931 1 comment 0 reactions 0 assignees View on GitHub
IoT Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

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"`.

``` json
"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"
}
},
```

``` json
"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 https://github.com/Azure/azure-sdk-for-rust/pull/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
```

Contributor guide

Open the contributing guide

Research direction

Locate the iotcentral package-2022-10-31-preview schema and compare the CommandConfiguration and CommandTileConfiguration definitions shown in the issue. Confirm the discriminator values are unique, then regenerate or validate the affected Rust model to ensure TileConfigurationUnion no longer has duplicate variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, openapi, rust
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.