From 2eb532acad146287b7148b78c3fa072eb684131f Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Wed, 13 Nov 2024 10:32:33 +0000 Subject: [PATCH] Schema support for std::unordered_set (#6634) --- CHANGELOG.md | 1 + include/ccf/ds/json_schema.h | 8 ++++++-- include/ccf/ds/openapi.h | 4 +++- src/ds/test/openapi.cpp | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 525b507895bf..8dccafcebc37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Added a `ccf::any_cert_auth_policy` (C++), or `any_cert` (JS/TS), implementing TLS client certificate authentication, but without checking for the presence of the certificate in the governance user or member tables. This enables applications wanting to do so to perform user management in application space, using application tables (#6608). +- Added OpenAPI support for `std::unordered_set`. ## [6.0.0-dev5] diff --git a/include/ccf/ds/json_schema.h b/include/ccf/ds/json_schema.h index d8216726df90..6bda247a1529 100644 --- a/include/ccf/ds/json_schema.h +++ b/include/ccf/ds/json_schema.h @@ -9,6 +9,7 @@ #include #include #include +#include namespace ccf::ds { @@ -113,7 +114,9 @@ namespace ccf::ds return fmt::format("{}_array", schema_name()); } } - else if constexpr (ccf::nonstd::is_specialization::value) + else if constexpr ( + ccf::nonstd::is_specialization::value || + ccf::nonstd::is_specialization::value) { return fmt::format("{}_set", schema_name()); } @@ -204,7 +207,8 @@ namespace ccf::ds } else if constexpr ( ccf::nonstd::is_specialization::value || - ccf::nonstd::is_specialization::value) + ccf::nonstd::is_specialization::value || + ccf::nonstd::is_specialization::value) { if constexpr (std::is_same>::value) { diff --git a/include/ccf/ds/openapi.h b/include/ccf/ds/openapi.h index c53722fdbd92..a059799e1bff 100644 --- a/include/ccf/ds/openapi.h +++ b/include/ccf/ds/openapi.h @@ -12,6 +12,7 @@ #include #include #include +#include namespace ccf::ds { @@ -281,7 +282,8 @@ namespace ccf::ds } else if constexpr ( ccf::nonstd::is_specialization::value || - ccf::nonstd::is_specialization::value) + ccf::nonstd::is_specialization::value || + ccf::nonstd::is_specialization::value) { if constexpr (std::is_same>::value) { diff --git a/src/ds/test/openapi.cpp b/src/ds/test/openapi.cpp index b4559badbb9a..92e2713063ea 100644 --- a/src/ds/test/openapi.cpp +++ b/src/ds/test/openapi.cpp @@ -160,6 +160,8 @@ TEST_CASE("Complex custom types") doc, "/app/complex", HTTP_POST); openapi::add_response_schema>>( doc, "/app/complex", HTTP_POST, HTTP_STATUS_OK); + openapi::add_response_schema>( + doc, "/app/complex", HTTP_POST, HTTP_STATUS_OK); required_doc_elements(doc); }