json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

sfValidator regression in latest alpha #890

Closed donalmurtagh closed 7 years ago

donalmurtagh commented 7 years ago

I recently upgraded from 0.8.13 to the latest 1.0.0-alpha.5. In my app, I programmatically validate fields by injecting sfValidator and calling

sfValidator.validate(field, value);

Since the upgrade, this causes the following error:

sfValidator.validate is not a function

Has this function been renamed, or is there a replacement available?

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

Anthropic commented 7 years ago

Try sfValidator(form, viewValue) the sfValidator is now an alias for JSONSchemaFormCore.validate

.factory('sfSelect', () => JSONSchemaFormCore.select)
.factory('sfValidator', () => JSONSchemaFormCore.validate)
Anthropic commented 7 years ago

Please re-open if you do not feel the question has been answered sufficiently.

donalmurtagh commented 7 years ago

Thanks for your reply, this seems to have fixed the problem. If you're maintaining a 1.0 upgrade guide, this ought to be included.

Anthropic commented 7 years ago

Yes, I admit I had overlooked the idea of people using the factories outside the framework but obviously it happens especially in add-ons, I changed it as it seemed odd to have a single function added to an object instead of just passing the function. I should have logged it, I'm glad you raised it, got me thinking about what else may have seemed minor but actually are not.