From b324eb417fe62c72d3bfadcb2fc2327364c91886 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Tue, 14 Dec 2021 23:01:01 -0800 Subject: [PATCH 1/3] Output include statements for unions even if no interfaces --- src/SchemaGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SchemaGenerator.cpp b/src/SchemaGenerator.cpp index 492a736c..580fe487 100644 --- a/src/SchemaGenerator.cpp +++ b/src/SchemaGenerator.cpp @@ -2874,7 +2874,7 @@ using namespace std::literals; if (!_loader.isIntrospection()) { - if (!objectType.interfaces.empty()) + if (!objectType.interfaces.empty() || !objectType.unions.empty()) { NamespaceScope implementsNamespace { headerFile, R"cpp(implements)cpp" }; From 29eeba41a7825e1caaba59dd19519c0c603b5073 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Tue, 14 Dec 2021 23:17:57 -0800 Subject: [PATCH 2/3] Install Introspection.h under graphqlservice/internal/ --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7e594f3e..abd456f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -452,6 +452,7 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Awaitable.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Base64.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Grammar.h + ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Introspection.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/Schema.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/SortedMap.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/graphqlservice/internal/SyntaxTree.h From 7952633a48511d079942a33c6bbe7d50777731d0 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Tue, 14 Dec 2021 23:49:43 -0800 Subject: [PATCH 3/3] Use a static_assert for the None modifier in ModifiedArgument too --- include/graphqlservice/GraphQLService.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/graphqlservice/GraphQLService.h b/include/graphqlservice/GraphQLService.h index ebd026a1..4c020298 100644 --- a/include/graphqlservice/GraphQLService.h +++ b/include/graphqlservice/GraphQLService.h @@ -663,9 +663,11 @@ struct ModifiedArgument // Peel off the none modifier. If it's included, it should always be last in the list. template - static typename std::enable_if_t - require(std::string_view name, const response::Value& arguments) + static typename std::enable_if_t require( + std::string_view name, const response::Value& arguments) { + static_assert(sizeof...(Other) == 0, "None modifier should always be last"); + // Just call through to the non-template method without the modifiers. return require(name, arguments); }