Skip to content

Commit e216334

Browse files
committed
feat(sharetypes): rearrange namespaces so they can overlap
1 parent 658bc81 commit e216334

25 files changed

+558
-368
lines changed

samples/client/benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int main(int argc, char** argv)
9393

9494
try
9595
{
96-
using namespace client::query::Query;
96+
using namespace benchmark::client::query::Query;
9797

9898
auto query = GetRequestObject();
9999
const auto& name = GetOperationName();

samples/client/benchmark/BenchmarkClient.cpp

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717
using namespace std::literals;
1818

19-
namespace graphql::client {
19+
namespace graphql {
2020
namespace benchmark {
21+
namespace client {
2122

2223
const std::string& GetRequestText() noexcept
2324
{
@@ -59,14 +60,16 @@ const peg::ast& GetRequestObject() noexcept
5960
return s_request;
6061
}
6162

63+
} // namespace client
6264
} // namespace benchmark
65+
namespace client {
6366

6467
using namespace benchmark;
6568

6669
template <>
67-
query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo Response<query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(response::Value&& response)
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)
6871
{
69-
query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
72+
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo result;
7073

7174
if (response.type() == response::Type::Map)
7275
{
@@ -86,9 +89,9 @@ query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo Re
8689
}
8790

8891
template <>
89-
query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment Response<query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse(response::Value&& response)
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)
9093
{
91-
query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
94+
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment result;
9295

9396
if (response.type() == response::Type::Map)
9497
{
@@ -123,9 +126,9 @@ query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdg
123126
}
124127

125128
template <>
126-
query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge Response<query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse(response::Value&& response)
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)
127130
{
128-
query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
131+
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge result;
129132

130133
if (response.type() == response::Type::Map)
131134
{
@@ -135,7 +138,7 @@ query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdg
135138
{
136139
if (member.first == R"js(node)js"sv)
137140
{
138-
result.node = ModifiedResponse<query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move(member.second));
141+
result.node = ModifiedResponse<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge::node_Appointment>::parse<TypeModifier::Nullable>(std::move(member.second));
139142
continue;
140143
}
141144
}
@@ -145,9 +148,9 @@ query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdg
145148
}
146149

147150
template <>
148-
query::Query::Response::appointments_AppointmentConnection Response<query::Query::Response::appointments_AppointmentConnection>::parse(response::Value&& response)
151+
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection Response<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection>::parse(response::Value&& response)
149152
{
150-
query::Query::Response::appointments_AppointmentConnection result;
153+
graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection result;
151154

152155
if (response.type() == response::Type::Map)
153156
{
@@ -157,12 +160,12 @@ query::Query::Response::appointments_AppointmentConnection Response<query::Query
157160
{
158161
if (member.first == R"js(pageInfo)js"sv)
159162
{
160-
result.pageInfo = ModifiedResponse<query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(std::move(member.second));
163+
result.pageInfo = ModifiedResponse<graphql::benchmark::client::query::Query::Response::appointments_AppointmentConnection::pageInfo_PageInfo>::parse(std::move(member.second));
161164
continue;
162165
}
163166
if (member.first == R"js(edges)js"sv)
164167
{
165-
result.edges = ModifiedResponse<query::Query::Response::appointments_AppointmentConnection::edges_AppointmentEdge>::parse<TypeModifier::Nullable, TypeModifier::List, TypeModifier::Nullable>(std::move(member.second));
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));
166169
continue;
167170
}
168171
}
@@ -171,7 +174,9 @@ query::Query::Response::appointments_AppointmentConnection Response<query::Query
171174
return result;
172175
}
173176

174-
namespace query::Query {
177+
} // namespace client
178+
179+
namespace benchmark::client::query::Query {
175180

176181
const std::string& GetOperationName() noexcept
177182
{
@@ -182,6 +187,8 @@ const std::string& GetOperationName() noexcept
182187

183188
Response parseResponse(response::Value&& response)
184189
{
190+
using namespace graphql::client;
191+
185192
Response result;
186193

187194
if (response.type() == response::Type::Map)
@@ -203,12 +210,12 @@ Response parseResponse(response::Value&& response)
203210

204211
[[nodiscard("unnecessary call")]] const std::string& Traits::GetRequestText() noexcept
205212
{
206-
return benchmark::GetRequestText();
213+
return client::GetRequestText();
207214
}
208215

209216
[[nodiscard("unnecessary call")]] const peg::ast& Traits::GetRequestObject() noexcept
210217
{
211-
return benchmark::GetRequestObject();
218+
return client::GetRequestObject();
212219
}
213220

214221
[[nodiscard("unnecessary call")]] const std::string& Traits::GetOperationName() noexcept
@@ -221,5 +228,5 @@ Response parseResponse(response::Value&& response)
221228
return Query::parseResponse(std::move(response));
222229
}
223230

224-
} // namespace query::Query
225-
} // namespace graphql::client
231+
} // namespace benchmark::client::query::Query
232+
} // namespace graphql

samples/client/benchmark/BenchmarkClient.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
2323
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");
2424

25-
namespace graphql::client {
25+
namespace graphql::benchmark {
2626

27-
/// <summary>
28-
/// Operation: query (unnamed)
29-
/// </summary>
30-
/// <code class="language-graphql">
27+
/// # Operation: query (unnamed)
28+
/// ```graphql
3129
/// # Copyright (c) Microsoft Corporation. All rights reserved.
3230
/// # Licensed under the MIT License.
3331
///
@@ -46,21 +44,19 @@ namespace graphql::client {
4644
/// }
4745
/// }
4846
/// }
49-
/// </code>
50-
namespace benchmark {
47+
/// ```
48+
namespace client {
5149

5250
// Return the original text of the request document.
5351
[[nodiscard("unnecessary call")]] const std::string& GetRequestText() noexcept;
5452

5553
// Return a pre-parsed, pre-validated request object.
5654
[[nodiscard("unnecessary call")]] const peg::ast& GetRequestObject() noexcept;
5755

58-
} // namespace benchmark
59-
6056
namespace query::Query {
6157

62-
using benchmark::GetRequestText;
63-
using benchmark::GetRequestObject;
58+
using graphql::benchmark::client::GetRequestText;
59+
using graphql::benchmark::client::GetRequestObject;
6460

6561
// Return the name of this operation in the shared request document.
6662
[[nodiscard("unnecessary call")]] const std::string& GetOperationName() noexcept;
@@ -108,6 +104,7 @@ struct Traits
108104
};
109105

110106
} // namespace query::Query
111-
} // namespace graphql::client
107+
} // namespace client
108+
} // namespace graphql::benchmark
112109

113110
#endif // BENCHMARKCLIENT_H

samples/client/benchmark/BenchmarkClient.ixx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ module;
99

1010
export module GraphQL.Benchmark.BenchmarkClient;
1111

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

14-
namespace benchmark {
14+
namespace client {
1515

16-
using benchmark::GetRequestText;
17-
using benchmark::GetRequestObject;
18-
19-
} // namespace benchmark
16+
using client::GetRequestText;
17+
using client::GetRequestObject;
2018

2119
namespace query::Query {
2220

23-
using benchmark::GetRequestText;
24-
using benchmark::GetRequestObject;
21+
using graphql::benchmark::client::GetRequestText;
22+
using graphql::benchmark::client::GetRequestObject;
2523
using Query::GetOperationName;
2624

2725
using Query::Response;
@@ -31,4 +29,5 @@ using Query::Traits;
3129

3230
} // namespace query::Query
3331

34-
} // namespace graphql::client
32+
} // namespace client
33+
} // namespace graphql::benchmark

0 commit comments

Comments
 (0)