3

I'm currently working on a project where we generate all our controllers automatically. Our BaseController has an action ike this:

    [HttpPost("")]
    public virtual Task<IActionResult> Create([FromBody] ICreateEntityModel<TBaseEntity> model)
    {
        return ProcessActionAsync(model);
    }

After I setup NSwag I end up with models like this:

   ICreateEntityModelOfPerson:{  
     type:"object",
     x-abstract:true,
     additionalProperties:false
   }

The interface is just a marker and of no interest for an API user. Is there a way to generate the model for the actual type (in this case Person) and not the interface? Am I just missing the correct configuration or do I need an extra processor?

mvogler
  • 31
  • 2

2 Answers2

0

Use [ProducesResponseType(200, typeof(...)] to specify the response type for a given status code.

Rico Suter
  • 10,556
  • 3
  • 57
  • 89
0

[ProducesResponseType(typeof(ErrorMessage), StatusCodes.Status400BadRequest)]

works for me

Roger C S Wernersson
  • 5,857
  • 5
  • 30
  • 40