From 62f6b486708a469d1ae71d0f0abaad14297cf1f8 Mon Sep 17 00:00:00 2001 From: tomgreenfield Date: Fri, 16 Sep 2016 10:07:01 +0100 Subject: [PATCH] Fix error when defining JSON objects in schema --- lib/helpers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/helpers.js b/lib/helpers.js index 7560974e16..d4eb233f22 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -41,7 +41,9 @@ function schemaToObject (schema, id, version, location) { child[key] = prop.default || []; break; case "object": - child[key] = walkObject(prop.properties); + var nestedProps = prop.properties; + + child[key] = nestedProps ? walkObject(nestedProps) : prop.default || {}; break; default: break;