Skip to content

feat: enhance type conversion fallback in validators - #323

Closed
almas-x wants to merge 1 commit into
gookit:masterfrom
almas-x:master
Closed

almas-x wants to merge 1 commit into
gookit:masterfrom
almas-x:master

Conversation

@almas-x

@almas-x almas-x commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

When JSON request bodies are decoded into map[string]interface{} numeric fields become float64. The enum/in validation only handled string, int and uint types, causing valid JSON numbers to fail validation unless callers explicitly converted them with Filters. This change keeps the existing convToBasicType attempt and, if that fails, falls back to converting the value to a string and re-using the same enum matching logic. It's a small, backward-compatible fix that lets in: rules work with numbers coming from JSON without requiring extra Filters.

This update addresses goravel/goravel#816

@almas-x almas-x closed this by deleting the head repository May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant