Generated-output differences

quicktype output changed between the PR base and tested PR merge revisions.
← Back to the pull request
6test cases
6files differ
5modified
1new
0deleted
57changed lines
+45 −12insertions / deletions
Base 66df8a7480383ad7d4784464b395df83fd482c7f · PR merge b587d646037c3bb2ead1179328749fefb186ca10 · Head 7001a14d27914f84f3a8f8595500a502fd2dece7 · raw patch
Test case

test/inputs/dart/unicode-codepoint-length.schema

1 generated file · +33 −0
Aschema-dartdefault / TopLevel.dart+33 −0
@@ -0,0 +1,33 @@
1+// To parse this JSON data, do
2+//
3+// final topLevel = topLevelFromJson(jsonString);
4+
5+import 'dart:convert';
6+
7+TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str));
8+
9+String topLevelToJson(TopLevel data) => json.encode(data.toJson());
10+
11+class TopLevel {
12+ final String exact;
13+ final String maximum;
14+ final String minimum;
15+
16+ TopLevel({
17+ required this.exact,
18+ required this.maximum,
19+ required this.minimum,
20+ });
21+
22+ factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel(
23+ exact: ((x) => RegExp("^[^!]+\u0024").hasMatch(x) ? x : throw FormatException("Expected matching string"))(((x) => x.runes.length >= 2 && x.runes.length <= 2 ? x : throw FormatException("Expected bounded string"))(json["exact"])),
24+ maximum: ((x) => true && x.runes.length <= 1 ? x : throw FormatException("Expected bounded string"))(json["maximum"]),
25+ minimum: ((x) => x.runes.length >= 2 && true ? x : throw FormatException("Expected bounded string"))(json["minimum"]),
26+ );
27+
28+ Map<String, dynamic> toJson() => {
29+ "exact": exact,
30+ "maximum": maximum,
31+ "minimum": minimum,
32+ };
33+}
Test case

test/inputs/schema/minmaxlength.schema

1 generated file · +6 −6
Mschema-dartdefault / TopLevel.dart+6 −6
@@ -30,14 +30,14 @@ class TopLevel {
3030 });
3131
3232 factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel(
33- intersection: ((x) => x.length >= 4 && x.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["intersection"]),
33+ intersection: ((x) => x.runes.length >= 4 && x.runes.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["intersection"]),
3434 inUnion: json["inUnion"],
35- maxlength: ((x) => true && x.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["maxlength"]),
36- minlength: ((x) => x.length >= 3 && true ? x : throw FormatException("Expected bounded string"))(json["minlength"]),
37- minMaxIntersection: ((x) => x.length >= 3 && x.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["minMaxIntersection"]),
38- minmaxlength: ((x) => x.length >= 3 && x.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["minmaxlength"]),
35+ maxlength: ((x) => true && x.runes.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["maxlength"]),
36+ minlength: ((x) => x.runes.length >= 3 && true ? x : throw FormatException("Expected bounded string"))(json["minlength"]),
37+ minMaxIntersection: ((x) => x.runes.length >= 3 && x.runes.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["minMaxIntersection"]),
38+ minmaxlength: ((x) => x.runes.length >= 3 && x.runes.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["minmaxlength"]),
3939 minMaxUnion: json["minMaxUnion"],
40- union: ((x) => x.length >= 3 && x.length <= 6 ? x : throw FormatException("Expected bounded string"))(json["union"]),
40+ union: ((x) => x.runes.length >= 3 && x.runes.length <= 6 ? x : throw FormatException("Expected bounded string"))(json["union"]),
4141 );
4242
4343 Map<String, dynamic> toJson() => {
Test case

test/inputs/schema/optional-const-ref.schema

1 generated file · +2 −2
Mschema-dartdefault / TopLevel.dart+2 −2
@@ -30,10 +30,10 @@ class TopLevel {
3030 factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel(
3131 coordinates: json["coordinates"] == null ? null : List<Coordinate>.from(json["coordinates"]!.map((x) => Coordinate.fromJson(x))),
3232 count: json["count"] == null ? null : ((x) => x >= 1 && x <= 100 ? x : throw FormatException("Expected bounded number"))(json["count"]),
33- label: json["label"] == null ? null : ((x) => x.length >= 2 && x.length <= 16 ? x : throw FormatException("Expected bounded string"))(json["label"]),
33+ label: json["label"] == null ? null : ((x) => x.runes.length >= 2 && x.runes.length <= 16 ? x : throw FormatException("Expected bounded string"))(json["label"]),
3434 requiredCoordinates: List<Coordinate>.from(json["requiredCoordinates"].map((x) => Coordinate.fromJson(x))),
3535 requiredCount: ((x) => x >= 1 && x <= 100 ? x : throw FormatException("Expected bounded number"))(json["requiredCount"]),
36- requiredLabel: ((x) => x.length >= 2 && x.length <= 16 ? x : throw FormatException("Expected bounded string"))(json["requiredLabel"]),
36+ requiredLabel: ((x) => x.runes.length >= 2 && x.runes.length <= 16 ? x : throw FormatException("Expected bounded string"))(json["requiredLabel"]),
3737 weight: json["weight"]?.toDouble() == null ? null : ((x) => x >= 0.5 && x <= 99.5 ? x : throw FormatException("Expected bounded number"))(json["weight"]?.toDouble()),
3838 );
Test case

test/inputs/schema/optional-constraints.schema

1 generated file · +1 −1
Mschema-dartdefault / TopLevel.dart+1 −1
@@ -27,7 +27,7 @@ class TopLevel {
2727 optDouble: json["optDouble"]?.toDouble() == null ? null : ((x) => x >= 0.5 && x <= 99.5 ? x : throw FormatException("Expected bounded number"))(json["optDouble"]?.toDouble()),
2828 optInt: json["optInt"] == null ? null : ((x) => x >= 0 && x <= 100 ? x : throw FormatException("Expected bounded number"))(json["optInt"]),
2929 optPattern: json["optPattern"] == null ? null : ((x) => RegExp("^[a-z]+\u0024").hasMatch(x) ? x : throw FormatException("Expected matching string"))(json["optPattern"]),
30- optString: json["optString"] == null ? null : ((x) => x.length >= 3 && x.length <= 10 ? x : throw FormatException("Expected bounded string"))(json["optString"]),
30+ optString: json["optString"] == null ? null : ((x) => x.runes.length >= 3 && x.runes.length <= 10 ? x : throw FormatException("Expected bounded string"))(json["optString"]),
3131 reqZeroMin: ((x) => x >= 0 && x <= 100 ? x : throw FormatException("Expected bounded number"))(json["reqZeroMin"]),
3232 );
Test case

test/inputs/schema/renaming-bug.schema

1 generated file · +2 −2
Mschema-dartdefault / TopLevel.dart+2 −2
@@ -69,7 +69,7 @@ class Berry {
6969
7070 factory Berry.fromJson(Map<String, dynamic> json) => Berry(
7171 color: json["color"] == null ? null : Color.fromJson(json["color"]),
72- name: json["name"] == null ? null : ((x) => x.length >= 1 && true ? x : throw FormatException("Expected bounded string"))(json["name"]),
72+ name: json["name"] == null ? null : ((x) => x.runes.length >= 1 && true ? x : throw FormatException("Expected bounded string"))(json["name"]),
7373 shapes: json["shapes"] == null ? null : List<Shape>.from(json["shapes"]!.map((x) => Shape.fromJson(x))),
7474 );
7575
@@ -227,7 +227,7 @@ class Vehicle {
227227
228228 factory Vehicle.fromJson(Map<String, dynamic> json) => Vehicle(
229229 brand: json["brand"],
230- id: json["id"] == null ? null : ((x) => x.length >= 1 && true ? x : throw FormatException("Expected bounded string"))(json["id"]),
230+ id: json["id"] == null ? null : ((x) => x.runes.length >= 1 && true ? x : throw FormatException("Expected bounded string"))(json["id"]),
231231 speed: json["speed"] == null ? null : Speed.fromJson(json["speed"]),
232232 subModule: json["subModule"],
233233 type: json["type"] == null ? null : VehicleType.fromJson(json["type"]),
Test case

test/inputs/schema/schema-constraints.schema

1 generated file · +1 −1
Mschema-dartdefault / TopLevel.dart+1 −1
@@ -18,7 +18,7 @@ class TopLevel {
1818 });
1919
2020 factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel(
21- minMaxLength: ((x) => x.length >= 5 && x.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["minMaxLength"]),
21+ minMaxLength: ((x) => x.runes.length >= 5 && x.runes.length <= 5 ? x : throw FormatException("Expected bounded string"))(json["minMaxLength"]),
2222 percent: ((x) => x >= 0 && x <= 1 ? x : throw FormatException("Expected bounded number"))(json["percent"]?.toDouble()),
2323 );
No generated files match these filters.