microsoft / microsoft/OpenAPI.NET.OData
Refactor the whole project
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 240
- Forks
- 70
- Merge moyen
- 7 h 59 min
- PR mergées (30 j)
- 13
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Aucun fichier source ni test n’est indiqué. Commencez par retracer le flux de conversion OData-to-OpenAPI et examiner les IOpenApiODataConverter et IODataPathProvider proposés, les gestionnaires de path et operation, ainsi que l’exemple d’enregistrement de UseOpenApiOData. La tâche est considérée comme terminée lorsqu’une limite de service convenue et une conception de dependency injection prenant en charge une conversion personnalisée sont définies.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp
- Domaine
- backend-api-design
- Type d'issue
- Refactorisation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 20/100