microsoft / microsoft/OpenAPI.NET.OData
Enum return value schema is wrong
未关闭
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 240
- 派生
- 70
- 平均合并
- 7 小时 59 分钟
- 30 天内合并 PR
- 13
描述
If a function returns Enum resulting schema is not wrapped but instead represented as enum itself.
Assemblies affected
Microsoft.OpenApi.OData 1.7.4
Steps to reproduce
I have a function that returns enum. It goes like this:
<Function Name="GetRemoteAccessStatus" IsBound="true">
<ReturnType Type="RemoteAccessStatus" Nullable="false"/>
</Function>
<EnumType Name="RemoteAccessStatus">
<Member Name="None" Value="0"/>
<Member Name="Requested" Value="1"/>
<Member Name="Active" Value="2"/>
</EnumType>
Expected result
In the resulting schema I want to see something like this:
schema:
type: object
properties:
value:
anyOf:
- $ref: '#/components/schemas/RemoteAccessStatus'
Actual result
Actually I get (skipped value):
schema:
$ref: '#/components/schemas/Pbx.RemoteAccessStatus'
Additional information
I thinks the issue is in OpenApiResponseGenerator.cs where for collection and primitive types it wraps the responses but not for Enum
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 OpenApiResponseGenerator.cs 开始,使用提供的 OData CSDL 重现函数响应。比较 collection 和 primitive 返回类型如何通过 enum path 进行包装,然后验证生成的 schema 使用了一个带有引用 RemoteAccessStatus 的 value 属性的 object。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, openapi
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100