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.

貢獻指南

開啟貢獻指南

研究方向

首先檢查 Azure/azure-rest-api-specs-pr#15631 中描述的比較,使用 Trial 模型和所參照的 TrialStatus enum 作為重現案例。追蹤 diff 在哪裡將先前的 inline enum schema 與新的 $ref schema 以及 readOnly 值進行比較。完成的標準是:此等效變更不再被回報為 readOnly breaking 變更。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, openapi
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。