29 $jsonStream = $request->
getBody();
30 $status = FormatJson::parse(
"$jsonStream", FormatJson::FORCE_ASSOC );
32 if ( !$status->isOK() ) {
34 new MessageValue(
'rest-json-body-parse-error', [
"$status" ] ),
39 $data = $status->value;
41 if ( !is_array( $data ) ) {
45 foreach ( $this->bodyParamSettings as $name => $settings ) {
46 if ( !empty( $settings[ParamValidator::PARAM_REQUIRED] ) && !isset( $data[$name] ) ) {
48 new MessageValue(
'rest-missing-body-field', [ $name ] ), 400
52 if ( !isset( $data[$name] ) ) {
53 $data[$name] = $settings[ParamValidator::PARAM_DEFAULT] ??
null;