Skip to content

Commit 903852d

Browse files
authored
improve validation rules detection (#658)
* fix: improve validation for schema' * fix: improve validation rules detection * Fix styling * fix: wip --------- Co-authored-by: binaryk <[email protected]>
1 parent 23d21d7 commit 903852d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Fields/Field.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,6 @@ protected function guessTypeFromValidationRules(): ?string
842842
return 'boolean';
843843
}
844844

845-
if ($this->hasAnyRule($ruleStrings, ['integer', 'int', 'numeric', 'min:', 'max:', 'between:'])) {
846-
return 'number';
847-
}
848-
849845
if ($this->hasAnyRule($ruleStrings, ['email', 'url', 'ip', 'uuid', 'string', 'regex', 'in', 'array'])) {
850846
return 'string';
851847
}
@@ -858,6 +854,10 @@ protected function guessTypeFromValidationRules(): ?string
858854
return 'string'; // Files are typically handled as strings (paths/URLs)
859855
}
860856

857+
if ($this->hasAnyRule($ruleStrings, ['integer', 'int', 'numeric', 'between:'])) {
858+
return 'number';
859+
}
860+
861861
return null;
862862
}
863863

0 commit comments

Comments
 (0)