@@ -2252,8 +2252,20 @@ protected function swagger($settings) {
22522252 while ($ row = $ this ->db ->fetchRow ($ result )) {
22532253 if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = $ row [1 ];
22542254 $ table_fields [$ table ['name ' ]][$ row [0 ]]->required = strtolower ($ row [2 ])=='no ' && $ row [1 ]===null ;
2255- $ table_fields [$ table ['name ' ]][$ row [0 ]]->format = $ row [3 ];
2255+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->{ ' x-dbtype ' } = $ row [3 ];
22562256 $ table_fields [$ table ['name ' ]][$ row [0 ]]->maxLength = $ row [4 ];
2257+ if ($ this ->db ->isNumericType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2258+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'number ' ;
2259+ } else {
2260+ if ($ this ->db ->isBinaryType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2261+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'byte ' ;
2262+ } else if ($ this ->db ->isGeometryType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2263+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'wkt ' ;
2264+ } else if ($ this ->db ->isJsonType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2265+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'json ' ;
2266+ }
2267+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'string ' ;
2268+ }
22572269 }
22582270
22592271 foreach (array ('root_actions ' ,'id_actions ' ) as $ path ) {
@@ -2377,8 +2389,11 @@ protected function swagger($settings) {
23772389 foreach (array_keys ($ action ['fields ' ]) as $ k =>$ field ) {
23782390 if ($ k >0 ) echo ', ' ;
23792391 echo '" ' .$ field .'": { ' ;
2380- echo '"type": "string" ' ;
2381- echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2392+ echo '"type": ' .json_encode ($ action ['fields ' ][$ field ]->type );
2393+ if (isset ($ action ['fields ' ][$ field ]->format )) {
2394+ echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2395+ }
2396+ echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
23822397 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
23832398 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
23842399 }
@@ -2415,8 +2430,11 @@ protected function swagger($settings) {
24152430 foreach (array_keys ($ action ['fields ' ]) as $ k =>$ field ) {
24162431 if ($ k >0 ) echo ', ' ;
24172432 echo '" ' .$ field .'": { ' ;
2418- echo '"type": "string" ' ;
2419- echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2433+ echo '"type": ' .json_encode ($ action ['fields ' ][$ field ]->type );
2434+ if (isset ($ action ['fields ' ][$ field ]->format )) {
2435+ echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2436+ }
2437+ echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
24202438 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
24212439 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
24222440 }
@@ -2479,8 +2497,11 @@ protected function swagger($settings) {
24792497 foreach (array_keys ($ action ['fields ' ]) as $ k =>$ field ) {
24802498 if ($ k >0 ) echo ', ' ;
24812499 echo '" ' .$ field .'": { ' ;
2482- echo '"type": "string" ' ;
2483- echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2500+ echo '"type": ' .json_encode ($ action ['fields ' ][$ field ]->type );
2501+ if (isset ($ action ['fields ' ][$ field ]->format )) {
2502+ echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2503+ }
2504+ echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
24842505 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
24852506 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
24862507 }
@@ -2514,8 +2535,11 @@ protected function swagger($settings) {
25142535 foreach (array_keys ($ action ['fields ' ]) as $ k =>$ field ) {
25152536 if ($ k >0 ) echo ', ' ;
25162537 echo '" ' .$ field .'": { ' ;
2517- echo '"type": "string" ' ;
2518- echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2538+ echo '"type": ' .json_encode ($ action ['fields ' ][$ field ]->type );
2539+ if (isset ($ action ['fields ' ][$ field ]->format )) {
2540+ echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
2541+ }
2542+ echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
25192543 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
25202544 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
25212545 }
0 commit comments