Azure / Azure/azure-rest-api-specs

`Autoamtion` Software Update Configuration with empty tags in `AzureQueryProperties` cause error

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

Description

that is if set `updateConfiguration.targets.azureQueries.tagSettings` as `"tagSettings": {}` the response will be 400 error as below:

```
{
"code": "BadRequest",
"message": "{\"Message\":\"The request is invalid.\",\"ModelState\":{\"softwareUpdateConfiguration.properties.updateConfiguration.targets.azureQueries[0].tagSettings.tags\":[\"The tags field is required.\"]}}"
}
```
but if we provide an empty map in tags but not specify the `filterOperator` as below

```json
"tagSettings": {
"tags": {}
}
```

the request-response 201 is a success as below:
```json
"tagSettings": {
"filterOperator": 0,
"tags": {}
}
```
the `tagSettings.filterOperator` in response is a numeric zero, but the type defined in swagger is a string. so the go sdk unmarshal the response with an error `Error = 'json: cannot unmarshal number into Go struct field TagSettingsProperties.updateConfiguration.targets.azureQueries.tagSettings.filterOperator of type automation.TagOperators' `.

https://github.com/Azure/azure-rest-api-specs/blob/9842de8f8f11c09511fc00e903eb947f76cba0e6/specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/softwareUpdateConfiguration.json#L838-L844

related swagger definition: https://github.com/Azure/azure-rest-api-specs/blob/9842de8f8f11c09511fc00e903eb947f76cba0e6/specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/softwareUpdateConfiguration.json#L823

## Expect behavior

1. create success with no tags in tagSettings
2. response `filterOperator` must always be a string.

Contributor guide

Open the contributing guide

Research direction

Start in specification/automation/resource-manager/Microsoft.Automation/stable/2019-06-01/softwareUpdateConfiguration.json, reviewing the AzureQueryProperties and related TagSettings definitions at the linked lines. Verify the schema permits empty tags and represents filterOperator as a string, then validate the specification and generated request/response behavior if repository checks are available. Done means both expected behaviors are represented by the API contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.