@@ -22,16 +22,16 @@ class OpenApiRecordsBuilder
22
22
'integer ' => ['type ' => 'integer ' , 'format ' => 'int32 ' ],
23
23
'bigint ' => ['type ' => 'integer ' , 'format ' => 'int64 ' ],
24
24
'varchar ' => ['type ' => 'string ' ],
25
- 'clob ' => ['type ' => 'string ' ],
25
+ 'clob ' => ['type ' => 'string ' , ' format ' => ' large-string ' ], //custom format
26
26
'varbinary ' => ['type ' => 'string ' , 'format ' => 'byte ' ],
27
- 'blob ' => ['type ' => 'string ' , 'format ' => 'byte ' ],
28
- 'decimal ' => ['type ' => 'string ' ],
27
+ 'blob ' => ['type ' => 'string ' , 'format ' => 'large- byte ' ], //custom format
28
+ 'decimal ' => ['type ' => 'string ' , ' format ' => ' decimal ' ], //custom format
29
29
'float ' => ['type ' => 'number ' , 'format ' => 'float ' ],
30
30
'double ' => ['type ' => 'number ' , 'format ' => 'double ' ],
31
31
'date ' => ['type ' => 'string ' , 'format ' => 'date ' ],
32
- 'time ' => ['type ' => 'string ' , 'format ' => 'date- time ' ],
32
+ 'time ' => ['type ' => 'string ' , 'format ' => 'time ' ], //custom format
33
33
'timestamp ' => ['type ' => 'string ' , 'format ' => 'date-time ' ],
34
- 'geometry ' => ['type ' => 'string ' ],
34
+ 'geometry ' => ['type ' => 'string ' , ' format ' => ' geometry ' ], //custom format
35
35
'boolean ' => ['type ' => 'boolean ' ],
36
36
];
37
37
@@ -203,8 +203,12 @@ private function setComponentSchema(string $tableName, array $references) /*: vo
203
203
}
204
204
$ column = $ table ->getColumn ($ columnName );
205
205
$ properties = $ this ->types [$ column ->getType ()];
206
+ $ properties ['maxLength ' ] = $ column ->hasLength () ? $ column ->getLength () : 0 ;
207
+ $ properties ['nullable ' ] = $ column ->getNullable ();
206
208
foreach ($ properties as $ key => $ value ) {
207
- $ this ->openapi ->set ("$ prefix|properties| $ columnName| $ key " , $ value );
209
+ if ($ value ) {
210
+ $ this ->openapi ->set ("$ prefix|properties| $ columnName| $ key " , $ value );
211
+ }
208
212
}
209
213
if ($ column ->getPk ()) {
210
214
$ this ->openapi ->set ("$ prefix|properties| $ columnName|x-primary-key " , true );
0 commit comments