Refinement for top level object failed when field has refinement
See original GitHub issueUsing the validators below, the top level PasswordDoNotMatch
refinement will not be called.
On the other hand, if we change to newPassword: string()
(i.e. no refinement in any of the nested fields), then the PasswordDoNotMatch
will be called.
const PasswordValidator = refine(string(), 'MinimumLength', (pw) => pw >= 8);
const ChangePasswordValidator = object({
newPassword: PasswordValidator,
confirmPassword: string(),
});
const RefinedChangePasswordValidator = refine(ChangePasswordValidator, 'PasswordDoNotMatch', (values) => {
return values.newPassword == values.confirmPassword; // This will not be called
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Why did I get "main.using is permitted only at toplevel" when I ...
It's either a bug or a misfeature of IRb. It is well-known that due to the pretty hackish way IRb is implemented, it...
Read more >LookML refinements | Looker - Google Cloud
Adapt and build on existing elements with LookML refinements.
Read more >Refining Objects - CMU School of Computer Science
At the structural level dynamic dispatch may fail, but at ... able, showing that a program satisfies a refinement is, by Rice's Theorem,...
Read more >Error-driven adaptive mesh refinement for unsteady turbulent ...
This case is relevant because of the difficulty to predict the separation of the flow induced by the presence of a curved surface...
Read more >Learning to Refine Object Segments - Ronan Collobert
Object segmentation requires both object-level information ... M1 serves as the input to the top-down refinement module, which is responsi-.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Gelio that sounds great! Actually I believe there is already an
error.refinement
field which might give us exactly what we need to make that check in therun
function.Great! Sure, I’ll try to prepare something over the weekend.
Just to be clear, I will disambiguate the errors so that we have specific
validator
andrefiner
errors and then run therefiner
if there were novalidator
errors on thevalue
itself or its entries.