Home > Net >  ASP. Net Core (Web API) match NSwag (Swagger) using ProducesResponseType question
ASP. Net Core (Web API) match NSwag (Swagger) using ProducesResponseType question

Time:11-25

Hi,

I try to Web API within the Controller Method above plus the return type of announcement - [ProducesResponseType (typeof (LoginResult_Reply), 200)],
LoginResult_Reply is inherited from Basic_Reply, but within the Swagger of files, the content of the return format is Basic_Reply, excuse me this how to solve...
Thank you,

-
Public class BasicReply
{
[JsonPropertyName (" error ")]
Public string error {get; The set; }
[JsonPropertyName (" errorMessage ")]
Public string errorMessage {get; The set; }

Public BasicReply ()
{
Error="0";
ErrorMessage="";

}
}
-
Public class LoginResult_Reply: BasicReply
{

[JsonPropertyName (" reply ")]
Public LoginResult reply {get; The set; }

Public LoginResult_Reply ()
{
Reply=null;
}
}


  • Related