Azure / Azure/openapi-diff

False positives when readOnly property using referenced enum

未关闭
#286 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
290
派生
50
平均合并
5 天 13 小时
30 天内合并 PR
5

描述

**Describe the bug**

I'm working on https://github.com/Azure/azure-rest-api-specs-pr/pull/15631 and there are a lot of false positives with a message of `The read only property has changed from 'true' to 'false'.

![image](https://github.com/Azure/typespec-azure/assets/87583576/60ec9d9a-3bb8-453c-b3fc-6d5c8846e119)

**To Reproduce**
As an example from that PR:
``` typespec
@doc("Subscription trial availability")
model Trial {
@doc("Trial status")
@visibility("read")
status?: TrialStatus;
```

It does produce `readOnly`.
``` json
"status": {
"$ref": "#/definitions/TrialStatus",
"description": "Trial status",
"readOnly": true
},
```

But before it was not a `$ref`, it was inline:
```json
"status": {
"description": "Trial status",
"type": "string",
"enum": [
"TrialAvailable",
"TrialUsed",
"TrialDisabled"
],
"readOnly": true,
"x-ms-enum": {
"name": "TrialStatus",
"modelAsString": true
}
},
```

**Expected behavior**
It is not marked as a breaking change.

贡献指南

打开贡献指南

调研方向

Start by inspecting the comparison described in Azure/azure-rest-api-specs-pr#15631, using the Trial model and referenced TrialStatus enum as the reproduction case. Trace where the diff compares the previous inline enum schema with the new $ref schema and readOnly value. Done means this equivalent change is no longer reported as a breaking readOnly change.

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, openapi
领域
cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。