Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove the unused ‘validateProperty’ method

  • Loading branch information...
commit 0fdf129b71719c248d589be6b143c286822074b7 1 parent 3d2f09d
František Hába authored
Showing with 50 additions and 66 deletions.
  1. +50 −66 src/engines/json/validateSchema.js
116 src/engines/json/validateSchema.js
View
@@ -3,77 +3,61 @@
*
* @param {object} instance
* @param {object} schema
- * @param {boolean} singleError
+ * @param {string} path
* @param {function} callback
*/
Validation.prototype.validateSchema = function(instance, schema, path, callback) {
- // Reference na this
var self = this;
- /**
- * {
- * type: 'object',
- * properties: {
- * ...
- * }
- * }
- * — or —
- * {
- * type: 'array',
- * items: {
- * ...
- * }
- */
- if (['object', 'array'].indexOf(schema.type) !== -1) {
- return self.validateProperty(path, instance, schema, function(error) {
-
- /**
- * {
- * type: 'object',
- * properties: {
- * ...
- * }
- * }
- */
- if (schema.properties) {
- return self.validateProperties(instance, schema, path, callback);
-
- /**
- * {
- * type: 'array',
- * items: {
- * type: 'string'
- * ...
- * }
- * }
- */
- } else if (schema.items) {
- return self.validateItems(instance, schema, path, callback);
-
- /**
- * {
- * type: 'array'
- * }
- * — or —
- * {
- * type: 'object'
- * }
- */
- } else {
- return callback();
- }
-
- });
-
- /**
- * {
- * type: 'string',
- * length: ...
- * }
- */
- } else {
- return self.validateProperty(path, instance, schema, callback);
- }
+ return self.validateProperty(path, instance, schema, function(error) {
+
+ /**
+ * {
+ * type: 'object',
+ * properties: {
+ * ...
+ * }
+ * }
+ */
+ if (schema.properties) {
+ return self.validateProperties(
+ instance,
+ schema,
+ path,
+ callback
+ );
+
+ /**
+ * {
+ * type: 'array',
+ * items: {
+ * type: 'string'
+ * ...
+ * }
+ * }
+ */
+ } else if (schema.items) {
+ return self.validateItems(
+ instance,
+ schema,
+ path,
+ callback
+ );
+
+ /**
+ * {
+ * type: 'array'
+ * }
+ * — or —
+ * {
+ * type: 'object'
+ * }
+ */
+ } else {
+ return callback();
+ }
+
+ });
};
Please sign in to comment.
Something went wrong with that request. Please try again.