Skip to content

Commit

Permalink
https://spec.openapis.org/oas/latest.html suggests that "operationId"…
Browse files Browse the repository at this point in the history
… (or "operationref") is mandatory.

Signed-off-by: Markus Alexander Kuppe <[email protected]>
  • Loading branch information
lemmy committed Jul 3, 2024
1 parent 967a83e commit 58f9fbb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/endpoints/endpoint_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 58f9fbb

Please sign in to comment.