diff --git a/src/endpoints/endpoint_registry.cpp b/src/endpoints/endpoint_registry.cpp index 32f0da7e776d..b75a71200f8c 100644 --- a/src/endpoints/endpoint_registry.cpp +++ b/src/endpoints/endpoint_registry.cpp @@ -34,6 +34,12 @@ namespace ccf::endpoints ds::openapi::path(document, endpoint->full_uri_path), http_verb.value()); + // Add what appears a *mandatory* operationId, which is expected to be a unique string. + std::string p = std::regex_replace(endpoint->full_uri_path, std::regex("[/_]"), ""); + std::string s = llhttp_method_name(http_verb.value()); + ccf::nonstd::to_lower(s); + path_op["operationId"] = fmt::format("{}_{}", p, s); + // Path Operation must contain at least one response - if none has been // defined, assume this can return 200 if (ds::openapi::responses(path_op).empty())