request method
Validates the request body of operationId; an operation without a JSON body accepts
only an empty one.
Implementation
List<ContractViolation> request(String operationId, Object? body) {
final schema = operation(operationId).requestSchema;
if (schema == null) {
return body == null
? const []
: const [ContractViolation('', 'invalid', 'no body expected')];
}
if (body == null) {
return const [ContractViolation('', 'required', 'a JSON body')];
}
return validate(body, schema);
}