Generated-output differences

quicktype output changed between the PR base and tested PR merge revisions.
← Back to the pull request
5test cases
5files differ
4modified
1new
0deleted
495changed lines
+476 −19insertions / deletions
Base 3cb2f3db97047c9750b6bbdbdb18ffe49b885a1a · PR merge 38e9d31afb222d5c202954dca8caea4434bfc775 · Head 3b3b7834b9f65d705ccd0c25e5f10027e3433be5 · raw patch
Test case

test/inputs/schema/mutually-recursive.schema

1 generated file · +18 −1
Mschema-cplusplusdefault / quicktype.hpp+18 −1
@@ -89,11 +89,17 @@ namespace quicktype {
8989 }
9090 #endif
9191
92+ struct Foo;
93+
9294 class Bar;
9395
9496 class TopLevel;
9597
96- using Foo = std::variant<std::vector<TopLevel>, std::shared_ptr<TopLevel>>;
98+ struct Foo : std::variant<std::vector<TopLevel>, std::shared_ptr<TopLevel>> {
99+ using base = std::variant<std::vector<TopLevel>, std::shared_ptr<TopLevel>>;
100+ using base::base;
101+ using base::operator=;
102+ };
97103
98104 class Bar {
99105 public:
@@ -130,6 +136,9 @@ void to_json(json & j, const Bar & x);
130136
131137 void from_json(const json & j, TopLevel & x);
132138 void to_json(json & j, const TopLevel & x);
139+
140+void from_json(const json & j, Foo & x);
141+void to_json(json & j, const Foo & x);
133142 }
134143 namespace nlohmann {
135144 template <>
@@ -156,6 +165,14 @@ namespace quicktype {
156165 j = json::object();
157166 j["bar"] = x.get_bar();
158167 }
168+
169+ inline void from_json(const json & j, Foo & x) {
170+ x = j.get<Foo::base>();
171+ }
172+
173+ inline void to_json(json & j, const Foo & x) {
174+ j = static_cast<const Foo::base &>(x);
175+ }
159176 }
160177 namespace nlohmann {
161178 inline void adl_serializer<std::variant<std::vector<quicktype::TopLevel>, std::shared_ptr<quicktype::TopLevel>>>::from_json(const json & j, std::variant<std::vector<quicktype::TopLevel>, std::shared_ptr<quicktype::TopLevel>> & x) {
Test case

test/inputs/schema/recursive-union-flattening.schema

1 generated file · +373 −0
Aschema-cplusplusdefault / quicktype.hpp+373 −0
@@ -0,0 +1,373 @@
1+// To parse this JSON data, first install
2+//
3+// json.hpp https://github.com/nlohmann/json
4+//
5+// Then include this file, and then do
6+//
7+// TopLevel data = nlohmann::json::parse(jsonString);
8+
9+#pragma once
10+
11+#include <optional>
12+#include <variant>
13+#include "json.hpp"
14+
15+#include <optional>
16+#include <stdexcept>
17+#include <regex>
18+
19+#ifndef NLOHMANN_OPT_HELPER
20+#define NLOHMANN_OPT_HELPER
21+namespace nlohmann {
22+ template <typename T>
23+ struct adl_serializer<std::shared_ptr<T>> {
24+ static void to_json(json & j, const std::shared_ptr<T> & opt) {
25+ if (!opt) j = nullptr; else j = *opt;
26+ }
27+
28+ static std::shared_ptr<T> from_json(const json & j) {
29+ if (j.is_null()) return std::shared_ptr<T>(); else return std::make_shared<T>(j.get<T>());
30+ }
31+ };
32+ template <typename T>
33+ struct adl_serializer<std::optional<T>> {
34+ static void to_json(json & j, const std::optional<T> & opt) {
35+ if (!opt) j = nullptr; else j = *opt;
36+ }
37+
38+ static std::optional<T> from_json(const json & j) {
39+ if (j.is_null()) return std::optional<T>(); else return std::make_optional<T>(j.get<T>());
40+ }
41+ };
42+}
43+#endif
44+
45+namespace quicktype {
46+ using nlohmann::json;
47+
48+ #ifndef NLOHMANN_UNTYPED_quicktype_HELPER
49+ #define NLOHMANN_UNTYPED_quicktype_HELPER
50+ inline json get_untyped(const json & j, const char * property) {
51+ if (j.find(property) != j.end()) {
52+ return j.at(property).get<json>();
53+ }
54+ return json();
55+ }
56+
57+ inline json get_untyped(const json & j, std::string property) {
58+ return get_untyped(j, property.data());
59+ }
60+ #endif
61+
62+ #ifndef NLOHMANN_OPTIONAL_quicktype_HELPER
63+ #define NLOHMANN_OPTIONAL_quicktype_HELPER
64+ template <typename T>
65+ inline std::shared_ptr<T> get_heap_optional(const json & j, const char * property) {
66+ auto it = j.find(property);
67+ if (it != j.end() && !it->is_null()) {
68+ return j.at(property).get<std::shared_ptr<T>>();
69+ }
70+ return std::shared_ptr<T>();
71+ }
72+
73+ template <typename T>
74+ inline std::shared_ptr<T> get_heap_optional(const json & j, std::string property) {
75+ return get_heap_optional<T>(j, property.data());
76+ }
77+ template <typename T>
78+ inline std::optional<T> get_stack_optional(const json & j, const char * property) {
79+ auto it = j.find(property);
80+ if (it != j.end() && !it->is_null()) {
81+ return j.at(property).get<std::optional<T>>();
82+ }
83+ return std::optional<T>();
84+ }
85+
86+ template <typename T>
87+ inline std::optional<T> get_stack_optional(const json & j, std::string property) {
88+ return get_stack_optional<T>(j, property.data());
89+ }
90+ #endif
91+
92+ struct X;
93+ struct XElement;
94+
95+ class XClass;
96+
97+ struct X : std::shared_ptr<std::variant<std::vector<XElement>, bool, double, int64_t, std::map<std::string, nlohmann::json>, std::string>> {
98+ using base = std::shared_ptr<std::variant<std::vector<XElement>, bool, double, int64_t, std::map<std::string, nlohmann::json>, std::string>>;
99+ using base::base;
100+ using base::operator=;
101+ };
102+
103+ struct XElement : std::optional<std::variant<std::vector<nlohmann::json>, bool, std::shared_ptr<XClass>, double, int64_t, std::string>> {
104+ using base = std::optional<std::variant<std::vector<nlohmann::json>, bool, std::shared_ptr<XClass>, double, int64_t, std::string>>;
105+ using base::base;
106+ using base::operator=;
107+ };
108+
109+ class XClass {
110+ public:
111+ XClass() = default;
112+ virtual ~XClass() = default;
113+
114+ private:
115+ X x;
116+
117+ public:
118+ X get_x() const { return x; }
119+ void set_x(X value) { this->x = value; }
120+ };
121+
122+ class TopLevelClass {
123+ public:
124+ TopLevelClass() = default;
125+ virtual ~TopLevelClass() = default;
126+
127+ private:
128+ X x;
129+
130+ public:
131+ X get_x() const { return x; }
132+ void set_x(X value) { this->x = value; }
133+ };
134+
135+ using TopLevelElement = std::optional<std::variant<std::vector<nlohmann::json>, bool, TopLevelClass, double, int64_t, std::string>>;
136+
137+ using TopLevel = std::optional<std::variant<std::vector<TopLevelElement>, bool, double, int64_t, std::map<std::string, nlohmann::json>, std::string>>;
138+}
139+
140+namespace quicktype {
141+void from_json(const json & j, XClass & x);
142+void to_json(json & j, const XClass & x);
143+
144+void from_json(const json & j, TopLevelClass & x);
145+void to_json(json & j, const TopLevelClass & x);
146+
147+void from_json(const json & j, X & x);
148+void to_json(json & j, const X & x);
149+
150+void from_json(const json & j, XElement & x);
151+void to_json(json & j, const XElement & x);
152+}
153+namespace nlohmann {
154+template <>
155+struct adl_serializer<std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string>> {
156+ static void from_json(const json & j, std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x);
157+ static void to_json(json & j, const std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x);
158+};
159+
160+template <>
161+struct adl_serializer<std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string>> {
162+ static void from_json(const json & j, std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string> & x);
163+ static void to_json(json & j, const std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string> & x);
164+};
165+
166+template <>
167+struct adl_serializer<std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string>> {
168+ static void from_json(const json & j, std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string> & x);
169+ static void to_json(json & j, const std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string> & x);
170+};
171+
172+template <>
173+struct adl_serializer<std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string>> {
174+ static void from_json(const json & j, std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x);
175+ static void to_json(json & j, const std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x);
176+};
177+}
178+namespace quicktype {
179+ inline void from_json(const json & j, XClass& x) {
180+ x.set_x(j.find("x") != j.end() ? j.at("x").get<X>() : X());
181+ }
182+
183+ inline void to_json(json & j, const XClass & x) {
184+ j = json::object();
185+ j["x"] = x.get_x();
186+ }
187+
188+ inline void from_json(const json & j, TopLevelClass& x) {
189+ x.set_x(j.find("x") != j.end() ? j.at("x").get<X>() : X());
190+ }
191+
192+ inline void to_json(json & j, const TopLevelClass & x) {
193+ j = json::object();
194+ j["x"] = x.get_x();
195+ }
196+
197+ inline void from_json(const json & j, X & x) {
198+ x = j.get<X::base>();
199+ }
200+
201+ inline void to_json(json & j, const X & x) {
202+ j = static_cast<const X::base &>(x);
203+ }
204+
205+ inline void from_json(const json & j, XElement & x) {
206+ x = j.get<XElement::base>();
207+ }
208+
209+ inline void to_json(json & j, const XElement & x) {
210+ j = static_cast<const XElement::base &>(x);
211+ }
212+}
213+namespace nlohmann {
214+ inline void adl_serializer<std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string>>::from_json(const json & j, std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x) {
215+ if (j.is_boolean())
216+ x = j.get<bool>();
217+ else if (j.is_number_integer())
218+ x = j.get<int64_t>();
219+ else if (j.is_number())
220+ x = j.get<double>();
221+ else if (j.is_string())
222+ x = j.get<std::string>();
223+ else if (j.is_object())
224+ x = j.get<std::map<std::string, json>>();
225+ else if (j.is_array())
226+ x = j.get<std::vector<quicktype::XElement>>();
227+ else throw std::runtime_error("Could not deserialise!");
228+ }
229+
230+ inline void adl_serializer<std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string>>::to_json(json & j, const std::variant<std::vector<quicktype::XElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x) {
231+ switch (x.index()) {
232+ case 0:
233+ j = std::get<std::vector<quicktype::XElement>>(x);
234+ break;
235+ case 1:
236+ j = std::get<bool>(x);
237+ break;
238+ case 2:
239+ j = std::get<double>(x);
240+ break;
241+ case 3:
242+ j = std::get<int64_t>(x);
243+ break;
244+ case 4:
245+ j = std::get<std::map<std::string, json>>(x);
246+ break;
247+ case 5:
248+ j = std::get<std::string>(x);
249+ break;
250+ default: throw std::runtime_error("Input JSON does not conform to schema!");
251+ }
252+ }
253+
254+ inline void adl_serializer<std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string>>::from_json(const json & j, std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string> & x) {
255+ if (j.is_boolean())
256+ x = j.get<bool>();
257+ else if (j.is_number_integer())
258+ x = j.get<int64_t>();
259+ else if (j.is_number())
260+ x = j.get<double>();
261+ else if (j.is_string())
262+ x = j.get<std::string>();
263+ else if (j.is_object())
264+ x = j.get<std::shared_ptr<quicktype::XClass>>();
265+ else if (j.is_array())
266+ x = j.get<std::vector<json>>();
267+ else throw std::runtime_error("Could not deserialise!");
268+ }
269+
270+ inline void adl_serializer<std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string>>::to_json(json & j, const std::variant<std::vector<json>, bool, std::shared_ptr<quicktype::XClass>, double, int64_t, std::string> & x) {
271+ switch (x.index()) {
272+ case 0:
273+ j = std::get<std::vector<json>>(x);
274+ break;
275+ case 1:
276+ j = std::get<bool>(x);
277+ break;
278+ case 2:
279+ j = std::get<std::shared_ptr<quicktype::XClass>>(x);
280+ break;
281+ case 3:
282+ j = std::get<double>(x);
283+ break;
284+ case 4:
285+ j = std::get<int64_t>(x);
286+ break;
287+ case 5:
288+ j = std::get<std::string>(x);
289+ break;
290+ default: throw std::runtime_error("Input JSON does not conform to schema!");
291+ }
292+ }
293+
294+ inline void adl_serializer<std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string>>::from_json(const json & j, std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string> & x) {
295+ if (j.is_boolean())
296+ x = j.get<bool>();
297+ else if (j.is_number_integer())
298+ x = j.get<int64_t>();
299+ else if (j.is_number())
300+ x = j.get<double>();
301+ else if (j.is_string())
302+ x = j.get<std::string>();
303+ else if (j.is_object())
304+ x = j.get<quicktype::TopLevelClass>();
305+ else if (j.is_array())
306+ x = j.get<std::vector<json>>();
307+ else throw std::runtime_error("Could not deserialise!");
308+ }
309+
310+ inline void adl_serializer<std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string>>::to_json(json & j, const std::variant<std::vector<json>, bool, quicktype::TopLevelClass, double, int64_t, std::string> & x) {
311+ switch (x.index()) {
312+ case 0:
313+ j = std::get<std::vector<json>>(x);
314+ break;
315+ case 1:
316+ j = std::get<bool>(x);
317+ break;
318+ case 2:
319+ j = std::get<quicktype::TopLevelClass>(x);
320+ break;
321+ case 3:
322+ j = std::get<double>(x);
323+ break;
324+ case 4:
325+ j = std::get<int64_t>(x);
326+ break;
327+ case 5:
328+ j = std::get<std::string>(x);
329+ break;
330+ default: throw std::runtime_error("Input JSON does not conform to schema!");
331+ }
332+ }
333+
334+ inline void adl_serializer<std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string>>::from_json(const json & j, std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x) {
335+ if (j.is_boolean())
336+ x = j.get<bool>();
337+ else if (j.is_number_integer())
338+ x = j.get<int64_t>();
339+ else if (j.is_number())
340+ x = j.get<double>();
341+ else if (j.is_string())
342+ x = j.get<std::string>();
343+ else if (j.is_object())
344+ x = j.get<std::map<std::string, json>>();
345+ else if (j.is_array())
346+ x = j.get<std::vector<quicktype::TopLevelElement>>();
347+ else throw std::runtime_error("Could not deserialise!");
348+ }
349+
350+ inline void adl_serializer<std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string>>::to_json(json & j, const std::variant<std::vector<quicktype::TopLevelElement>, bool, double, int64_t, std::map<std::string, json>, std::string> & x) {
351+ switch (x.index()) {
352+ case 0:
353+ j = std::get<std::vector<quicktype::TopLevelElement>>(x);
354+ break;
355+ case 1:
356+ j = std::get<bool>(x);
357+ break;
358+ case 2:
359+ j = std::get<double>(x);
360+ break;
361+ case 3:
362+ j = std::get<int64_t>(x);
363+ break;
364+ case 4:
365+ j = std::get<std::map<std::string, json>>(x);
366+ break;
367+ case 5:
368+ j = std::get<std::string>(x);
369+ break;
370+ default: throw std::runtime_error("Input JSON does not conform to schema!");
371+ }
372+ }
373+}
Test case

test/inputs/schema/rust-cycle-breaker-union.schema

1 generated file · +20 −3
Mschema-cplusplusdefault / quicktype.hpp+20 −3
@@ -89,9 +89,15 @@ namespace quicktype {
8989 }
9090 #endif
9191
92+ struct Next;
93+
9294 class Node;
9395
94- using Next = std::shared_ptr<std::variant<std::shared_ptr<Node>, std::string>>;
96+ struct Next : std::shared_ptr<std::variant<std::shared_ptr<Node>, std::string>> {
97+ using base = std::shared_ptr<std::variant<std::shared_ptr<Node>, std::string>>;
98+ using base::base;
99+ using base::operator=;
100+ };
95101
96102 class Node {
97103 public:
@@ -136,6 +142,9 @@ void to_json(json & j, const Node & x);
136142
137143 void from_json(const json & j, TopLevel & x);
138144 void to_json(json & j, const TopLevel & x);
145+
146+void from_json(const json & j, Next & x);
147+void to_json(json & j, const Next & x);
139148 }
140149 namespace nlohmann {
141150 template <>
@@ -146,7 +155,7 @@ struct adl_serializer<std::variant<std::shared_ptr<quicktype::Node>, std::string
146155 }
147156 namespace quicktype {
148157 inline void from_json(const json & j, Node& x) {
149- x.set_next(get_heap_optional<std::variant<std::shared_ptr<Node>, std::string>>(j, "next"));
158+ x.set_next(j.find("next") != j.end() ? j.at("next").get<Next>() : Next());
150159 x.set_value(j.at("value").get<std::string>());
151160 }
152161
@@ -157,7 +166,7 @@ namespace quicktype {
157166 }
158167
159168 inline void from_json(const json & j, TopLevel& x) {
160- x.set_next(get_heap_optional<std::variant<std::shared_ptr<Node>, std::string>>(j, "next"));
169+ x.set_next(j.find("next") != j.end() ? j.at("next").get<Next>() : Next());
161170 x.set_value(j.at("value").get<std::string>());
162171 }
163172
@@ -166,6 +175,14 @@ namespace quicktype {
166175 j["next"] = x.get_next();
167176 j["value"] = x.get_value();
168177 }
178+
179+ inline void from_json(const json & j, Next & x) {
180+ x = j.get<Next::base>();
181+ }
182+
183+ inline void to_json(json & j, const Next & x) {
184+ j = static_cast<const Next::base &>(x);
185+ }
169186 }
170187 namespace nlohmann {
171188 inline void adl_serializer<std::variant<std::shared_ptr<quicktype::Node>, std::string>>::from_json(const json & j, std::variant<std::shared_ptr<quicktype::Node>, std::string> & x) {
Test case

test/inputs/schema/union-list.schema

1 generated file · +18 −1
Mschema-cplusplusdefault / quicktype.hpp+18 −1
@@ -88,9 +88,15 @@ namespace quicktype {
8888 }
8989 #endif
9090
91+ struct UnionList;
92+
9193 class UnionListClass;
9294
93- using UnionList = std::variant<std::shared_ptr<UnionListClass>, double>;
95+ struct UnionList : std::variant<std::shared_ptr<UnionListClass>, double> {
96+ using base = std::variant<std::shared_ptr<UnionListClass>, double>;
97+ using base::base;
98+ using base::operator=;
99+ };
94100
95101 class UnionListClass {
96102 public:
@@ -127,6 +133,9 @@ void to_json(json & j, const UnionListClass & x);
127133
128134 void from_json(const json & j, TopLevel & x);
129135 void to_json(json & j, const TopLevel & x);
136+
137+void from_json(const json & j, UnionList & x);
138+void to_json(json & j, const UnionList & x);
130139 }
131140 namespace nlohmann {
132141 template <>
@@ -153,6 +162,14 @@ namespace quicktype {
153162 j = json::object();
154163 j["list"] = x.get_list();
155164 }
165+
166+ inline void from_json(const json & j, UnionList & x) {
167+ x = j.get<UnionList::base>();
168+ }
169+
170+ inline void to_json(json & j, const UnionList & x) {
171+ j = static_cast<const UnionList::base &>(x);
172+ }
156173 }
157174 namespace nlohmann {
158175 inline void adl_serializer<std::variant<std::shared_ptr<quicktype::UnionListClass>, double>>::from_json(const json & j, std::variant<std::shared_ptr<quicktype::UnionListClass>, double> & x) {
Test case

test/inputs/schema/vega-lite.schema

1 generated file · +47 −14
Mschema-cplusplusdefault / quicktype.hpp+47 −14
@@ -221,6 +221,9 @@ namespace quicktype {
221221 }
222222 #endif
223223
224+ struct SelectionOperand;
225+ struct LogicalOperandPredicate;
226+
224227 /**
225228 * Determines how size calculation should be performed, one of `"content"` or `"padding"`.
226229 * The default setting (`"content"`) interprets the width and height settings as the data
@@ -5039,7 +5042,11 @@ namespace quicktype {
50395042
50405043 class Selection;
50415044
5042- using SelectionOperand = std::variant<std::shared_ptr<Selection>, std::string>;
5045+ struct SelectionOperand : std::variant<std::shared_ptr<Selection>, std::string> {
5046+ using base = std::variant<std::shared_ptr<Selection>, std::string>;
5047+ using base::base;
5048+ using base::operator=;
5049+ };
50435050
50445051 class Selection {
50455052 public:
@@ -5204,7 +5211,11 @@ namespace quicktype {
52045211
52055212 class Predicate;
52065213
5207- using LogicalOperandPredicate = std::variant<std::shared_ptr<Predicate>, std::string>;
5214+ struct LogicalOperandPredicate : std::variant<std::shared_ptr<Predicate>, std::string> {
5215+ using base = std::variant<std::shared_ptr<Predicate>, std::string>;
5216+ using base::base;
5217+ using base::operator=;
5218+ };
52085219
52095220 class Predicate {
52105221 public:
@@ -9845,6 +9856,12 @@ void to_json(json & j, const ResolveMode & x);
98459856
98469857 void from_json(const json & j, SelectionDefType & x);
98479858 void to_json(json & j, const SelectionDefType & x);
9859+
9860+void from_json(const json & j, SelectionOperand & x);
9861+void to_json(json & j, const SelectionOperand & x);
9862+
9863+void from_json(const json & j, LogicalOperandPredicate & x);
9864+void to_json(json & j, const LogicalOperandPredicate & x);
98489865 }
98499866 namespace nlohmann {
98509867 template <>
@@ -11078,7 +11095,7 @@ namespace quicktype {
1107811095 }
1107911096
1108011097 inline void from_json(const json & j, Selection& x) {
11081- x.set_selection_not(get_heap_optional<std::variant<std::shared_ptr<Selection>, std::string>>(j, "not"));
11098+ x.set_selection_not(get_heap_optional<SelectionOperand>(j, "not"));
1108211099 x.set_selection_and(get_stack_optional<std::vector<SelectionOperand>>(j, "and"));
1108311100 x.set_selection_or(get_stack_optional<std::vector<SelectionOperand>>(j, "or"));
1108411101 }
@@ -11118,7 +11135,7 @@ namespace quicktype {
1111811135 }
1111911136
1112011137 inline void from_json(const json & j, Predicate& x) {
11121- x.set_predicate_not(get_heap_optional<std::variant<std::shared_ptr<Predicate>, std::string>>(j, "not"));
11138+ x.set_predicate_not(get_heap_optional<LogicalOperandPredicate>(j, "not"));
1112211139 x.set_predicate_and(get_stack_optional<std::vector<LogicalOperandPredicate>>(j, "and"));
1112311140 x.set_predicate_or(get_stack_optional<std::vector<LogicalOperandPredicate>>(j, "or"));
1112411141 x.set_equal(get_stack_optional<std::variant<bool, DateTime, double, std::string>>(j, "equal"));
@@ -11126,7 +11143,7 @@ namespace quicktype {
1112611143 x.set_time_unit(get_stack_optional<TimeUnit>(j, "timeUnit"));
1112711144 x.set_range(get_stack_optional<std::vector<RangeElement>>(j, "range"));
1112811145 x.set_one_of(get_stack_optional<std::vector<Equal>>(j, "oneOf"));
11129- x.set_selection(get_heap_optional<std::variant<std::shared_ptr<Selection>, std::string>>(j, "selection"));
11146+ x.set_selection(get_heap_optional<SelectionOperand>(j, "selection"));
1113011147 }
1113111148
1113211149 inline void to_json(json & j, const Predicate & x) {
@@ -11143,9 +11160,9 @@ namespace quicktype {
1114311160 }
1114411161
1114511162 inline void from_json(const json & j, ConditionalValueDef& x) {
11146- x.set_test(get_heap_optional<std::variant<std::shared_ptr<Predicate>, std::string>>(j, "test"));
11163+ x.set_test(get_heap_optional<LogicalOperandPredicate>(j, "test"));
1114711164 x.set_value(j.at("value").get<ConditionalValueDefValue>());
11148- x.set_selection(get_heap_optional<std::variant<std::shared_ptr<Selection>, std::string>>(j, "selection"));
11165+ x.set_selection(get_heap_optional<SelectionOperand>(j, "selection"));
1114911166 }
1115011167
1115111168 inline void to_json(json & j, const ConditionalValueDef & x) {
@@ -11288,9 +11305,9 @@ namespace quicktype {
1128811305 }
1128911306
1129011307 inline void from_json(const json & j, ConditionalPredicateMarkPropFieldDefClass& x) {
11291- x.set_test(get_heap_optional<std::variant<std::shared_ptr<Predicate>, std::string>>(j, "test"));
11308+ x.set_test(get_heap_optional<LogicalOperandPredicate>(j, "test"));
1129211309 x.set_value(get_stack_optional<std::variant<bool, double, std::string>>(j, "value"));
11293- x.set_selection(get_heap_optional<std::variant<std::shared_ptr<Selection>, std::string>>(j, "selection"));
11310+ x.set_selection(get_heap_optional<SelectionOperand>(j, "selection"));
1129411311 x.set_aggregate(get_stack_optional<AggregateOp>(j, "aggregate"));
1129511312 x.set_bin(get_stack_optional<std::variant<bool, BinParams>>(j, "bin"));
1129611313 x.set_field(get_stack_optional<std::variant<RepeatRef, std::string>>(j, "field"));
@@ -11395,9 +11412,9 @@ namespace quicktype {
1139511412 }
1139611413
1139711414 inline void from_json(const json & j, ConditionalPredicateFieldDefClass& x) {
11398- x.set_test(get_heap_optional<std::variant<std::shared_ptr<Predicate>, std::string>>(j, "test"));
11415+ x.set_test(get_heap_optional<LogicalOperandPredicate>(j, "test"));
1139911416 x.set_value(get_stack_optional<std::variant<bool, double, std::string>>(j, "value"));
11400- x.set_selection(get_heap_optional<std::variant<std::shared_ptr<Selection>, std::string>>(j, "selection"));
11417+ x.set_selection(get_heap_optional<SelectionOperand>(j, "selection"));
1140111418 x.set_aggregate(get_stack_optional<AggregateOp>(j, "aggregate"));
1140211419 x.set_bin(get_stack_optional<std::variant<bool, BinParams>>(j, "bin"));
1140311420 x.set_field(get_stack_optional<std::variant<RepeatRef, std::string>>(j, "field"));
@@ -11458,9 +11475,9 @@ namespace quicktype {
1145811475 }
1145911476
1146011477 inline void from_json(const json & j, ConditionalPredicateTextFieldDefClass& x) {
11461- x.set_test(get_heap_optional<std::variant<std::shared_ptr<Predicate>, std::string>>(j, "test"));
11478+ x.set_test(get_heap_optional<LogicalOperandPredicate>(j, "test"));
1146211479 x.set_value(get_stack_optional<std::variant<bool, double, std::string>>(j, "value"));
11463- x.set_selection(get_heap_optional<std::variant<std::shared_ptr<Selection>, std::string>>(j, "selection"));
11480+ x.set_selection(get_heap_optional<SelectionOperand>(j, "selection"));
1146411481 x.set_aggregate(get_stack_optional<AggregateOp>(j, "aggregate"));
1146511482 x.set_bin(get_stack_optional<std::variant<bool, BinParams>>(j, "bin"));
1146611483 x.set_field(get_stack_optional<std::variant<RepeatRef, std::string>>(j, "field"));
@@ -11926,7 +11943,7 @@ namespace quicktype {
1192611943 }
1192711944
1192811945 inline void from_json(const json & j, Transform& x) {
11929- x.set_filter(get_heap_optional<std::variant<std::shared_ptr<Predicate>, std::string>>(j, "filter"));
11946+ x.set_filter(get_heap_optional<LogicalOperandPredicate>(j, "filter"));
1193011947 x.set_as(get_stack_optional<std::variant<std::vector<std::string>, std::string>>(j, "as"));
1193111948 x.set_calculate(get_stack_optional<std::string>(j, "calculate"));
1193211949 x.set_transform_default(get_stack_optional<std::string>(j, "default"));
@@ -12957,6 +12974,22 @@ namespace quicktype {
1295712974 default: throw std::runtime_error("Unexpected value in enumeration \"SelectionDefType\": " + std::to_string(static_cast<int>(x)));
1295812975 }
1295912976 }
12977+
12978+ inline void from_json(const json & j, SelectionOperand & x) {
12979+ x = j.get<SelectionOperand::base>();
12980+ }
12981+
12982+ inline void to_json(json & j, const SelectionOperand & x) {
12983+ j = static_cast<const SelectionOperand::base &>(x);
12984+ }
12985+
12986+ inline void from_json(const json & j, LogicalOperandPredicate & x) {
12987+ x = j.get<LogicalOperandPredicate::base>();
12988+ }
12989+
12990+ inline void to_json(json & j, const LogicalOperandPredicate & x) {
12991+ j = static_cast<const LogicalOperandPredicate::base &>(x);
12992+ }
1296012993 }
1296112994 namespace nlohmann {
1296212995 inline void adl_serializer<std::variant<quicktype::AutoSizeParams, quicktype::AutosizeType>>::from_json(const json & j, std::variant<quicktype::AutoSizeParams, quicktype::AutosizeType> & x) {
No generated files match these filters.