I decorated the action as follows
[SwaggerResponse(HttpStatusCode.OK, "List of customers", typeof(List<CustomerDto>))] [SwaggerResponse(HttpStatusCode.NotFound, Type = typeof(NotFoundException))]
The OK model is shown correctly.
However, in Repsonse posts, I get “Object Not Primitive” for NotFound . A custom exception comes from Exception , implements ISerializable , and also has [Serializable] and [DataContract()]
How can I show the actual data type instead of a message?
Also, if I use WebApi normally, if I decorate all actions with such attributes?
source share