microsoft / microsoft/OpenAPI.NET.OData
Post/Patch/Delete Paths not generated for type casts
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 240
- Forks
- 70
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 13
Description
When generating an OpenAPI specification of the OData model, it does not generate the post/patch/delete paths for the type cast entities. In my example (see below) CreateJiraIssue is derived from Widget. But it does not generate the paths for post/patch/delete
OData supports post/patch/delete for the cast types! It works when you do an patch request to the correct url. It is also described here:
https://learn.microsoft.com/en-us/odata/webapi-8/fundamentals/entity-routing?tabs=net60%2Cvisual-studio
Assemblies affected
Microsoft.OpenApi.OData (1.6.3)
Steps to reproduce
Create a class A and a derived class B. Add class A as entity set to the odata model.
In the converter settings you need to set RequireDerivedTypesConstraintForODataTypeCastSegments to false.
Expected result
The post/patch/delete paths would be generated for all derived (cast) types.
Actual result
Only the get paths are generated for derived (class) types.
Additional detail
I looked into the code and I have an idea where this is coming from.
The ODataTypeCastPathItemHandler will be used for the path (because of the type cast kind). And there only the Get operation will be set:
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.
Research direction
Start with src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs, specifically the type-cast path handling referenced in the issue. Reproduce the case with base class A, derived class B, and RequireDerivedTypesConstraintForODataTypeCastSegments set to false. Done means generated paths for the cast type include POST, PATCH, and DELETE as well as GET.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 54/100