From: Stephen DelanoSent: Tuesday, May 20, 2014 18:30To: opscode/chef_objectsReply To: opscode/chef_objectsCc: Marc A. ParadiseSubject: Re: [chef_objects] initial pass: users endpoint in oc_erchef (#64)In src/chef_user.erl:
>  
>  -spec parse_binary_json(binary(), create | update) -> {ok, ej:json_object()}. % or throw
>  parse_binary_json(Bin, Operation) ->
>    User = chef_object_base:delete_null_public_key(chef_json:decode(Bin)),
>    %% If user is invalid, an error is thown
> +  validate_user(User, user_spec(common)),

Since we handle ej validation errors by catching it's throws, I've got a question about how this works in practice.

Does ej validate the whole spec before returning a list of all the failures, or does it simply fail fast?

If it validates the whole spec, by validating the common components first, we could get ourselves into a situation where we return incomplete validation to a user, they fix it, and still return an invalid object because not all the validation ran the first time.

I'm not really sure how much I'm worried about this in practice.

—Reply to this email directly or view it on GitHub.