microsoft / microsoft/OpenAPI.NET.OData
Refactor the whole project
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 240
- Forks
- 70
- Ø Merge
- 7 Std. 59 Min.
- Gemergte PRs (30 T.)
- 13
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es werden keine Quelldateien oder Tests genannt. Beginnen Sie damit, den OData-to-OpenAPI-Konvertierungsablauf nachzuverfolgen und den vorgeschlagenen IOpenApiODataConverter, IODataPathProvider, die path- und operation-Handler sowie das Registrierungsbeispiel für UseOpenApiOData zu überprüfen. Als abgeschlossen gilt die Aufgabe, wenn eine abgestimmte Service-Grenze und ein Dependency-Injection-Design vorhanden sind, die eine angepasste Konvertierung unterstützen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp
- Bereich
- backend-api-design
- Issue-Typ
- Refactoring
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100