Skip to content

Commit 31e37a6

Browse files
Lucian MateescuLucian Mateescu
Lucian Mateescu
authored and
Lucian Mateescu
committed
2 parents 9a14f53 + 8f2b20d commit 31e37a6

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

ExportAdapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ ExportAdapter.prototype.redirectClassNameForKey = function(className, key) {
118118
// Returns a promise that resolves to the new schema.
119119
// This does not update this.schema, because in a situation like a
120120
// batch request, that could confuse other users of the schema.
121-
ExportAdapter.prototype.validateObject = function(className, object) {
121+
ExportAdapter.prototype.validateObject = function(className, object, freeze) {
122122
return this.loadSchema().then((schema) => {
123-
return schema.validateObject(className, object);
123+
return schema.validateObject(className, object, freeze);
124124
});
125125
};
126126

RestWrite.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ RestWrite.prototype.execute = function() {
9191

9292
// Validates this operation against the schema.
9393
RestWrite.prototype.validateSchema = function() {
94-
return this.config.database.validateObject(this.className, this.data);
94+
var schemaFrozen = (process.env.NODE_ENV !== 'development') ? !(this.auth && this.auth.isMaster) : false;
95+
return this.config.database.validateObject(this.className, this.data, schemaFrozen);
9596
};
9697

9798
// Runs any beforeSave triggers against this operation.

Schema.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,18 @@ Schema.prototype.validateField = function(className, key, type, freeze) {
412412

413413
// Given a schema promise, construct another schema promise that
414414
// validates this field once the schema loads.
415-
function thenValidateField(schemaPromise, className, key, type) {
415+
function thenValidateField(schemaPromise, className, key, type, freeze) {
416416
return schemaPromise.then((schema) => {
417-
return schema.validateField(className, key, type);
417+
return schema.validateField(className, key, type, freeze);
418418
});
419419
}
420420

421421
// Validates an object provided in REST format.
422422
// Returns a promise that resolves to the new schema if this object is
423423
// valid.
424-
Schema.prototype.validateObject = function(className, object) {
424+
Schema.prototype.validateObject = function(className, object, freeze) {
425425
var geocount = 0;
426-
var promise = this.validateClassName(className);
426+
var promise = this.validateClassName(className, freeze);
427427
for (var key in object) {
428428
if (object[key] === undefined) {
429429
continue;
@@ -440,7 +440,7 @@ Schema.prototype.validateObject = function(className, object) {
440440
if (!expected) {
441441
continue;
442442
}
443-
promise = thenValidateField(promise, className, key, expected);
443+
promise = thenValidateField(promise, className, key, expected, freeze);
444444
}
445445
return promise;
446446
};

functions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ function createResponseObject(resolve, reject) {
4242
error: function(error) {
4343
reject(new Parse.Error(Parse.Error.SCRIPT_FAILED, error));
4444
}
45-
}
45+
};
4646
}
4747

48-
router.route('POST', '/functions/:functionName', handleCloudFunction);
48+
router.route('POST', '/functions/:functionName+', handleCloudFunction);
4949

5050

5151
module.exports = router;

0 commit comments

Comments
 (0)