Generated-output differences

quicktype output changed between the PR base and tested PR merge revisions.
← Back to the pull request
3test cases
3files differ
2modified
1new
0deleted
43changed lines
+43 −0insertions / deletions
Base 94fefaf04fde7b4f921703d52c0378783fa2c831 · PR merge 90b687f3cdd48ef20230fe263045e578ae0ab075 · Head 457c35c5d509ebd0d6cb0501e0f2cababd282368 · raw patch
Test case

test/inputs/json/samples/kitchen-sink.json

1 generated file · +2 −0
Mpikedefault / TopLevel.pmod+2 −0
@@ -58,9 +58,11 @@ TopLevel TopLevel_from_JSON(mixed json) {
5858 retval.different_things = json["differentThings"];
5959 retval.double_value = (float)json["doubleValue"];
6060 retval.int_value = json["intValue"];
61+ foreach (json["mapValue"]; mixed _; mixed value) if (stringp(value)) error("Unexpected string");
6162 retval.map_value = json["mapValue"];
6263 retval.name_with_spaces = json["name with spaces"];
6364 retval.null_value = json["nullValue"];
65+ foreach (json["nullableMapValue"]; mixed _; mixed value) if (stringp(value)) error("Unexpected string");
6466 retval.nullable_map_value = json["nullableMapValue"];
6567 retval.people = json["people"];
6668 retval.person = json["person"];
Test case

test/inputs/schema/class-with-additional.schema

1 generated file · +40 −0
Aschema-pikedefault / TopLevel.pmod+40 −0
@@ -0,0 +1,40 @@
1+// This source has been automatically generated by quicktype.
2+// ( https://github.com/quicktype/quicktype )
3+//
4+// To use this code, simply import it into your project as a Pike module.
5+// To JSON-encode your object, you can pass it to `Standards.JSON.encode`
6+// or call `encode_json` on it.
7+//
8+// To decode a JSON string, first pass it to `Standards.JSON.decode`,
9+// and then pass the result to `<YourClass>_from_JSON`.
10+// It will return an instance of <YourClass>.
11+// Bear in mind that these functions have unexpected behavior,
12+// and will likely throw an error, if the JSON string does not
13+// match the expected interface, even if the JSON itself is valid.
14+
15+class TopLevel {
16+ mapping(string:Map)|mixed map; // json: "map"
17+
18+ string encode_json() {
19+ mapping(string:mixed) json = ([
20+ "map" : map,
21+ ]);
22+
23+ return Standards.JSON.encode(json);
24+ }
25+}
26+
27+TopLevel TopLevel_from_JSON(mixed json) {
28+ TopLevel retval = TopLevel();
29+
30+ foreach (json["map"]; mixed _; mixed value) if (stringp(value)) error("Unexpected string");
31+ retval.map = json["map"];
32+
33+ return retval;
34+}
35+
36+typedef bool|float Map;
37+
38+Map Map_from_JSON(mixed json) {
39+ return json;
40+}
Test case

test/inputs/schema/vega-lite.schema

1 generated file · +1 −0
Mschema-pikedefault / TopLevel.pmod+1 −0
@@ -269,6 +269,7 @@ Config Config_from_JSON(mixed json) {
269269 retval.padding = json["padding"];
270270 retval.point = json["point"];
271271 retval.projection = json["projection"];
272+ foreach (json["range"]; mixed _; mixed value) if (stringp(value)) error("Unexpected string");
272273 retval.range = json["range"];
273274 retval.rect = json["rect"];
274275 retval.rule = json["rule"];
No generated files match these filters.