Skip to content

Commit

Permalink
Merge branch 'GPII-3994'
Browse files Browse the repository at this point in the history
* GPII-3994:
  GPII-3994: Improved model component validation lifecycle and removed IoC workarounds from error binder.
  GPII-3921: Further insulated error binder to avoid errors during the initial validation phase.
  GPII-3921: Converted direct options call to use IoC.
  Updated forward-facing version following 2.1.0 release.
  • Loading branch information
amb26 committed Jun 28, 2019
2 parents d193a96 + 5d7b38c commit 16355e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gpii-json-schema",
"version": "2.1.0",
"version": "2.1.1",
"description": "Support validation of JSON within the Fluid and GPII ecosystems.",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/js/client/errorBinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
https://github.com/the-t-in-rtf/gpii-json-schema/blob/master/docs/validator.md
*/
/* globals fluid */
(function () {
"use strict";
var gpii = fluid.registerNamespace("gpii");
Expand All @@ -38,7 +37,7 @@
invokers: {
renderErrors: {
funcName: "gpii.schema.client.errorAwareForm.renderErrors",
args: ["{that}", "{renderer}"]
args: ["{that}", "{renderer}"] // renderer
}
},
modelListeners: {
Expand Down Expand Up @@ -77,7 +76,7 @@
var bindingPath = fluid.get(value, "path") || value;
fluid.each(that.model.validationResults.errors, function (error) {
if (gpii.schema.client.elPathsEqual(error.dataPath, bindingPath)) {
that.renderer.before(fieldElement, that.options.templateKeys.inlineError, error); // element, key, context
renderer.before(fieldElement, that.options.templateKeys.inlineError, error); // element, key, context
}
});
}
Expand Down
8 changes: 7 additions & 1 deletion src/js/common/schemaValidatedModelComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ var fluid = fluid || require("infusion");
},
modelListeners: {
"*": {
excludeSource: "validation",
excludeSource: ["init", "validation"],
funcName: "gpii.schema.modelComponent.validateModel",
args: ["{gpii.schema.validator}", "{that}"] // globalValidator, validatedModelComponent
}
},
listeners: {
"onCreate.validate": {
funcName: "gpii.schema.modelComponent.validateModel",
args: ["{gpii.schema.validator}", "{that}"] // globalValidator, validatedModelComponent
}
Expand Down

0 comments on commit 16355e9

Please sign in to comment.