function() { return [ 'id' => [ 'type' => Type::int(), 'description' => 'Id', ], 'status' => [ 'type' => Type::string(), 'description' => 'status', 'resolve' => function($root, $args) { return empty($root->errors) ? 'success' : 'error'; } ], 'errors' => [ 'type' => Type::listOf(Types::resultSaveError()), 'description' => 'ошибки', 'resolve' => function($root, $args) { $output = []; foreach ($root->errors as $key => $value) { $output[] = ['code' => $key, 'messages'=> $value]; } return $output; } ], ]; } ]; parent::__construct($config); } }