microsoft / microsoft/OpenAPI.NET.OData
Refactor the whole project
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 240
- 派生
- 70
- 平均合并
- 7 小时 59 分钟
- 30 天内合并 PR
- 13
描述
Short summary (3-5 sentences) describing the issue.
Recently, I got a lot of requirements, for example
- I don't want to expand on certain element
- I don't need this operation
- I need this ...
- etc..
Yes, we can meet all of these by modifying the codes, by adding settings, etc.
However, i'd think maybe it's time to refactor it in the next major release.
Design
I'd like to use the Dependency Injection to allow customer to customize the converting process.
We need figure out the working flow from OData to OpenAPI. The process steps are certain, at each step, we can create a service to work on it.
Services
We need figure out the services used during converting.
for example:
- we should have a OData path provider service
- we should have a OpenApi path generator service
- We should have a convert engine
Extension methods
I think we need
public static IServiceCollection UseOpenApiOData(IServiceCollection services)
{
services.AddSingleton<IOpenApiODataConverter>(); // converter or generator
services.AddSingleton<IODataPathProvider>();
services.AddSingleton<IODataOpenApiPathHandler>();
services.AddSingleton<IODataOpenApiOperationHandler>();
.....
service.AddSingleton<ODataOpenApiOptions>();
return services;
}
Usage
- you can create the OpenApiODataConverter instance (normal way)
- you can retrieve it from service provider.
IServiceCollection services= new ServiceCollection();
services.UserOpenApiOData();
IServiceProvider sp = services.CreateServiceProvider();
IOpenApiODataConverter converter = sp.GetService<IOpenApiODataConverter>();
...
Advantage
-
It can be used in the ASP.NET Core pipeline, for example we can create a middleware to generate the OpenAPI description for a OData service.
-
It can support to customize the converting. For example, we can replace a certain service using customized service.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
未指定源文件或测试。首先跟踪 OData-to-OpenAPI 转换流程,并审查提议的 IOpenApiODataConverter、IODataPathProvider、path 和 operation 处理程序,以及 UseOpenApiOData 注册示例。完成条件是确定一个达成共识的服务边界和支持自定义转换的 dependency injection 设计。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp
- 领域
- backend-api-design
- Issue 类型
- 重构
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100