Skip to content

Commit a5440bc

Browse files
committed
Address review comments
1 parent e2e0a26 commit a5440bc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Schema.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ function classNameIsValid(className) {
7676
className === '_SCHEMA' || //TODO: remove this, as _SCHEMA is not a valid class name for storing Parse Objects.
7777
className === '_Role' ||
7878
joinClassRegex.test(className) ||
79-
classAndFieldRegex.test(className)
79+
//Class names have the same constraints as field names, but also allow the previous additional names.
80+
fieldNameIsValid(className)
8081
);
8182
}
8283

schemas.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ function mongoFieldTypeToSchemaAPIType(type) {
3232

3333
function mongoSchemaAPIResponseFields(schema) {
3434
fieldNames = Object.keys(schema).filter(key => key !== '_id');
35-
response = {};
36-
fieldNames.forEach(fieldName => {
37-
response[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName]);
38-
});
35+
response = fieldNames.reduce((obj, fieldName) => {
36+
obj[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName])
37+
return obj;
38+
}, {});
3939
response.ACL = {type: 'ACL'};
4040
response.createdAt = {type: 'Date'};
4141
response.updatedAt = {type: 'Date'};

0 commit comments

Comments
 (0)