From 8a9bece34c85dd80e3b5aff787f3e2110903114f Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Fri, 3 Oct 2014 10:46:47 +0200 Subject: [PATCH 1/4] Removed incorrect handling ```toJSON()``` for empty collections --- backbone-schema.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/backbone-schema.js b/backbone-schema.js index 4b32cde..151033c 100644 --- a/backbone-schema.js +++ b/backbone-schema.js @@ -1501,10 +1501,6 @@ var toReturn; if(this.schema) { var models = this.models; - if(models.length === 0) { - return undefined; - } - toReturn = []; _.each(models, function(model) { var value = model.toJSON(options); From d2194caa48819cf592c4cad77788f5388f74d1e2 Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Mon, 22 Dec 2014 16:53:50 +0100 Subject: [PATCH 2/4] NPM publish --- README.md | 4 ++++ package.json | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9241e86..04e9ea6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +NOTE +==== +This is a patched and npm-published version of https://github.com/redpie/backbone-schema + Backbone.Schema =============== diff --git a/package.json b/package.json index 5c25de8..bdad9a7 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { - "name" : "backbone-schema", - "description" : "Create Backbone models and collections from JSON Schema", + "name" : "backbone-json-schema", + "description" : "A patched and npm published fork of https://github.com/redpie/backbone-schema --- Create Backbone models and collections from JSON Schema", "keywords" : ["Backbone", "schema", "json", "jsonschema", "nested", "model", "collection"], - "repository" : "git://github.com/redpie/backbone-schema.git", - "author" : "Redpie", + "repository" : "git://github.com/Reggino/backbone-json-schema.git", "contributors" : "Listed at ", "dependencies" : { "backbone": ">=0.9.2", From 648dba51b13edf68aec26f19bba34933ebd92e81 Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Wed, 24 Dec 2014 16:44:44 +0100 Subject: [PATCH 3/4] Registration now is possible --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 14dbadc..a84a8f3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .DS_Store node_modules npm-debug.log +.idea \ No newline at end of file From 33b9c5a3ce460d8f8470052660c128a385bd276f Mon Sep 17 00:00:00 2001 From: Aubrey Hewes Date: Thu, 2 Apr 2015 17:02:55 +0200 Subject: [PATCH 4/4] Fixed incorrect handling toJSON for falsey values --- backbone-schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone-schema.js b/backbone-schema.js index 151033c..94a9317 100644 --- a/backbone-schema.js +++ b/backbone-schema.js @@ -887,7 +887,7 @@ if(this.schema) { _.each(this.schema.properties, function(property, name) { var attribute = this.attributes[name]; - if(attribute) { + if ([undefined, null].indexOf(attribute) === -1) { var value; if(this.schemaRelations[name]) { value = attribute.toJSON(options);