| 45 | }; |
| 46 | |
| 47 | Json applyOperation(Json const& base, Json const& op, Maybe<Json> const&) { |
| 48 | try { |
| 49 | auto operation = op.getString("op"); |
| 50 | return JsonPatching::functionMap.get(operation)(base, op); |
| 51 | } catch (JsonException const& e) { |
| 52 | throw JsonPatchException(strf("Could not apply operation to base. {}", e.what()), false); |
| 53 | } catch (MapException const&) { |
| 54 | throw JsonPatchException(strf("Invalid operation: {}", op.getString("op")), false); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | Json applyTestOperation(Json const& base, Json const& op) { |
| 59 | String path = op.getString("path"); |