Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringSearch validation fails when server result is 0 #44

Closed
rafaelverger opened this issue Nov 10, 2017 · 0 comments
Closed

StringSearch validation fails when server result is 0 #44

rafaelverger opened this issue Nov 10, 2017 · 0 comments

Comments

@rafaelverger
Copy link
Contributor

rafaelverger commented Nov 10, 2017

Method validateAnswer in controller.ts use utils.ensureArray to make sure that user's answer is an array to then iterate this resulted list in all rule's validators.

When a Type implements multiple executors with custom validator to each one of them it could face a "skip validation" of some executor depending on what transformation you do.

In the case of StringSearch type the first transformation get the server result and transforms it to a list of objects in the following shape: { label, value }. When server response is an empty array, the controller tries to iterate an empty string between the registered validators and them it doesn't behaves like expected because an empty array isn't iterated at all.

Suggested solution: each executor's transformation shall validate their own output if you're manipulating user's input into array

andersonba added a commit that referenced this issue Nov 10, 2017
Fixing validation flow in StringSerach. Closes #44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant