Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

App Services do not return the object described in Swagger.json #7933


User avatar
0
dmux created

When querying the App Services as an API call, the return object looks like this:

{ "result": { -The serialized POCO object Swagger is advertising- }, "targetUrl": string, "success": bool, "error": string, "unAuthorizedRequest": bool, "__abp": bool }

While it's easy enough to unwrap the object once you know what to expect, unfortunately the auto-generated client code created by the Swagger/NSwag tool creates code which is broken because it is not expecting the wrapper. This means if I regenerate the client code I need to go through it fixing the deserialisation routines again.

Can we somehow tell Swagger to include the wrapper object in its advertised schema? This would mean the generated code would automatically have the correct objects to deserialise correctly (It would also mean Swagger reports its schema truthfully, which seems desirable).


2 Answer(s)
  • User Avatar
    1
    maliming created
    Support Team

    If you use Zero Angular, it will automatically handle the situation you mentioned using abp-ng2-module

    see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2637

  • User Avatar
    0
    dmux created

    Perfect! Thank you.

    Angular wasn't what I needed - I'm creating a data transfer client, not a UI. But in the article you linked to, this was precisely what I hoped for:

    AbpAspNetCore().DefaultWrapResultAttribute.WrapOnSuccess = false;