--- a/getAgency.php +++ b/getAgency.php @@ -47,10 +47,19 @@ } function addDefaultFields($row) { - $defaultFields = Array("name","orgType","parentOrg"); + global $schemas; + $defaultFields = array_keys($schemas['agency']['properties']); foreach ($defaultFields as $defaultField) { - if (!isset($row[$defaultField])) + if (!isset($row[$defaultField])) { + if ($schemas['agency']['properties'][$defaultField]['type'] == "string") { + $row[$defaultField] = ""; + } + if ($schemas['agency']['properties'][$defaultField]['type'] == "array") { + + $row[$defaultField] = Array(""); + } + } } return $row; }