// Route: GET/POST /governance/diff (breaking change detection) #include "support/Assert.hpp" using namespace molo::example::test; using molo::example::fw::Method; int main() { Fixture f; check(f.client->get("/governance/diff").status == 200, "form"); auto bad = f.client->post("/governance/diff", "before=GET+%2Fa", "application/x-www-form-urlencoded"); check(bad.status == 422 && contains(bad.body, "field-error"), "after required"); std::string before = "GET /items required=id\nDELETE /items required=id\n"; std::string after = "GET /items required=id,page\nPOST /items required=name\n"; auto r = f.client->request(Method::Post, "/governance/diff", "before=" + before + "&after=" + after, {{"Accept", "application/json"}}); check(r.status == 200 && contains(r.body, "\"breaking\":2"), "two breaking changes"); check(contains(r.body, "operation removed") && contains(r.body, "new required parameter page"), "details"); check(contains(r.body, "operation added"), "compatible addition"); auto same = f.client->request(Method::Post, "/governance/diff", "before=GET /a&after=GET /a", {{"Accept", "application/json"}}); check(contains(same.body, "\"breaking\":0"), "side effect: identical specs clean"); return finish("governance/diff"); }