Skip to content

Commit 2f990d1

Browse files
committed
Follow "rule of 5" for schema input types
1 parent ed0a754 commit 2f990d1

File tree

9 files changed

+292
-67
lines changed

9 files changed

+292
-67
lines changed

samples/learn/schema/StarWarsSchema.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ learn::ReviewInput Argument<learn::ReviewInput>::convert(const response::Value&
9696

9797
namespace learn {
9898

99+
ReviewInput::ReviewInput() noexcept
100+
{
101+
}
102+
99103
ReviewInput::ReviewInput(
100104
int starsArg,
101105
std::optional<std::string> commentaryArg) noexcept
@@ -133,6 +137,10 @@ ReviewInput& ReviewInput::operator=(ReviewInput&& other) noexcept
133137
return *this;
134138
}
135139

140+
ReviewInput::~ReviewInput()
141+
{
142+
}
143+
136144
Operations::Operations(std::shared_ptr<object::Query> query, std::shared_ptr<object::Mutation> mutation)
137145
: service::Request({
138146
{ service::strQuery, query },

samples/learn/schema/StarWarsSchema.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ enum class [[nodiscard]] Episode
5353

5454
struct [[nodiscard]] ReviewInput
5555
{
56+
explicit ReviewInput() noexcept;
5657
explicit ReviewInput(
57-
int starsArg = int {},
58-
std::optional<std::string> commentaryArg = std::optional<std::string> {}) noexcept;
58+
int starsArg,
59+
std::optional<std::string> commentaryArg) noexcept;
5960
ReviewInput(const ReviewInput& other);
6061
ReviewInput(ReviewInput&& other) noexcept;
62+
~ReviewInput();
6163

6264
ReviewInput& operator=(const ReviewInput& other);
6365
ReviewInput& operator=(ReviewInput&& other) noexcept;

samples/today/nointrospection/TodaySchema.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ today::FirstNestedInput Argument<today::FirstNestedInput>::convert(const respons
227227

228228
namespace today {
229229

230+
CompleteTaskInput::CompleteTaskInput() noexcept
231+
{
232+
}
233+
230234
CompleteTaskInput::CompleteTaskInput(
231235
response::IdType idArg,
232236
std::optional<TaskState> testTaskStateArg,
@@ -274,6 +278,14 @@ CompleteTaskInput& CompleteTaskInput::operator=(CompleteTaskInput&& other) noexc
274278
return *this;
275279
}
276280

281+
CompleteTaskInput::~CompleteTaskInput()
282+
{
283+
}
284+
285+
ThirdNestedInput::ThirdNestedInput() noexcept
286+
{
287+
}
288+
277289
ThirdNestedInput::ThirdNestedInput(
278290
response::IdType idArg,
279291
std::unique_ptr<SecondNestedInput> secondArg) noexcept
@@ -311,6 +323,14 @@ ThirdNestedInput& ThirdNestedInput::operator=(ThirdNestedInput&& other) noexcept
311323
return *this;
312324
}
313325

326+
ThirdNestedInput::~ThirdNestedInput()
327+
{
328+
}
329+
330+
FourthNestedInput::FourthNestedInput() noexcept
331+
{
332+
}
333+
314334
FourthNestedInput::FourthNestedInput(
315335
response::IdType idArg) noexcept
316336
: id { std::move(idArg) }
@@ -343,6 +363,14 @@ FourthNestedInput& FourthNestedInput::operator=(FourthNestedInput&& other) noexc
343363
return *this;
344364
}
345365

366+
FourthNestedInput::~FourthNestedInput()
367+
{
368+
}
369+
370+
IncludeNullableSelfInput::IncludeNullableSelfInput() noexcept
371+
{
372+
}
373+
346374
IncludeNullableSelfInput::IncludeNullableSelfInput(
347375
std::unique_ptr<IncludeNullableSelfInput> selfArg) noexcept
348376
: self { std::move(selfArg) }
@@ -375,6 +403,14 @@ IncludeNullableSelfInput& IncludeNullableSelfInput::operator=(IncludeNullableSel
375403
return *this;
376404
}
377405

406+
IncludeNullableSelfInput::~IncludeNullableSelfInput()
407+
{
408+
}
409+
410+
IncludeNonNullableListSelfInput::IncludeNonNullableListSelfInput() noexcept
411+
{
412+
}
413+
378414
IncludeNonNullableListSelfInput::IncludeNonNullableListSelfInput(
379415
std::vector<IncludeNonNullableListSelfInput> selvesArg) noexcept
380416
: selves { std::move(selvesArg) }
@@ -407,6 +443,14 @@ IncludeNonNullableListSelfInput& IncludeNonNullableListSelfInput::operator=(Incl
407443
return *this;
408444
}
409445

446+
IncludeNonNullableListSelfInput::~IncludeNonNullableListSelfInput()
447+
{
448+
}
449+
450+
StringOperationFilterInput::StringOperationFilterInput() noexcept
451+
{
452+
}
453+
410454
StringOperationFilterInput::StringOperationFilterInput(
411455
std::optional<std::vector<StringOperationFilterInput>> and_Arg,
412456
std::optional<std::vector<StringOperationFilterInput>> or_Arg,
@@ -494,6 +538,14 @@ StringOperationFilterInput& StringOperationFilterInput::operator=(StringOperatio
494538
return *this;
495539
}
496540

541+
StringOperationFilterInput::~StringOperationFilterInput()
542+
{
543+
}
544+
545+
SecondNestedInput::SecondNestedInput() noexcept
546+
{
547+
}
548+
497549
SecondNestedInput::SecondNestedInput(
498550
response::IdType idArg,
499551
ThirdNestedInput thirdArg) noexcept
@@ -531,6 +583,14 @@ SecondNestedInput& SecondNestedInput::operator=(SecondNestedInput&& other) noexc
531583
return *this;
532584
}
533585

586+
SecondNestedInput::~SecondNestedInput()
587+
{
588+
}
589+
590+
ForwardDeclaredInput::ForwardDeclaredInput() noexcept
591+
{
592+
}
593+
534594
ForwardDeclaredInput::ForwardDeclaredInput(
535595
std::unique_ptr<IncludeNullableSelfInput> nullableSelfArg,
536596
IncludeNonNullableListSelfInput listSelvesArg) noexcept
@@ -568,6 +628,14 @@ ForwardDeclaredInput& ForwardDeclaredInput::operator=(ForwardDeclaredInput&& oth
568628
return *this;
569629
}
570630

631+
ForwardDeclaredInput::~ForwardDeclaredInput()
632+
{
633+
}
634+
635+
FirstNestedInput::FirstNestedInput() noexcept
636+
{
637+
}
638+
571639
FirstNestedInput::FirstNestedInput(
572640
response::IdType idArg,
573641
SecondNestedInput secondArg,
@@ -610,6 +678,10 @@ FirstNestedInput& FirstNestedInput::operator=(FirstNestedInput&& other) noexcept
610678
return *this;
611679
}
612680

681+
FirstNestedInput::~FirstNestedInput()
682+
{
683+
}
684+
613685
Operations::Operations(std::shared_ptr<object::Query> query, std::shared_ptr<object::Mutation> mutation, std::shared_ptr<object::Subscription> subscription)
614686
: service::Request({
615687
{ service::strQuery, query },

samples/today/nointrospection/TodaySchema.h

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ enum class [[nodiscard]] TaskState
5656

5757
struct [[nodiscard]] CompleteTaskInput
5858
{
59+
explicit CompleteTaskInput() noexcept;
5960
explicit CompleteTaskInput(
60-
response::IdType idArg = response::IdType {},
61-
std::optional<TaskState> testTaskStateArg = std::optional<TaskState> {},
62-
std::optional<bool> isCompleteArg = std::optional<bool> {},
63-
std::optional<std::string> clientMutationIdArg = std::optional<std::string> {}) noexcept;
61+
response::IdType idArg,
62+
std::optional<TaskState> testTaskStateArg,
63+
std::optional<bool> isCompleteArg,
64+
std::optional<std::string> clientMutationIdArg) noexcept;
6465
CompleteTaskInput(const CompleteTaskInput& other);
6566
CompleteTaskInput(CompleteTaskInput&& other) noexcept;
67+
~CompleteTaskInput();
6668

6769
CompleteTaskInput& operator=(const CompleteTaskInput& other);
6870
CompleteTaskInput& operator=(CompleteTaskInput&& other) noexcept;
@@ -77,11 +79,13 @@ struct SecondNestedInput;
7779

7880
struct [[nodiscard]] ThirdNestedInput
7981
{
82+
explicit ThirdNestedInput() noexcept;
8083
explicit ThirdNestedInput(
81-
response::IdType idArg = response::IdType {},
82-
std::unique_ptr<SecondNestedInput> secondArg = std::unique_ptr<SecondNestedInput> {}) noexcept;
84+
response::IdType idArg,
85+
std::unique_ptr<SecondNestedInput> secondArg) noexcept;
8386
ThirdNestedInput(const ThirdNestedInput& other);
8487
ThirdNestedInput(ThirdNestedInput&& other) noexcept;
88+
~ThirdNestedInput();
8589

8690
ThirdNestedInput& operator=(const ThirdNestedInput& other);
8791
ThirdNestedInput& operator=(ThirdNestedInput&& other) noexcept;
@@ -92,10 +96,12 @@ struct [[nodiscard]] ThirdNestedInput
9296

9397
struct [[nodiscard]] FourthNestedInput
9498
{
99+
explicit FourthNestedInput() noexcept;
95100
explicit FourthNestedInput(
96-
response::IdType idArg = response::IdType {}) noexcept;
101+
response::IdType idArg) noexcept;
97102
FourthNestedInput(const FourthNestedInput& other);
98103
FourthNestedInput(FourthNestedInput&& other) noexcept;
104+
~FourthNestedInput();
99105

100106
FourthNestedInput& operator=(const FourthNestedInput& other);
101107
FourthNestedInput& operator=(FourthNestedInput&& other) noexcept;
@@ -105,10 +111,12 @@ struct [[nodiscard]] FourthNestedInput
105111

106112
struct [[nodiscard]] IncludeNullableSelfInput
107113
{
114+
explicit IncludeNullableSelfInput() noexcept;
108115
explicit IncludeNullableSelfInput(
109-
std::unique_ptr<IncludeNullableSelfInput> selfArg = std::unique_ptr<IncludeNullableSelfInput> {}) noexcept;
116+
std::unique_ptr<IncludeNullableSelfInput> selfArg) noexcept;
110117
IncludeNullableSelfInput(const IncludeNullableSelfInput& other);
111118
IncludeNullableSelfInput(IncludeNullableSelfInput&& other) noexcept;
119+
~IncludeNullableSelfInput();
112120

113121
IncludeNullableSelfInput& operator=(const IncludeNullableSelfInput& other);
114122
IncludeNullableSelfInput& operator=(IncludeNullableSelfInput&& other) noexcept;
@@ -118,10 +126,12 @@ struct [[nodiscard]] IncludeNullableSelfInput
118126

119127
struct [[nodiscard]] IncludeNonNullableListSelfInput
120128
{
129+
explicit IncludeNonNullableListSelfInput() noexcept;
121130
explicit IncludeNonNullableListSelfInput(
122-
std::vector<IncludeNonNullableListSelfInput> selvesArg = std::vector<IncludeNonNullableListSelfInput> {}) noexcept;
131+
std::vector<IncludeNonNullableListSelfInput> selvesArg) noexcept;
123132
IncludeNonNullableListSelfInput(const IncludeNonNullableListSelfInput& other);
124133
IncludeNonNullableListSelfInput(IncludeNonNullableListSelfInput&& other) noexcept;
134+
~IncludeNonNullableListSelfInput();
125135

126136
IncludeNonNullableListSelfInput& operator=(const IncludeNonNullableListSelfInput& other);
127137
IncludeNonNullableListSelfInput& operator=(IncludeNonNullableListSelfInput&& other) noexcept;
@@ -131,21 +141,23 @@ struct [[nodiscard]] IncludeNonNullableListSelfInput
131141

132142
struct [[nodiscard]] StringOperationFilterInput
133143
{
144+
explicit StringOperationFilterInput() noexcept;
134145
explicit StringOperationFilterInput(
135-
std::optional<std::vector<StringOperationFilterInput>> and_Arg = std::optional<std::vector<StringOperationFilterInput>> {},
136-
std::optional<std::vector<StringOperationFilterInput>> or_Arg = std::optional<std::vector<StringOperationFilterInput>> {},
137-
std::optional<std::string> equalArg = std::optional<std::string> {},
138-
std::optional<std::string> notEqualArg = std::optional<std::string> {},
139-
std::optional<std::string> containsArg = std::optional<std::string> {},
140-
std::optional<std::string> notContainsArg = std::optional<std::string> {},
141-
std::optional<std::vector<std::string>> inArg = std::optional<std::vector<std::string>> {},
142-
std::optional<std::vector<std::string>> notInArg = std::optional<std::vector<std::string>> {},
143-
std::optional<std::string> startsWithArg = std::optional<std::string> {},
144-
std::optional<std::string> notStartsWithArg = std::optional<std::string> {},
145-
std::optional<std::string> endsWithArg = std::optional<std::string> {},
146-
std::optional<std::string> notEndsWithArg = std::optional<std::string> {}) noexcept;
146+
std::optional<std::vector<StringOperationFilterInput>> and_Arg,
147+
std::optional<std::vector<StringOperationFilterInput>> or_Arg,
148+
std::optional<std::string> equalArg,
149+
std::optional<std::string> notEqualArg,
150+
std::optional<std::string> containsArg,
151+
std::optional<std::string> notContainsArg,
152+
std::optional<std::vector<std::string>> inArg,
153+
std::optional<std::vector<std::string>> notInArg,
154+
std::optional<std::string> startsWithArg,
155+
std::optional<std::string> notStartsWithArg,
156+
std::optional<std::string> endsWithArg,
157+
std::optional<std::string> notEndsWithArg) noexcept;
147158
StringOperationFilterInput(const StringOperationFilterInput& other);
148159
StringOperationFilterInput(StringOperationFilterInput&& other) noexcept;
160+
~StringOperationFilterInput();
149161

150162
StringOperationFilterInput& operator=(const StringOperationFilterInput& other);
151163
StringOperationFilterInput& operator=(StringOperationFilterInput&& other) noexcept;
@@ -166,11 +178,13 @@ struct [[nodiscard]] StringOperationFilterInput
166178

167179
struct [[nodiscard]] SecondNestedInput
168180
{
181+
explicit SecondNestedInput() noexcept;
169182
explicit SecondNestedInput(
170-
response::IdType idArg = response::IdType {},
171-
ThirdNestedInput thirdArg = ThirdNestedInput {}) noexcept;
183+
response::IdType idArg,
184+
ThirdNestedInput thirdArg) noexcept;
172185
SecondNestedInput(const SecondNestedInput& other);
173186
SecondNestedInput(SecondNestedInput&& other) noexcept;
187+
~SecondNestedInput();
174188

175189
SecondNestedInput& operator=(const SecondNestedInput& other);
176190
SecondNestedInput& operator=(SecondNestedInput&& other) noexcept;
@@ -181,11 +195,13 @@ struct [[nodiscard]] SecondNestedInput
181195

182196
struct [[nodiscard]] ForwardDeclaredInput
183197
{
198+
explicit ForwardDeclaredInput() noexcept;
184199
explicit ForwardDeclaredInput(
185-
std::unique_ptr<IncludeNullableSelfInput> nullableSelfArg = std::unique_ptr<IncludeNullableSelfInput> {},
186-
IncludeNonNullableListSelfInput listSelvesArg = IncludeNonNullableListSelfInput {}) noexcept;
200+
std::unique_ptr<IncludeNullableSelfInput> nullableSelfArg,
201+
IncludeNonNullableListSelfInput listSelvesArg) noexcept;
187202
ForwardDeclaredInput(const ForwardDeclaredInput& other);
188203
ForwardDeclaredInput(ForwardDeclaredInput&& other) noexcept;
204+
~ForwardDeclaredInput();
189205

190206
ForwardDeclaredInput& operator=(const ForwardDeclaredInput& other);
191207
ForwardDeclaredInput& operator=(ForwardDeclaredInput&& other) noexcept;
@@ -196,12 +212,14 @@ struct [[nodiscard]] ForwardDeclaredInput
196212

197213
struct [[nodiscard]] FirstNestedInput
198214
{
215+
explicit FirstNestedInput() noexcept;
199216
explicit FirstNestedInput(
200-
response::IdType idArg = response::IdType {},
201-
SecondNestedInput secondArg = SecondNestedInput {},
202-
ThirdNestedInput thirdArg = ThirdNestedInput {}) noexcept;
217+
response::IdType idArg,
218+
SecondNestedInput secondArg,
219+
ThirdNestedInput thirdArg) noexcept;
203220
FirstNestedInput(const FirstNestedInput& other);
204221
FirstNestedInput(FirstNestedInput&& other) noexcept;
222+
~FirstNestedInput();
205223

206224
FirstNestedInput& operator=(const FirstNestedInput& other);
207225
FirstNestedInput& operator=(FirstNestedInput&& other) noexcept;

0 commit comments

Comments
 (0)