Enable API related tests for Postgres (#2970)

This commit is contained in:
Kulshekhar Kabra
2016-10-31 21:41:21 +05:30
committed by Florent Vilmart
parent edf6ab6875
commit 78646a3e91
2 changed files with 17 additions and 1 deletions

View File

@@ -136,6 +136,20 @@ const handleDotFields = (object) => {
return object;
}
const validateKeys = (object) => {
if (typeof object == 'object') {
for (const key in object) {
if (typeof object[key] == 'object') {
validateKeys(object[key]);
}
if(key.includes('$') || key.includes('.')){
throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters");
}
}
}
}
// Returns the list of join tables on a schema
const joinTablesForSchema = (schema) => {
let list = [];
@@ -649,6 +663,8 @@ export class PostgresStorageAdapter {
object = handleDotFields(object);
validateKeys(object);
Object.keys(object).forEach(fieldName => {
var authDataMatch = fieldName.match(/^_auth_data_([a-zA-Z0-9_]+)$/);
if (authDataMatch) {