validBody<T extends Validatable> method

Future<T> validBody<T extends Validatable>(
  1. T deserialize(
    1. Map<String, Object?> json
    )
)

The JSON object body, decoded and then checked against its constraints.

The one call a create endpoint needs: a body of the wrong shape and a body that breaks a @Validate both answer 422, and only the second names the fields.

Implementation

Future<T> validBody<T extends Validatable>(
  T Function(Map<String, Object?> json) deserialize,
) =>
    extractors.valid(extractors.body<T>(deserialize)).require(this);