@@ -939,7 +939,7 @@ public function __construct() {
939939 k1."table" = ? AND
940940 k2."table" IN ? ' ,
941941 'reflect_columns ' => 'SELECT
942- "name", "dflt_value", case when "notnull"==1 then \'NO \' else \'YES \' end as "nullable", "type", 2147483647
942+ "name", "dflt_value", case when "notnull"==1 then \'no \' else \'yes \' end as "nullable", "type", 2147483647
943943 FROM
944944 "sys/columns"
945945 WHERE
@@ -2262,15 +2262,19 @@ protected function swagger($settings) {
22622262 }
22632263 $ result = $ this ->db ->query ($ this ->db ->getSql ('reflect_columns ' ),array ($ table_list [0 ],$ database ));
22642264 while ($ row = $ this ->db ->fetchRow ($ result )) {
2265- if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = $ row [1 ];
22662265 $ table_fields [$ table ['name ' ]][$ row [0 ]]->required = strtolower ($ row [2 ])=='no ' && $ row [1 ]===null ;
2266+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->{'x-nullable ' } = strtolower ($ row [2 ])=='yes ' ;
22672267 $ table_fields [$ table ['name ' ]][$ row [0 ]]->{'x-dbtype ' } = $ row [3 ];
22682268 $ table_fields [$ table ['name ' ]][$ row [0 ]]->maxLength = $ row [4 ];
22692269 if ($ this ->db ->isNumericType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
2270- $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'number ' ;
22712270 if (strpos (strtolower ($ table_fields [$ table ['name ' ]][$ row [0 ]]->{'x-dbtype ' }),'int ' )!==false ) {
22722271 $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'integer ' ;
2272+ if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = (int )$ row [1 ];
2273+ } else {
2274+ $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'number ' ;
2275+ if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = (float )$ row [1 ];
22732276 }
2277+
22742278 } else {
22752279 if ($ this ->db ->isBinaryType ($ table_fields [$ table ['name ' ]][$ row [0 ]])) {
22762280 $ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'byte ' ;
@@ -2280,6 +2284,7 @@ protected function swagger($settings) {
22802284 $ table_fields [$ table ['name ' ]][$ row [0 ]]->format = 'json ' ;
22812285 }
22822286 $ table_fields [$ table ['name ' ]][$ row [0 ]]->type = 'string ' ;
2287+ if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = $ row [1 ];
22832288 }
22842289 }
22852290
@@ -2409,10 +2414,10 @@ protected function swagger($settings) {
24092414 echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
24102415 }
24112416 echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2417+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
24122418 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
24132419 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
24142420 }
2415- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
24162421 if (isset ($ action ['fields ' ][$ field ]->default )) {
24172422 echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
24182423 }
@@ -2450,10 +2455,10 @@ protected function swagger($settings) {
24502455 echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
24512456 }
24522457 echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2458+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
24532459 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
24542460 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
24552461 }
2456- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
24572462 if (isset ($ action ['fields ' ][$ field ]->default )) {
24582463 echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
24592464 }
@@ -2517,10 +2522,10 @@ protected function swagger($settings) {
25172522 echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
25182523 }
25192524 echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2525+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
25202526 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
25212527 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
25222528 }
2523- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
25242529 if (isset ($ action ['fields ' ][$ field ]->default )) {
25252530 echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
25262531 }
@@ -2555,10 +2560,10 @@ protected function swagger($settings) {
25552560 echo ',"format": ' .json_encode ($ action ['fields ' ][$ field ]->format );
25562561 }
25572562 echo ',"x-dbtype": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-dbtype ' });
2563+ echo ',"x-nullable": ' .json_encode ($ action ['fields ' ][$ field ]->{'x-nullable ' });
25582564 if (isset ($ action ['fields ' ][$ field ]->maxLength )) {
25592565 echo ',"maxLength": ' .json_encode ($ action ['fields ' ][$ field ]->maxLength );
25602566 }
2561- echo ',"required": ' .json_encode ($ action ['fields ' ][$ field ]->required );
25622567 if (isset ($ action ['fields ' ][$ field ]->default )) {
25632568 echo ',"default": ' .json_encode ($ action ['fields ' ][$ field ]->default );
25642569 }
0 commit comments