I tried generating c# code for and API I created with ASP Net Boilerplate, but the response is not deserializing correctly.
Upon investigation, it seems the json response is wrapped using a class called "AjaxResponse"; however, the swagger.json doesn't include this type in the method response.
Does anyone know how to build a C# Swagger Client that accounts for the wrapped result?
Aspnet Boilerplate wraps real result within AjaxResponse. The class AjaxResponse is a generic type class. Swaggergen Tool fails to produce the right proxy classes because wrapping the result occurs in runtime. So the signature of the api, grabbed by Swagger is the raw result (not wrapped).
So the only solution is disabling automatic wrapper for solution-wide. Add the 2 lines to the PreInitialize() method in your Web.Core project. And your problem will be solved.
Configuration.Modules.AbpAspNetCore().DefaultWrapResultAttribute.WrapOnError = false;
Configuration.Modules.AbpAspNetCore().DefaultWrapResultAttribute.WrapOnSuccess = false;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With