Set request body to optional when all properties are optional

未关闭
#582 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

已经有一个关联 PR 被合并了。

  • #775 来自 @baywet —— 已合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
csharp
领域
api

调研方向

首先查看链接的 Microsoft Graph pull request,以及 OpenAPI 3.0.3 的 request-body 固定字段规范。追踪生成的 OpenAPI 描述在何处确定 requestBody.required;完成的标准是:对于属性全部为可选的 body,正确表示其可选性,同时必需的 body 仍明确标记为必需。

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

描述

priority:p1

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.

主要语言
C#
星标
240
派生
70
平均合并
7 小时 59 分钟
30 天内合并 PR
13

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/OpenAPI.NET.OData 的其他 Issue

查看 microsoft/OpenAPI.NET.OData 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

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