yiisoft / yiisoft/hydrator-validator

rename attribute Validate

Open
#30 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:under discussion
Dominant language
PHP
Stars
14
Forks
2
PR merge metrics
No merged PRs in 30d

Description

The issue is that when reading such a declaration, it’s not clear that the Validate attribute does not work with Compare, because it operates only on raw input data before those values are actually assigned to the class properties.

#[Body('email')] 
#[Trim] 
#[Validate(
    new Required(),
    new Email(),
)]

In this example, it’s not obvious from the Validate attribute itself that the validation is performed only on the raw data.

I suggest renaming the #[Validate] attribute to #[ValidateRaw].

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the #[Validate] attribute definition and every usage in the repository, then check how the example relates to raw-data validation. Done means the attribute is consistently renamed to #[ValidateRaw] without leaving misleading #[Validate] references.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend-api-design
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.