From a5440bcc404c343e7a87c5f55f8b329d9c3c29fb Mon Sep 17 00:00:00 2001 From: Drew Gross Date: Fri, 5 Feb 2016 18:53:06 -0800 Subject: [PATCH] Address review comments --- Schema.js | 3 ++- schemas.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Schema.js b/Schema.js index 3f590ac7..25e301cd 100644 --- a/Schema.js +++ b/Schema.js @@ -76,7 +76,8 @@ function classNameIsValid(className) { className === '_SCHEMA' || //TODO: remove this, as _SCHEMA is not a valid class name for storing Parse Objects. className === '_Role' || joinClassRegex.test(className) || - classAndFieldRegex.test(className) + //Class names have the same constraints as field names, but also allow the previous additional names. + fieldNameIsValid(className) ); } diff --git a/schemas.js b/schemas.js index 4a8d50b4..875967cd 100644 --- a/schemas.js +++ b/schemas.js @@ -32,10 +32,10 @@ function mongoFieldTypeToSchemaAPIType(type) { function mongoSchemaAPIResponseFields(schema) { fieldNames = Object.keys(schema).filter(key => key !== '_id'); - response = {}; - fieldNames.forEach(fieldName => { - response[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName]); - }); + response = fieldNames.reduce((obj, fieldName) => { + obj[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName]) + return obj; + }, {}); response.ACL = {type: 'ACL'}; response.createdAt = {type: 'Date'}; response.updatedAt = {type: 'Date'};