Closed LandyCuadra closed 2 years ago
How do you imagine to assign .show
field? From where? Where do you want to specify it?
$.invalid()
method contains fixed arguments.You can't change them - or you may change them, but I don't recommend itBTW: you can extend error builder instance dynamically in the schemas like this:
$.error. // --> is ErrorBuilder instance
$.error.visible = { errorid1: true, errorid2: true };
Then you can use it in transformation like this:
ErrorBuilder.addTransform('custom', function(isresponse) {
this.visible. // your data
for (var err of this.items)
err.show = this.visible[err.name];
}, true);
You suggestion was correct, I was misunderstanding the function of error builder.... Finally I solved it with $.success(false, ErrorObject)... Thank you
Is the feature request related to a problem? Please describe. I am trying to customize the error response by adding/changing some keys to it:
this is the default error object
Describe the solution you'd like would to know a way to add fields, that can be invoke with $.invalid()
Describe alternatives you've considered I have tried using the ErrorBuilder AddTransform function, to rename the fields.... but but it is kind of messy to assign
builder['show'] = Boolean(err.path)
... also I am limited to the quantity of fields of the default object