Skip to content

Support validate tag as a fallback alias for checkers tag #208

Description

@cinar

Proposal

Many Go codebases already use struct tags named validate:"..." (the convention from go-playground/validator). Migrating such a codebase to Checker currently means rewriting every struct tag.

In checker.go, where the tag config is read:

config := field.Tag.Get(checkerTag) // checkerTag == "checkers"

add a fallback: if checkers is absent/empty on a field, fall back to reading the validate tag instead. This doesn't require Checker to understand validate's syntax — it's a one-line lookup fallback, not a compatibility shim for validator's tag semantics — but it substantially lowers the switching cost for teams already using the validate:"required,email"-style tag name with checker syntax they've written for Checker.

Document the fallback clearly in the README so it's not confused with actual go-playground/validator tag-syntax compatibility (it isn't that — only the tag name is a fallback, not the tag contents).

100% test coverage; CHANGELOG.md entry.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions