Escape control-characters in generated swagger

When some table's description has `control-characters`, likes
`\t` `\n`,
swagger that generated by `/api.php` is a defective json
This commit is contained in:
q 2018-05-19 07:18:59 +08:00
commit 812f6ad591

View file

@ -2367,7 +2367,7 @@ class PHP_CRUD_API {
if ($i>0) echo ',';
echo '{';
echo '"name":"'.$table['name'].'",';
echo '"description":"'.$table['comments'].'"';
echo '"description":'.json_encode($table['comments']);
echo '}';
}
echo '],';