microsoft / microsoft/OpenAPI.NET.OData

Provide a way to not generate navigation paths with key

Open
#723 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

status:needs-more-information
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.