angular-schema-form icon indicating copy to clipboard operation
angular-schema-form copied to clipboard

External validator function

Open clmntr opened this issue 7 years ago • 5 comments

Add the possibility to have an external validator function by passing to the validator an expression. Such as : "$validators" : { "equalsEmail" : "mustBeEqual(modelValue, 'email')" }

Description

Add your description here

Fixes Related issues

  • add related
  • issues here

Checklist

  • [x] I have read and understand the CONTRIBUTIONS.md file
  • [x] I have searched for and linked related issues
  • [ ] I have created test cases to ensure quick resolution of the PR is easier
  • [x] I am NOT targeting main branch
  • [x] I did NOT include the dist folder in my PR

@json-schema-form/angular-schema-form-lead

clmntr avatar Sep 26 '17 12:09 clmntr

@BulletAnt thanks for this, could you add a quick test case or show me a plunker that shows it working I can make a test case from?

Anthropic avatar Sep 27 '17 04:09 Anthropic

Sure, will do it when I have some time ;)

clmntr avatar Sep 28 '17 08:09 clmntr

Hi!

I finally took the time to create a plunker that shows the "external" validator.
Here you go: https://plnkr.co/edit/izM9FPnz8O3IewgquxZd

Plus, in my project version (based on the bower version) I also added this to the parsers, and allow the $validators/$parsers/etc... definition directly in the schema. As I use one schema for two forms, it is easier to define those in the schema instead of the form. Let me know if you want me to add this in another PR.

Cheers

clmntr avatar Nov 07 '17 19:11 clmntr

Hi @Anthropic, and Happy New Year !

Do you have any update on this PR ? Should I review some parts ?

Cheers

clmntr avatar Jan 09 '18 09:01 clmntr

Hi @BulletAnt thanks for the nudge, I missed your Nov update! I'll take a look shortly, Nov-Jan were a write-off unfortunately, way too busy with work and then holidays.

Anthropic avatar Jan 22 '18 04:01 Anthropic