Skip to content

Commit 113c000

Browse files
authored
Merge pull request #192 from jr3cermak/master
Adding "x-dbtype" to show database field type
2 parents f09ef21 + 72e11f2 commit 113c000

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

api.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ public function __construct() {
9595
"INFORMATION_SCHEMA"."COLUMNS"
9696
WHERE
9797
"TABLE_SCHEMA" = ? AND
98-
"TABLE_NAME" = ?
99-
'
98+
"TABLE_NAME" = ?'
10099
);
101100
}
102101

@@ -2355,7 +2354,7 @@ protected function swagger($settings) {
23552354
echo '"'.$field.'": {';
23562355
echo '"type": "string"';
23572356
if (isset($action['fields'][$field]->type)) {
2358-
echo ',"db-type": '.json_encode($action['fields'][$field]->type);
2357+
echo ',"x-dbtype": '.json_encode($action['fields'][$field]->type);
23592358
}
23602359
if (isset($action['fields'][$field]->referenced)) {
23612360
echo ',"x-referenced": '.json_encode($action['fields'][$field]->referenced);
@@ -2387,6 +2386,9 @@ protected function swagger($settings) {
23872386
if ($k>0) echo ',';
23882387
echo '"'.$field.'": {';
23892388
echo '"type": "string"';
2389+
if (isset($action['fields'][$field]->type)) {
2390+
echo ',"x-dbtype": '.json_encode($action['fields'][$field]->type);
2391+
}
23902392
if (isset($action['fields'][$field]->referenced)) {
23912393
echo ',"x-referenced": '.json_encode($action['fields'][$field]->referenced);
23922394
}
@@ -2443,6 +2445,9 @@ protected function swagger($settings) {
24432445
if ($k>0) echo ',';
24442446
echo '"'.$field.'": {';
24452447
echo '"type": "string"';
2448+
if (isset($action['fields'][$field]->type)) {
2449+
echo ',"x-dbtype": '.json_encode($action['fields'][$field]->type);
2450+
}
24462451
if (isset($action['fields'][$field]->referenced)) {
24472452
echo ',"x-referenced": '.json_encode($action['fields'][$field]->referenced);
24482453
}
@@ -2470,6 +2475,9 @@ protected function swagger($settings) {
24702475
if ($k>0) echo ',';
24712476
echo '"'.$field.'": {';
24722477
echo '"type": "string"';
2478+
if (isset($action['fields'][$field]->type)) {
2479+
echo ',"x-dbtype": '.json_encode($action['fields'][$field]->type);
2480+
}
24732481
if (isset($action['fields'][$field]->referenced)) {
24742482
echo ',"x-referenced": '.json_encode($action['fields'][$field]->referenced);
24752483
}

0 commit comments

Comments
 (0)