microsoft / microsoft/OpenAPI.NET.OData
Set request body to optional when all properties are optional
已经有一个关联 PR 被合并了。
- #775 来自 @baywet —— 已合并
- 主要语言
- C#
- 星标
- 240
- 派生
- 70
- 平均合并
- 7 小时 59 分钟
- 30 天内合并 PR
- 13
描述
Related to https://github.com/microsoftgraph/msgraph-sdk-java/pull/2163 and https://github.com/microsoftgraph/msgraph-sdk-dotnet/pull/2671#discussion_r1765012196
In a scenario where all the properties in the request body are optional such as an odata action with all parameters being optional, we should set the requestBody.required = false in the generated openApi description otherwise explictly set it to true.
https://spec.openapis.org/oas/v3.0.3.html#fixed-fields-10
This will unlock the generation of request body parameters in the SDKs as optional parameters in the builders to prevent breaking changes in scenarios where optional parametes are added.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先查看链接的 Microsoft Graph pull request,以及 OpenAPI 3.0.3 的 request-body 固定字段规范。追踪生成的 OpenAPI 描述在何处确定 requestBody.required;完成的标准是:对于属性全部为可选的 body,正确表示其可选性,同时必需的 body 仍明确标记为必需。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- api
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100