Skip to content

[Design] Validation rules interpretation #213

@xepozz

Description

@xepozz

Imagine that you have a model with some validation.

Model:

class CreateUserDto
{
  #[String]
  #[Length(max: 20)]
  private $name;

  #[String]
  #[Length(max: 20)]
  private $surname;
}

You wrote API and you wanted to try it.

Validation:

$dto = new CreateUserDto($payload)
$validator->validate($dto)

Payload:

{"name": "Dmitrii"}

You sent the payload and what would you want to get in response?

There are only two options:

  1. Validation passed.
  2. Validation failed.

If you want to explain your decision feel free to write comment.

You can vote by emoji:
👍 – validation passed.
👎 – validation failed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions