-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I created an ASP .NET Core server from CLI with the additonal options operationResultTask=true and operationIsAsync=true. I used the public PetStore Open API spec in the newest version (currently 1.0.17). When I try to build the solution with VS 2022 (17.4.1) an error occurs:
| Schweregrad | Code | Beschreibung | Projekt | Datei | Zeile | Unterdrückungszustand |
|---|---|---|---|---|---|---|
| Fehler | CS4016 | Da es sich um eine asynchrone Methode handelt, muss der Rückgabeausdruck vom Typ "IActionResult" anstelle von "Task" sein. | PetStore.Web | C:\Users[robin-83]\PetStore.Web9\src\PetStore.Web\Controllers\PetApi.cs | 60 | Aktiv |
openapi-generator version
6.2.1. I have not tested this in older versions.
OpenAPI declaration file content or url
Generation Details
openapi-generator-cli generate -i petstore.yaml -g aspnetcore -o PetStore.Web --package-name PetStore.Web --additional-properties=operationResultTask=true,operationIsAsync=true
Steps to reproduce
- Open the solution in VS 2022
- Rebuild
Related issues/PRs
Dont know any.
Suggest a fix
Original code:
return Task.FromResult<IActionResult>(new ObjectResult(example));
Possible fix:
return new ObjectResult(example);
Reactions are currently unavailable