microsoft / microsoft/OpenAPI.NET.OData
Provide a way to not generate navigation paths with key
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 239
- Forks
- 70
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 13
Description
I am new to implementing my first OData service. I am using OData for .NET 8+ with the ODataConventionModelBuilder to generate my model.
When a navigation property references an entity that is indexable, a path is generated of the form
Entity({ID})/NavEntity({ID1}) or Entity/{ID}/NavEntity/{ID1}.
The routing conventions don't include this path. They only support navigation to the NavEntity level. It would be helpful if there were a way to configure the conversion not to generate navigation paths with the key, even though the entity has one. As a practical matter, I'm not sure when I would need to query the navigation property by key, especially if the navigation property is available as a root entity.
As a workaround, I have added code to remove the unsupported paths from the OpenApiDocument before serializing it. As the OData service evolves, this code has to also evolve. If the conversion didn't generate the path with multiple keys, this workaround code would be unnecessary.
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
Trace the ODataConventionModelBuilder conversion through the OpenApiDocument generation and routing conventions. Identify where keyed navigation paths are added, then determine how configuration could suppress them and verify that generated documents omit those unsupported paths without removing valid navigation routes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100