OpenAPITools / OpenAPITools/openapi-generator

[aspnetcore] configuration options to generate IActionResult` with `ActionResult<{{dataType}}>`

Open
#7,228 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Server: C-Sharp
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is there a way or config option (https://openapi-generator.tech/docs/generators/aspnetcore/) available to generate controllers using the generic IActionResult<T> as the return type instead of just IActionResult? (to constraint the expected object to be returned)

I see @InfoSec812 was looking forward for the same feature.

Same here... I need to modify the template for the controllers to replace IActionResult with ActionResult<{{dataType}}>

Originally posted by @InfoSec812 in https://github.com/OpenAPITools/openapi-generator/issues/6215#issuecomment-670475820

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the aspnetcore generator documentation linked in the issue and the controller templates it describes. Determine whether a configuration option can produce generic ActionResult return types; done means generated controllers use the requested generic return type with the appropriate data type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.