Added nested struct validation#128
Added nested struct validation#128aneshas wants to merge 1 commit intoGoogleCloudPlatform:masterfrom aneshas:validate-nested-structs
Conversation
Added more descriptive req error message Reordered req check in order to fix, failing tests Signed-off-by: Anes Hasicic <anes.hasicic@gmail.com>
There was a problem hiding this comment.
Not sure passing the parent field is really worth it
There was a problem hiding this comment.
I passed in the parent because I added return fmt.Errorf("missing field %v in %v", t.Name, parent.Name()) a parent to a missing field error.
I did it because if you have multiple fields with the same name in a struct and nested structs, the default missing field %v felt non descriptive, you wouldn't know which struct it belongs to. But if you feel like it's too much, I will remove it :)
There was a problem hiding this comment.
Sorry, but I don't understand what that comment should point out me?
There was a problem hiding this comment.
That comment is about adding the info about the parent type on the
if err != nil { return ... }
|
This is pretty good, but please add tests and address my comments. Thanks! |
|
@campoy Thanks, yes I will add tests |
There was a problem hiding this comment.
Don't pass the type and instead just add the info to the error message.
return fmt.Errorf("%v in %s", err, t)
Added nested struct validation and more descriptive req error message.
Closes #107
Signed-off-by: Anes Hasicic anes.hasicic@gmail.com