poem icon indicating copy to clipboard operation
poem copied to clipboard

Getting parameter name when ParseRequestPayloadError occurs?

Open mmittnacht opened this issue 1 year ago • 1 comments

Hello,

I would implement some type of custom error message when the sent request has missing fields. The problem I have is, I can't find a way to extract the column name. For example I have this test struct.

struct Test { pub test1: String, pub test2: String, }

If in a Json<Test> requets body test1 is sent, but test2 is not, how could I get the missing param name, because the error message does not send this information: "parse request payload error: Expected input type "string", found null. (occurred while parsing "Test")"

mmittnacht avatar Dec 14 '23 09:12 mmittnacht

maybe we can make it work with serde_path_to_error

attila-lin avatar Feb 19 '24 04:02 attila-lin