Skip to content

Commit eefc1d4

Browse files
Fix boolean type generation (#25)
* dont clean the database type if it is tinyint(1) and should be a boolean instead * readability
1 parent 9bc148b commit eefc1d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Definitions/DefinitionGenerator.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,11 @@ private function cleanDatabaseType(string $dbType)
292292
* @return array array of with 'type' and 'format' as keys
293293
*/
294294
private function convertDBTypeToSwaggerType(string $dbType): array
295-
{
296-
// We use preg_replace to remove parenthesis, eg: "int(20)" become just "int"
297-
$lowerType = $this->cleanDatabaseType($dbType);
295+
{
296+
$lowerType = $dbType == 'tinyint(1)'
297+
? 'boolean' // tinyint(1) is a boolean
298+
: $this->cleanDatabaseType($dbType); // We use preg_replace to remove parenthesis, eg: "int(20)" become just "int"
299+
298300
switch ($lowerType) {
299301
case 'bigserial':
300302
case 'bigint':

0 commit comments

Comments
 (0)