microsoft / microsoft/OpenAPI.NET.OData

Action and Operation do not expose $select and $expand over entity types

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

还没有人认领这个 Issue。

主要语言
C#
星标
240
派生
70
平均合并
7 小时 59 分钟
30 天内合并 PR
13

描述

Action and Operation do not expose $select and $expand over entity types while this is possible for /entity/propertyOfComplexType

Assemblies affected

Microsoft.OpenApi.OData 1.7.5

Steps to reproduce

Register additional function for entity set:

        var fax = builder.EntityType<XFax>();
        fax.Collection.Function(nameof("GetByNumber"))
            .ReturnsFromEntitySet<XFax>("Fax")
            .NonNullable()
            .Parameter<string>("number").NonNullable();
Expected result

GetByNumber should have both $select and $expand operations because XFax is Entity type

Actual result

No operations available

Additional detail

I see that ComplexPropertyGetOperationHandler has the following logic:

  1. Expose $top, $skip, $search, $filter $count for a collection
  2. Try to expose $select and $expand

On the contrary EdmOperationImportOperationHandler has the following logic:

  1. Expose $top, $skip, $search, $filter $count for a collection
  2. Expose $select and $expand if 1. is true

Therefore I can't get $select and $expand for Function or Operation. Is it something explicitly prohibited by OData?
How can I do this in a different way?

P.S. I think as a workaround I can make alternate key. But I don't see any examples for OData 8

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 ComplexPropertyGetOperationHandler 和 EdmOperationImportOperationHandler 开始,然后复现注册到 XFax 实体集上的附加函数。将为返回实体的函数生成的操作与预期的 $select 和 $expand 行为进行比较。在确认并修正 handler 行为,并为报告的案例添加覆盖后,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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