My SwaggerUI schema info is not showing which properties are nullable on the response, I want to generate a more accurate specification, there is any way to achieve this?.
Packages:
Swagger-Net 8.4.19.1 on .NET Framework 4.7
config.EnableSwagger(c =>
{
c.PrettyPrint();
c.UseFullTypeNameInSchemaIds();
c.GroupActionsBy(groupByFolder);
//c.OperationFilter<AddRequiredHeaderParameter>();
c.RootUrl(req => req.RequestUri.GetLeftPart(UriPartial.Authority) +
req.GetRequestContext().VirtualPathRoot.TrimEnd('/'));
c.SingleApiVersion("v1", "namespace.WebApi");
c.ApiKey("Authorization", "header", "Bearer dasdasdasdasd....(/authenticate first)");
})
.EnableSwaggerUi(c =>
{
c.EnableDiscoveryUrlSelector();
c.DocExpansion(DocExpansion.List);
}
);
}
Example:
[HttpGet]
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(GetApplicationStatusResult))]
[Route("clients/{clientId}/applications/status")]
public HttpResponseMessage GetApplicationStatus(string clientId)
{
return Request.CreateOkResponse(MobileAppManager.GetApplicationStatus(clientId));
}
public class GetApplicationStatusResult
{
public Guid? ApplicationId { get; set; }
public int? Type { get; set; }
public int? Status { get; set; }
public int? NewApplicationRemainingDays { get; set; }
}
Missing info on which properties are nullable:
https://i.stack.imgur.com/MzxoC.png
I already tried using the System.Web.Http.Description.ResponseType
attribute instead of SwaggerResponse, the result was the same.
The whole solution is on .NET framework 4.7, (not .NET Core). I can't update it to core without losing weeks to refactor every controller in the solution.