Skip to content

Aggregate input validation errors across parameters #11

@koriym

Description

@koriym

Problem

InputQuery currently stops at the first invalid input parameter. For example, if both $x and $y are invalid, resolving $x throws immediately and $y is never inspected.

API consumers often need a complete validation response so they can fix all submitted fields in one round trip.

Desired behavior

Collect independent user-input validation failures across #[Input] parameters and DTO constructor parameters, then throw one aggregate exception containing all violations.

Each violation should carry structured data such as:

  • parameter/path name, e.g. x, y, tagIds
  • expected shape/type
  • actual shape/type
  • human-readable message

Initial scope

Aggregate only input-shape failures that are safe to continue after:

  • missing required input
  • array parameter receiving a non-array value
  • #[Input(item: ...)] array receiving a non-array value
  • array item expected to be an object array but receiving scalar

Do not aggregate programming/configuration errors:

  • DI unbound dependencies
  • invalid attribute combinations
  • unknown classes
  • file upload attribute misuse

BEAR.Resource coordination

BEAR.Resource should be able to translate the aggregate input exception into a 400-class ParameterException response while preserving the per-field violation list for handlers/renderers.

Out of scope for first pass

  • JSON Schema error aggregation
  • scalar coercion policy changes
  • parsing strings like tagIds=1,2,3 into arrays

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions