Set request body to optional when all properties are optional
A pull request for this has already been merged.
- #775 by @baywet — merged
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
Research direction
Start by reviewing the linked Microsoft Graph pull requests and the OpenAPI 3.0.3 request-body fixed fields specification. Trace where the generated OpenAPI description determines requestBody.required; done means optionality is represented correctly for bodies whose properties are all optional while required bodies remain explicitly required.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C#
- Stars
- 240
- Forks
- 70
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 13
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/OpenAPI.NET.OData
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/OpenAPI.NET.OData#661 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
microsoft/OpenAPI.NET.OData#852 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/OpenAPI.NET.OData#833 ·
-
status:needs-more-information
Difficulty 4/5 3-5 days Newbie friendliness 42/100
microsoft/OpenAPI.NET.OData#723 · 1 comment · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
microsoft/OpenAPI.NET.OData#720 ·
All issues in microsoft/OpenAPI.NET.OData
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·