Skip to content

Autoamtion Software Update Configuration with empty tags in AzureQueryProperties cause error #21719

Open
@wuxu92

Description

@wuxu92

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

  "tagSettings": {
      "tags": {}
  }

the request-response 201 is a success as below:

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

"filterOperator": {
"type": "string",
"description": "Filter VMs by Any or All specified tags.",
"enum": [
"All",
"Any"
],

related swagger definition:

Expect behavior

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AutomationService AttentionWorkflow: This issue is responsible by Azure service team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions