Azure / Azure/azure-rest-api-specs

ConditonOperator enum value is inconsistent with resource provider for Microsoft.Insights/2022-06-15/scheduledQueryRule_API.json

Open
#22,029 0 comments 0 reactions 0 assignees View on GitHub
Monitor - Operational Insights Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

https://github.com/Azure/azure-rest-api-specs/blob/c1eacd86904b1720511b3f4e683f54d8999c125a/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json#L604-L612

The enum value for "equals to some value" is defined "Equals", but the resource provider API **actually uses "Equal"**.
Autorest generated SDKs would fail to deserialize data with this value. And if we try to PUT the ScheduledQueryRule with manually written data "Equals", resource provider will reject it.

```bash
curl 'https://management.azure.com/subscriptions//resourceGroups//providers/microsoft.insights/scheduledqueryrules/Test%20alert?api-version=2021-08-01' \
-X 'PUT' \
-H 'x-ms-client-session-id: ' \
-H 'DNT: 1' \
-H 'x-ms-command-name: Microsoft_Azure_Monitoring.' \
-H 'Accept-Language: en' \
-H 'Authorization: Bearer ' \
-H 'x-ms-effective-locale: en.en-us' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
-H 'User-Agent: ' \
-H 'Referer;' \
-H 'x-ms-client-request-id: ' \
--data-raw '{"location":"southeastasia","id":"/subscriptions//resourceGroups//providers/microsoft.insights/scheduledqueryrules/Test alert","properties":{"displayName":"Test alert","actions":{"actionGroups":[],"customProperties":{}},"criteria":{"allOf":[{"operator":"Equals","query":"requests\n\n","threshold":100000,"timeAggregation":"Count","dimensions":[],"failingPeriods":{"minFailingPeriodsToAlert":1,"numberOfEvaluationPeriods":1}}]},"description":"","enabled":true,"autoMitigate":false,"evaluationFrequency":"PT4H","scopes":["/subscriptions//resourceGroups//providers/microsoft.insights/components/"],"severity":3,"windowSize":"PT4H","muteActionsDuration":null,"overrideQueryTimeRange":null,"targetResourceTypes":["microsoft.insights/components"]},"tags":{}}' \
--compressed
```
Returns:
```
{"error":{"code":"BadRequest","message":"Invalid input at properties.criteria.allOf[0].operator: Requested value 'Equals' was not found."}}
```

Contributor guide

Open the contributing guide

Research direction

Open specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json at lines 604-612 and inspect the ConditionOperator enum. Compare the declared value with the resource provider response shown in the curl example; done means the specification accepts the provider's `Equal` value and no longer declares `Equals` for this operator.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
49/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.