Skip to content

Commit ec2a29d

Browse files
committed
fix(modules): wrap JSONResponse and TodayMock
1 parent 81bf6bc commit ec2a29d

19 files changed

+735
-503
lines changed

cmake/Version.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111

1212
namespace graphql::internal {
1313

14+
inline namespace version {
15+
1416
constexpr std::string_view FullVersion { "@PROJECT_VERSION@" };
1517

1618
constexpr std::size_t MajorVersion = @PROJECT_VERSION_MAJOR@;
1719
constexpr std::size_t MinorVersion = @PROJECT_VERSION_MINOR@;
1820
constexpr std::size_t PatchVersion = @PROJECT_VERSION_PATCH@;
1921

22+
} // namespace version
23+
2024
} // namespace graphql::internal
2125

2226
#endif // GRAPHQLVERSION_H

include/graphqlservice/Client.ixx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ using client::parseServiceResponse;
1818
using client::TypeModifier;
1919
using client::Variable;
2020

21-
using client::ModifiedVariable;
22-
using client::IntVariable;
23-
using client::FloatVariable;
24-
using client::StringVariable;
25-
using client::BooleanVariable;
26-
using client::IdVariable;
27-
using client::ScalarVariable;
21+
using modified_variable::ModifiedVariable;
22+
using modified_variable::IntVariable;
23+
using modified_variable::FloatVariable;
24+
using modified_variable::StringVariable;
25+
using modified_variable::BooleanVariable;
26+
using modified_variable::IdVariable;
27+
using modified_variable::ScalarVariable;
2828

2929
using client::Response;
3030

31-
using client::ModifiedResponse;
32-
using client::IntResponse;
33-
using client::FloatResponse;
34-
using client::StringResponse;
35-
using client::BooleanResponse;
36-
using client::IdResponse;
37-
using client::ScalarResponse;
31+
using modified_response::ModifiedResponse;
32+
using modified_response::IntResponse;
33+
using modified_response::FloatResponse;
34+
using modified_response::StringResponse;
35+
using modified_response::BooleanResponse;
36+
using modified_response::IdResponse;
37+
using modified_response::ScalarResponse;
3838
// clang-format on
3939

4040
} // namespace graphql::client
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
module;
5+
6+
#include "JSONResponse.h"
7+
8+
export module GraphQL.JSONResponse;
9+
10+
export namespace graphql::response {
11+
12+
// clang-format off
13+
using response::toJSON;
14+
using response::parseJSON;
15+
// clang-format on
16+
17+
} // namespace graphql::response

include/graphqlservice/Service.ixx

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,16 @@ using service::unimplemented_method;
3333

3434
using service::RequestState;
3535

36-
namespace constants {
37-
38-
constexpr std::string_view strData = service::strData;
39-
constexpr std::string_view strErrors = service::strErrors;
40-
constexpr std::string_view strMessage = service::strMessage;
41-
constexpr std::string_view strLocations = service::strLocations;
42-
constexpr std::string_view strLine = service::strLine;
43-
constexpr std::string_view strColumn = service::strColumn;
44-
constexpr std::string_view strPath = service::strPath;
45-
constexpr std::string_view strQuery = service::strQuery;
46-
constexpr std::string_view strMutation = service::strMutation;
47-
constexpr std::string_view strSubscription = service::strSubscription;
48-
49-
} // namespace constants
50-
51-
using namespace constants;
36+
constexpr std::string_view strData = keywords::strData;
37+
constexpr std::string_view strErrors = keywords::strErrors;
38+
constexpr std::string_view strMessage = keywords::strMessage;
39+
constexpr std::string_view strLocations = keywords::strLocations;
40+
constexpr std::string_view strLine = keywords::strLine;
41+
constexpr std::string_view strColumn = keywords::strColumn;
42+
constexpr std::string_view strPath = keywords::strPath;
43+
constexpr std::string_view strQuery = keywords::strQuery;
44+
constexpr std::string_view strMutation = keywords::strMutation;
45+
constexpr std::string_view strSubscription = keywords::strSubscription;
5246

5347
using service::ResolverContext;
5448

@@ -78,26 +72,26 @@ using service::ResolverMap;
7872
using service::TypeModifier;
7973
using service::Argument;
8074

81-
using service::ModifiedArgument;
82-
using service::IntArgument;
83-
using service::FloatArgument;
84-
using service::StringArgument;
85-
using service::BooleanArgument;
86-
using service::IdArgument;
87-
using service::ScalarArgument;
75+
using modified_argument::ModifiedArgument;
76+
using modified_argument::IntArgument;
77+
using modified_argument::FloatArgument;
78+
using modified_argument::StringArgument;
79+
using modified_argument::BooleanArgument;
80+
using modified_argument::IdArgument;
81+
using modified_argument::ScalarArgument;
8882

8983
using service::TypeNames;
9084
using service::Object;
9185
using service::Result;
9286

93-
using service::ModifiedResult;
94-
using service::IntResult;
95-
using service::FloatResult;
96-
using service::StringResult;
97-
using service::BooleanResult;
98-
using service::IdResult;
99-
using service::ScalarResult;
100-
using service::ObjectResult;
87+
using modified_result::ModifiedResult;
88+
using modified_result::IntResult;
89+
using modified_result::FloatResult;
90+
using modified_result::StringResult;
91+
using modified_result::BooleanResult;
92+
using modified_result::IdResult;
93+
using modified_result::ScalarResult;
94+
using modified_result::ObjectResult;
10195

10296
using service::SubscriptionCallback;
10397
using service::SubscriptionKey;

include/graphqlservice/internal/Version.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111

1212
namespace graphql::internal {
1313

14+
inline namespace version {
15+
1416
constexpr std::string_view FullVersion { "4.5.8" };
1517

1618
constexpr std::size_t MajorVersion = 4;
1719
constexpr std::size_t MinorVersion = 5;
1820
constexpr std::size_t PatchVersion = 8;
1921

22+
} // namespace version
23+
2024
} // namespace graphql::internal
2125

2226
#endif // GRAPHQLVERSION_H

include/graphqlservice/internal/Version.ixx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ export module GraphQL.Internal.Version;
99

1010
export namespace graphql::internal {
1111

12-
namespace constants {
12+
// clang-format off
13+
constexpr std::string_view FullVersion = version::FullVersion;
1314

14-
constexpr std::string_view FullVersion = internal::FullVersion;
15-
16-
constexpr std::size_t MajorVersion = internal::MajorVersion;
17-
constexpr std::size_t MinorVersion = internal::MinorVersion;
18-
constexpr std::size_t PatchVersion = internal::PatchVersion;
19-
20-
} // namespace constants
21-
22-
using namespace constants;
15+
constexpr std::size_t MajorVersion = version::MajorVersion;
16+
constexpr std::size_t MinorVersion = version::MinorVersion;
17+
constexpr std::size_t PatchVersion = version::PatchVersion;
18+
// clang-format on
2319

2420
} // namespace graphql::internal

samples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ add_subdirectory(today)
99
add_subdirectory(validation)
1010

1111
if(GRAPHQL_BUILD_HTTP_SAMPLE)
12-
find_package(Boost QUIET)
12+
find_package(boost_beast CONFIG QUIET)
1313
if(Boost_FOUND)
1414
if(Boost_VERSION VERSION_GREATER_EQUAL "1.81.0")
1515
try_compile(TEST_RESULT

samples/client/benchmark.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,33 @@
1212
#include <string_view>
1313

1414
import GraphQL.Client;
15-
import GraphQL.Parse;
15+
import GraphQL.Response;
16+
import GraphQL.Service;
17+
18+
import GraphQL.Today.TodaySchema;
19+
20+
import GraphQL.Today.QueryObject;
21+
import GraphQL.Today.MutationObject;
22+
import GraphQL.Today.SubscriptionObject;
23+
24+
import GraphQL.Today.AppointmentEdgeObject;
25+
import GraphQL.Today.AppointmentObject;
26+
import GraphQL.Today.AppointmentConnectionObject;
27+
import GraphQL.Today.CompleteTaskPayloadObject;
28+
import GraphQL.Today.ExpensiveObject;
29+
import GraphQL.Today.FolderEdgeObject;
30+
import GraphQL.Today.FolderObject;
31+
import GraphQL.Today.FolderConnectionObject;
32+
import GraphQL.Today.NestedTypeObject;
33+
import GraphQL.Today.NodeObject;
34+
import GraphQL.Today.PageInfoObject;
35+
import GraphQL.Today.TaskConnectionObject;
36+
import GraphQL.Today.TaskEdgeObject;
37+
import GraphQL.Today.TaskObject;
38+
import GraphQL.Today.UnionTypeObject;
1639

1740
import GraphQL.Today.Mock;
41+
1842
import GraphQL.Benchmark.BenchmarkClient;
1943

2044
using namespace graphql;

samples/today/CMakeLists.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,26 @@ add_subdirectory(schema)
88
add_library(todaygraphql STATIC TodayMock.cpp)
99
target_compile_features(todaygraphql PUBLIC cxx_std_20)
1010
target_link_libraries(todaygraphql PUBLIC today_schema)
11-
target_sources(todaygraphql PUBLIC FILE_SET CXX_MODULES
12-
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
13-
FILES ${CMAKE_CURRENT_SOURCE_DIR}/TodayMock.ixx)
11+
target_sources(todaygraphql
12+
PUBLIC FILE_SET HEADERS
13+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
14+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/TodayMock.h
15+
PUBLIC FILE_SET CXX_MODULES
16+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
17+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/TodayMock.ixx)
1418

1519
# todaygraphql_nointrospection
1620
add_subdirectory(nointrospection)
1721
add_library(todaygraphql_nointrospection STATIC TodayMock.cpp)
1822
target_compile_features(todaygraphql_nointrospection PUBLIC cxx_std_20)
1923
target_link_libraries(todaygraphql_nointrospection PUBLIC today_nointrospection_schema)
20-
target_sources(todaygraphql_nointrospection PUBLIC FILE_SET CXX_MODULES
21-
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
22-
FILES ${CMAKE_CURRENT_SOURCE_DIR}/TodayMock.ixx)
24+
target_sources(todaygraphql_nointrospection
25+
PUBLIC FILE_SET HEADERS
26+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
27+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/TodayMock.h
28+
PUBLIC FILE_SET CXX_MODULES
29+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
30+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/TodayMock.ixx)
2331

2432
if(MSVC)
2533
# warning C4702: unreachable code

samples/today/TodayMock.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
module;
4+
#include "TodayMock.h"
5+
6+
#include "AppointmentConnectionObject.h"
7+
#include "CompleteTaskPayloadObject.h"
8+
#include "ExpensiveObject.h"
9+
#include "FolderConnectionObject.h"
10+
#include "NestedTypeObject.h"
11+
#include "TaskConnectionObject.h"
12+
#include "UnionTypeObject.h"
513

614
#include <algorithm>
715
#include <chrono>
8-
#include <coroutine>
9-
#include <future>
1016
#include <iostream>
1117
#include <mutex>
12-
#include <stack>
13-
#include <thread>
14-
15-
module GraphQL.Today.Mock;
1618

1719
namespace graphql::today {
1820

0 commit comments

Comments
 (0)