Azure / Azure/azure-openapi-validator

[new rule]: Make sure enum value is equal with x-ms-enum value

Open
#392 0 comments 0 reactions 0 assignees View on GitHub
sdk-rule
Dominant language
TypeScript
Stars
53
Forks
57
Avg merge
1d 23h
Merged PRs (30d)
2

Description

### Lint rule description

Sometimes, swagger enum list is not equal with x-ms-enum values list. Please help to add a lint rule to check the discrepancy.

### Related swagger example

"PullRequestStatus": {
"type": "string",
"readOnly": true,
"enum": [
"unknown",
"submitted",
"merged",
"removed"
],
"x-ms-enum": {
"name": "PullRequestStatus",
"modelAsString": true,
"values": [
{
"value": "unknown",
"description": "Pull Request state unknown."
},
{
"value": "submitted",
"description": "Pull Request submitted to repository."
},
{
"value": "merged",
"description": "Pull Request merged into repository."
},
{
"value": "merged",
"description": "Workflow no longer found within repository."
}
]
},
"description": "The status of the Pull Request submitted against the users repository."
},

https://github.com/Azure/azure-rest-api-specs/pull/20863

### Category

SDK

### Severity level

Error

### Applies to

Management plane API spec, Data plane API spec, RPaaS API spec

### How to fix the violation

Consolidate the values of the enumeration.

### What't the impact if breaking the rule

Enumeration values are ambiguous which result in SDK cannot be generated successfully.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.