Generierung eines Clients

Hallo,
ich benutze die OpenAPI-Spezifikation und lasse mir mit nswag einen C#-Client generieren.
Die Einstellung für “Operation Generation Mode” ist auf MultipleClientsFromOperationId.
Ich bekomme dann folgende Methodennamen generiert:

LocationsAsync(string countryCode)
AbsenceregionsGETAsync(System.Guid absenceRegionId);
FilesDELETE3Async(System.Guid companyId, System.Threading.CancellationToken cancellationToken);

Diese Namen sind sehr inkonistent. Ich hätte gerne so etwas wie:

GetLocationAsync(string countryCode)
GetAbsenceRegionsAsync(System.Guid absenceRegionId);   // Klein-Großschreibung
DeleteCompanyFilesAsync(System.Guid companyId, System.Threading.CancellationToken cancellationToken);

Durch keine andere Einstellung von “Operation Generation Mode” gelingt mir ein konsistentes Naming. Kann mir Jemand helfen?

Vielen Dank im voraus!

PS: In der Dokumentation steht bei https://api.awork.com/api/v1/projects/:projectId/timeentries
folgendes:

The projectName parameter defines the main project of which to fetch the time entries.

Ich glaube es müsste projectId statt projectName heissen.

Hi @Wojciech and welcome to the forum. We have similar issues with the generated clients as they often only take a part of the route or the tags into consideration when generating the method name. What worked for us is to implement a name override, which allowed us to define a custom logic for the names. In nswag this is called IOperationNameGenerator. It’s not perfect but allows to create better names than the default generator does.

I will check the incorrect documentation, thank you!

I think the problem is that we don’t generate operation ids in our OpenAPI docs. I’ll check if we can do this and whether that improves the generated client.

That would be great!
Thanks!