microsoft / microsoft/OpenAPI.NET.OData

Provide a way to not generate navigation paths with key

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

还没有人认领这个 Issue。

status:needs-more-information
主要语言
C#
星标
239
派生
70
平均合并
7 小时 59 分钟
30 天内合并 PR
13

描述

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.

贡献指南

打开贡献指南

从这里开始

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

调研方向

跟踪 ODataConventionModelBuilder 经过 OpenApiDocument 生成和路由约定的转换过程。确定键控导航路径在哪里被添加,然后确定如何通过配置抑制这些路径,并验证生成的文档会省略这些不受支持的路径,同时不会删除有效的导航路由。

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

评估

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

把新 issue 发到你的邮箱

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