Azure / Azure/azure-sdk-tools

[Breaking Change] Rule "AddedXmsEnum" treats "string" and "open enum" as incompatible

Open
#7,271 0 comments 0 reactions 1 assignee Claimed by @mikeharder View on GitHub
Breaking Changes Central-EngSys Spec PR Tools
Dominant language
C#
Stars
135
Forks
260
Avg merge
1d 22h
Merged PRs (30d)
115

Description

Given the following types:

```
// string
"type": "string"

// closed enum
"type": "string",
"x-ms-enum": { "modelAsString": false },
"enum": [ "westus", "westeurope"]

// open enum
"type": "string",
"x-ms-enum": { "modelAsString": true },
"enum": [ "westus", "westeurope"]
```

Types "string" and "open enum" should be considered fully compatible, since "open enum" is just documenting the valid values and saying that the set is open. "closed enum" should be considered incompatible with both "string" and "open enum", since the valid values are closed.

In https://github.com/Azure/azure-rest-api-specs/pull/26658, check "Swagger BreakingChange" seems to get this wrong in rule and `1048 - AddedXmsEnum`.

![image](https://github.com/Azure/azure-sdk-tools/assets/9459391/09dd11aa-46b5-4047-9afe-c535fec5d9d4)

```
// from
"type": "string",
"description": "The type discriminator describing a sub-type of QueueSelectorAttachment"

// to
"type": "string",
"description": "Supported queue selector attachment types",
"enum": [ "conditional", ... ],
"x-ms-enum": { "modelAsString": true ... }
```

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.