You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It is annoying that reaching for Rule.custom is not enough to hand-pick the severity. In particular when mixing logic that may produce both errors and warnings. This results in unneeded complexity (as the same logic to inspect the value is split across different rules).
Multiple rules are needed and need to be nested where already using Rule.custom should permit maximal customization.
Creating custom warnings, mixed with errors, currently requires:
interfaceValidationError{// New addition:severity?: 'warning'|'error'/* | ... */// Current operational fields:message: string;path?: Path;}
Then use it like so:
Rule.custom((value)=>{constfailures: ValidationError[]=[];if(/* ... */){failures.push({message: 'My warning',severity: 'warning'})// Overrides severity of the rule definition.}if(/* ... */){failures.push({message: 'My error'})// no severity field: use severity from rule definition}})
The text was updated successfully, but these errors were encountered:
Hi @blended-bram ! Yes, I understand the duplicated logic probably feels a bit frustrating. I'm forwarding this feature request to our studio team. Thanks very much for submitting it!
Is your feature request related to a problem? Please describe.
It is annoying that reaching for
Rule.custom
is not enough to hand-pick the severity. In particular when mixing logic that may produce both errors and warnings. This results in unneeded complexity (as the same logic to inspect the value is split across different rules).Multiple rules are needed and need to be nested where already using
Rule.custom
should permit maximal customization.Creating custom warnings, mixed with errors, currently requires:
I guess one could make a helper function that splits an implementation:
Describe the solution you'd like
Then use it like so:
The text was updated successfully, but these errors were encountered: