Skip to content

Commit 40be702

Browse files
committed
Merge branch 'master' of github.com:mevdschee/php-crud-api
2 parents c060399 + e550cb8 commit 40be702

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

api.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public function isGeometryType($field) {
471471
}
472472

473473
public function isJsonType($field) {
474-
return $field->type == 'jsonb';
474+
return in_array($field->type,array('json','jsonb'));
475475
}
476476

477477
public function getDefaultCharset() {
@@ -1059,11 +1059,11 @@ public function isBinaryType($field) {
10591059
}
10601060

10611061
public function isGeometryType($field) {
1062-
return in_array($field->type,array('geometry'));;
1062+
return in_array($field->type,array('geometry'));
10631063
}
10641064

10651065
public function isJsonType($field) {
1066-
return in_array($field->type,array('json','jsonb'));;
1066+
return in_array($field->type,array('json','jsonb'));
10671067
}
10681068

10691069
public function getDefaultCharset() {
@@ -2249,7 +2249,6 @@ protected function swagger($settings) {
22492249
$table_fields[$table['name']][$row[0]]->required = strtolower($row[2])=='no' && $row[1]===null;
22502250
$table_fields[$table['name']][$row[0]]->{'x-nullable'} = strtolower($row[2])=='yes';
22512251
$table_fields[$table['name']][$row[0]]->{'x-dbtype'} = $row[3];
2252-
$table_fields[$table['name']][$row[0]]->maxLength = $row[4];
22532252
if ($this->db->isNumericType($table_fields[$table['name']][$row[0]])) {
22542253
if (strpos(strtolower($table_fields[$table['name']][$row[0]]->{'x-dbtype'}),'int')!==false) {
22552254
$table_fields[$table['name']][$row[0]]->type = 'integer';
@@ -2258,7 +2257,6 @@ protected function swagger($settings) {
22582257
$table_fields[$table['name']][$row[0]]->type = 'number';
22592258
if ($row[1]!==null) $table_fields[$table['name']][$row[0]]->default = (float)$row[1];
22602259
}
2261-
22622260
} else {
22632261
if ($this->db->isBinaryType($table_fields[$table['name']][$row[0]])) {
22642262
$table_fields[$table['name']][$row[0]]->format = 'byte';
@@ -2269,6 +2267,7 @@ protected function swagger($settings) {
22692267
}
22702268
$table_fields[$table['name']][$row[0]]->type = 'string';
22712269
if ($row[1]!==null) $table_fields[$table['name']][$row[0]]->default = $row[1];
2270+
if ($row[4]!==null) $table_fields[$table['name']][$row[0]]->maxLength = (int)$row[4];
22722271
}
22732272
}
22742273

0 commit comments

Comments
 (0)