Skip to content

Commit 1769f19

Browse files
committed
feat(sharetypes): enable shared types for client benchmark
1 parent 88ec463 commit 1769f19

File tree

8 files changed

+39
-37
lines changed

8 files changed

+39
-37
lines changed

samples/client/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ if(GRAPHQL_BUILD_MODULES)
1515
# client_benchmark
1616
add_executable(client_benchmark benchmark.cpp)
1717
target_link_libraries(client_benchmark PRIVATE
18-
todaygraphql
1918
benchmark_client)
2019

2120
if(WIN32 AND BUILD_SHARED_LIBS)

samples/client/benchmark.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ import GraphQL.Client;
1616
import GraphQL.Service;
1717

1818
import GraphQL.Today.Mock;
19-
20-
import GraphQL.Benchmark.BenchmarkClient;
19+
import GraphQL.Today.TodayClient;
2120

2221
using namespace graphql;
2322

@@ -93,7 +92,7 @@ int main(int argc, char** argv)
9392

9493
try
9594
{
96-
using namespace benchmark::client::query::Query;
95+
using namespace today::client::query::Query;
9796

9897
auto query = GetRequestObject();
9998
const auto& name = GetOperationName();

samples/client/benchmark/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ cmake_minimum_required(VERSION 3.28)
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)
88

99
if(GRAPHQL_UPDATE_SAMPLES AND GRAPHQL_BUILD_CLIENTGEN)
10-
update_graphql_client_files(benchmark ../../today/schema.today.graphql client.benchmark.today.graphql Benchmark benchmark)
10+
update_graphql_client_files(benchmark ../../today/schema.today.graphql client.benchmark.today.graphql Today today --shared-types)
1111
endif()
1212

1313
add_graphql_client_target(benchmark)
14+
target_link_libraries(benchmark_client PRIVATE todaygraphql)

samples/client/benchmark/BenchmarkClient.cpp renamed to samples/client/benchmark/TodayClient.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// WARNING! Do not edit this file manually, your changes will be overwritten.
55

6-
#include "BenchmarkClient.h"
6+
#include "TodayClient.h"
77

88
#include "graphqlservice/internal/SortedMap.h"
99

@@ -17,7 +17,7 @@
1717
using namespace std::literals;
1818

1919
namespace graphql {
20-
namespace benchmark {
20+
namespace today {
2121
namespace client {
2222

2323
const std::string& GetRequestText() noexcept
@@ -61,15 +61,15 @@ const peg::ast& GetRequestObject() noexcept
6161
}
6262

6363
} // namespace client
64-
} // namespace benchmark
64+
} // namespace today
6565
namespace client {
6666

67-
using namespace benchmark;
67+
using namespace today;
6868

6969
template <>
70-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo Response<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
70+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo Response<graphql::today::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
7171
{
72-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
72+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
7373

7474
if (response.type() == response::Type::Map)
7575
{
@@ -89,9 +89,9 @@ graphql::benchmark::client::query::Query::Response::appointments_AppointmentConn
8989
}
9090

9191
template <>
92-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment Response<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
92+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment Response<graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
9393
{
94-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
94+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
9595

9696
if (response.type() == response::Type::Map)
9797
{
@@ -126,9 +126,9 @@ graphql::benchmark::client::query::Query::Response::appointments_AppointmentConn
126126
}
127127

128128
template <>
129-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge Response<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
129+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge Response<graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
130130
{
131-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
131+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
132132

133133
if (response.type() == response::Type::Map)
134134
{
@@ -138,7 +138,7 @@ graphql::benchmark::client::query::Query::Response::appointments_AppointmentConn
138138
{
139139
if (member.first == R"js(node)js"sv)
140140
{
141-
result.node = ModifiedResponse<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move(member.second));
141+
result.node = ModifiedResponse<graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move(member.second));
142142
continue;
143143
}
144144
}
@@ -148,9 +148,9 @@ graphql::benchmark::client::query::Query::Response::appointments_AppointmentConn
148148
}
149149

150150
template <>
151-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection Response<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection>::parse(response::Value&& response)
151+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection Response<graphql::today::client::query::Query::Response::appointments_AppointmentConnection>::parse(response::Value&& response)
152152
{
153-
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection result;
153+
graphql::today::client::query::Query::Response::appointments_AppointmentConnection result;
154154

155155
if (response.type() == response::Type::Map)
156156
{
@@ -160,12 +160,12 @@ graphql::benchmark::client::query::Query::Response::appointments_AppointmentConn
160160
{
161161
if (member.first == R"js(pageInfo)js"sv)
162162
{
163-
result.pageInfo = ModifiedResponse<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(std::move(member.second));
163+
result.pageInfo = ModifiedResponse<graphql::today::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(std::move(member.second));
164164
continue;
165165
}
166166
if (member.first == R"js(edges)js"sv)
167167
{
168-
result.edges = ModifiedResponse<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move(member.second));
168+
result.edges = ModifiedResponse<graphql::today::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move(member.second));
169169
continue;
170170
}
171171
}
@@ -176,7 +176,7 @@ graphql::benchmark::client::query::Query::Response::appointments_AppointmentConn
176176

177177
} // namespace client
178178

179-
namespace benchmark::client::query::Query {
179+
namespace today::client::query::Query {
180180

181181
const std::string& GetOperationName() noexcept
182182
{
@@ -228,5 +228,5 @@ Response parseResponse(response::Value&& response)
228228
return Query::parseResponse(std::move(response));
229229
}
230230

231-
} // namespace benchmark::client::query::Query
231+
} // namespace today::client::query::Query
232232
} // namespace graphql

samples/client/benchmark/BenchmarkClient.h renamed to samples/client/benchmark/TodayClient.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55

66
#pragma once
77

8-
#ifndef BENCHMARKCLIENT_H
9-
#define BENCHMARKCLIENT_H
8+
#ifndef TODAYCLIENT_H
9+
#define TODAYCLIENT_H
1010

1111
#include "graphqlservice/GraphQLClient.h"
1212
#include "graphqlservice/GraphQLParse.h"
1313
#include "graphqlservice/GraphQLResponse.h"
1414

1515
#include "graphqlservice/internal/Version.h"
1616

17+
#include "TodaySchema.h"
18+
1719
#include <optional>
1820
#include <string>
1921
#include <vector>
@@ -22,7 +24,7 @@
2224
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
2325
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");
2426

25-
namespace graphql::benchmark {
27+
namespace graphql::today {
2628

2729
/// # Operation: query (unnamed)
2830
/// ```graphql
@@ -55,8 +57,8 @@ namespace client {
5557

5658
namespace query::Query {
5759

58-
using graphql::benchmark::client::GetRequestText;
59-
using graphql::benchmark::client::GetRequestObject;
60+
using graphql::today::client::GetRequestText;
61+
using graphql::today::client::GetRequestObject;
6062

6163
// Return the name of this operation in the shared request document.
6264
[[nodiscard("unnecessary call")]] const std::string& GetOperationName() noexcept;
@@ -105,6 +107,6 @@ struct Traits
105107

106108
} // namespace query::Query
107109
} // namespace client
108-
} // namespace graphql::benchmark
110+
} // namespace graphql::today
109111

110-
#endif // BENCHMARKCLIENT_H
112+
#endif // TODAYCLIENT_H

samples/client/benchmark/BenchmarkClient.ixx renamed to samples/client/benchmark/TodayClient.ixx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
module;
77

8-
#include "BenchmarkClient.h"
8+
#include "TodayClient.h"
99

10-
export module GraphQL.Benchmark.BenchmarkClient;
10+
export module GraphQL.Today.TodayClient;
1111

12-
export namespace graphql::benchmark {
12+
export namespace graphql::today {
1313

1414
namespace client {
1515

@@ -18,8 +18,8 @@ using client::GetRequestObject;
1818

1919
namespace query::Query {
2020

21-
using graphql::benchmark::client::GetRequestText;
22-
using graphql::benchmark::client::GetRequestObject;
21+
using graphql::today::client::GetRequestText;
22+
using graphql::today::client::GetRequestObject;
2323
using Query::GetOperationName;
2424

2525
using Query::Response;
@@ -30,4 +30,4 @@ using Query::Traits;
3030
} // namespace query::Query
3131

3232
} // namespace client
33-
} // namespace graphql::benchmark
33+
} // namespace graphql::today
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BenchmarkClient.cpp
1+
TodayClient.cpp

src/ClientGenerator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,8 @@ using namespace )cpp" << _schemaLoader.getSchemaNamespace()
11341134

11351135
sourceFile << R"cpp(template <>
11361136
response::Value Variable<)cpp"
1137-
<< cppType << R"cpp(>::serialize()cpp" << cppType << R"cpp(&& inputValue)
1137+
<< cppType << R"cpp(>::serialize()cpp" << cppType
1138+
<< R"cpp(&& inputValue)
11381139
{
11391140
response::Value result { response::Type::Map };
11401141

0 commit comments

Comments
 (0)