Test case
1 generated file · +14 −0test/inputs/schema/integer-type.schema
Mschema-pikedefault / TopLevel.pmod+14 −0
| @@ -43,13 +43,27 @@ class TopLevel { | ||
| 43 | 43 | TopLevel TopLevel_from_JSON(mixed json) { |
| 44 | 44 | TopLevel retval = TopLevel(); |
| 45 | 45 | |
| 46 | + if (json["above_i32_max"] < 0) error("Value below minimum"); | |
| 47 | + if (json["above_i32_max"] > 2147483648) error("Value above maximum"); | |
| 46 | 48 | retval.above_i32_max = json["above_i32_max"]; |
| 49 | + if (json["below_i32_min"] < -2147483649) error("Value below minimum"); | |
| 50 | + if (json["below_i32_min"] > 0) error("Value above maximum"); | |
| 47 | 51 | retval.below_i32_min = json["below_i32_min"]; |
| 52 | + if (json["i32_range"] < -2147483648) error("Value below minimum"); | |
| 53 | + if (json["i32_range"] > 2147483647) error("Value above maximum"); | |
| 48 | 54 | retval.i32_range = json["i32_range"]; |
| 55 | + if (json["large_bounds"] < -9007199254740991) error("Value below minimum"); | |
| 56 | + if (json["large_bounds"] > 9007199254740991) error("Value above maximum"); | |
| 49 | 57 | retval.large_bounds = json["large_bounds"]; |
| 58 | + if (json["only_maximum"] > 0) error("Value above maximum"); | |
| 50 | 59 | retval.only_maximum = json["only_maximum"]; |
| 60 | + if (json["only_minimum"] < 0) error("Value below minimum"); | |
| 51 | 61 | retval.only_minimum = json["only_minimum"]; |
| 62 | + if (json["small_negative"] < -100) error("Value below minimum"); | |
| 63 | + if (json["small_negative"] > 0) error("Value above maximum"); | |
| 52 | 64 | retval.small_negative = json["small_negative"]; |
| 65 | + if (json["small_positive"] < 0) error("Value below minimum"); | |
| 66 | + if (json["small_positive"] > 100) error("Value above maximum"); | |
| 53 | 67 | retval.small_positive = json["small_positive"]; |
| 54 | 68 | retval.unbounded = json["unbounded"]; |
Test case
1 generated file · +10 −0test/inputs/schema/minmax-integer.schema
Mschema-pikedefault / TopLevel.pmod+10 −0
| @@ -42,12 +42,22 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 42 | 42 | TopLevel retval = TopLevel(); |
| 43 | 43 | |
| 44 | 44 | retval.free = json["free"]; |
| 45 | + if (json["intersection"] < 4) error("Value below minimum"); | |
| 46 | + if (json["intersection"] > 5) error("Value above maximum"); | |
| 45 | 47 | retval.intersection = json["intersection"]; |
| 48 | + if (json["max"] > 5) error("Value above maximum"); | |
| 46 | 49 | retval.max = json["max"]; |
| 50 | + if (json["min"] < 3) error("Value below minimum"); | |
| 47 | 51 | retval.min = json["min"]; |
| 52 | + if (json["minmax"] < 3) error("Value below minimum"); | |
| 53 | + if (json["minmax"] > 5) error("Value above maximum"); | |
| 48 | 54 | retval.minmax = json["minmax"]; |
| 55 | + if (json["minMaxIntersection"] < 3) error("Value below minimum"); | |
| 56 | + if (json["minMaxIntersection"] > 5) error("Value above maximum"); | |
| 49 | 57 | retval.min_max_intersection = json["minMaxIntersection"]; |
| 50 | 58 | retval.min_max_union = json["minMaxUnion"]; |
| 59 | + if (json["union"] < 3) error("Value below minimum"); | |
| 60 | + if (json["union"] > 6) error("Value above maximum"); | |
| 51 | 61 | retval.union = json["union"]; |
| 52 | 62 | |
| 53 | 63 | return retval; |
Test case
1 generated file · +64 −0test/inputs/schema/minmax.schema
Aschema-pikedefault / TopLevel.pmod+64 −0
| @@ -0,0 +1,64 @@ | ||
| 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 | + float free; // json: "free" | |
| 17 | + float intersection; // json: "intersection" | |
| 18 | + float max; // json: "max" | |
| 19 | + float min; // json: "min" | |
| 20 | + float minmax; // json: "minmax" | |
| 21 | + float min_max_intersection; // json: "minMaxIntersection" | |
| 22 | + float min_max_union; // json: "minMaxUnion" | |
| 23 | + float union; // json: "union" | |
| 24 | + | |
| 25 | + string encode_json() { | |
| 26 | + mapping(string:mixed) json = ([ | |
| 27 | + "free" : free, | |
| 28 | + "intersection" : intersection, | |
| 29 | + "max" : max, | |
| 30 | + "min" : min, | |
| 31 | + "minmax" : minmax, | |
| 32 | + "minMaxIntersection" : min_max_intersection, | |
| 33 | + "minMaxUnion" : min_max_union, | |
| 34 | + "union" : union, | |
| 35 | + ]); | |
| 36 | + | |
| 37 | + return Standards.JSON.encode(json); | |
| 38 | + } | |
| 39 | +} | |
| 40 | + | |
| 41 | +TopLevel TopLevel_from_JSON(mixed json) { | |
| 42 | + TopLevel retval = TopLevel(); | |
| 43 | + | |
| 44 | + retval.free = (float)json["free"]; | |
| 45 | + if (json["intersection"] < 4) error("Value below minimum"); | |
| 46 | + if (json["intersection"] > 5) error("Value above maximum"); | |
| 47 | + retval.intersection = (float)json["intersection"]; | |
| 48 | + if (json["max"] > 5) error("Value above maximum"); | |
| 49 | + retval.max = (float)json["max"]; | |
| 50 | + if (json["min"] < 3) error("Value below minimum"); | |
| 51 | + retval.min = (float)json["min"]; | |
| 52 | + if (json["minmax"] < 3) error("Value below minimum"); | |
| 53 | + if (json["minmax"] > 5) error("Value above maximum"); | |
| 54 | + retval.minmax = (float)json["minmax"]; | |
| 55 | + if (json["minMaxIntersection"] < 3) error("Value below minimum"); | |
| 56 | + if (json["minMaxIntersection"] > 5) error("Value above maximum"); | |
| 57 | + retval.min_max_intersection = (float)json["minMaxIntersection"]; | |
| 58 | + retval.min_max_union = (float)json["minMaxUnion"]; | |
| 59 | + if (json["union"] < 3) error("Value below minimum"); | |
| 60 | + if (json["union"] > 6) error("Value above maximum"); | |
| 61 | + retval.union = (float)json["union"]; | |
| 62 | + | |
| 63 | + return retval; | |
| 64 | +} |
Test case
1 generated file · +6 −0test/inputs/schema/optional-const-ref.schema
Mschema-pikedefault / TopLevel.pmod+6 −0
| @@ -40,11 +40,17 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 40 | 40 | TopLevel retval = TopLevel(); |
| 41 | 41 | |
| 42 | 42 | retval.coordinates = json["coordinates"]; |
| 43 | + if (has_index(json, "count") && json["count"] < 1) error("Value below minimum"); | |
| 44 | + if (has_index(json, "count") && json["count"] > 100) error("Value above maximum"); | |
| 43 | 45 | retval.count = json["count"]; |
| 44 | 46 | retval.label = json["label"]; |
| 45 | 47 | retval.required_coordinates = json["requiredCoordinates"]; |
| 48 | + if (json["requiredCount"] < 1) error("Value below minimum"); | |
| 49 | + if (json["requiredCount"] > 100) error("Value above maximum"); | |
| 46 | 50 | retval.required_count = json["requiredCount"]; |
| 47 | 51 | retval.required_label = json["requiredLabel"]; |
| 52 | + if (has_index(json, "weight") && json["weight"] < 0.5) error("Value below minimum"); | |
| 53 | + if (has_index(json, "weight") && json["weight"] > 99.5) error("Value above maximum"); | |
| 48 | 54 | retval.weight = json["weight"]; |
| 49 | 55 | |
| 50 | 56 | return retval; |
Test case
1 generated file · +6 −0test/inputs/schema/optional-constraints.schema
Mschema-pikedefault / TopLevel.pmod+6 −0
| @@ -35,10 +35,16 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | + if (has_index(json, "optDouble") && json["optDouble"] < 0.5) error("Value below minimum"); | |
| 39 | + if (has_index(json, "optDouble") && json["optDouble"] > 99.5) error("Value above maximum"); | |
| 38 | 40 | retval.opt_double = json["optDouble"]; |
| 41 | + if (has_index(json, "optInt") && json["optInt"] < 0) error("Value below minimum"); | |
| 42 | + if (has_index(json, "optInt") && json["optInt"] > 100) error("Value above maximum"); | |
| 39 | 43 | retval.opt_int = json["optInt"]; |
| 40 | 44 | retval.opt_pattern = json["optPattern"]; |
| 41 | 45 | retval.opt_string = json["optString"]; |
| 46 | + if (json["reqZeroMin"] < 0) error("Value below minimum"); | |
| 47 | + if (json["reqZeroMin"] > 100) error("Value above maximum"); | |
| 42 | 48 | retval.req_zero_min = json["reqZeroMin"]; |
| 43 | 49 | |
| 44 | 50 | return retval; |
Test case
1 generated file · +2 −0test/inputs/schema/schema-constraints.schema
Mschema-pikedefault / TopLevel.pmod+2 −0
| @@ -30,6 +30,8 @@ TopLevel TopLevel_from_JSON(mixed json) { | ||
| 30 | 30 | TopLevel retval = TopLevel(); |
| 31 | 31 | |
| 32 | 32 | retval.min_max_length = json["minMaxLength"]; |
| 33 | + if (json["percent"] < 0) error("Value below minimum"); | |
| 34 | + if (json["percent"] > 1) error("Value above maximum"); | |
| 33 | 35 | retval.percent = (float)json["percent"]; |
| 34 | 36 | |
| 35 | 37 | return retval; |
Test case
1 generated file · +161 −0test/inputs/schema/vega-lite.schema
Mschema-pikedefault / TopLevel.pmod+161 −0
| @@ -418,6 +418,8 @@ MarkConfig MarkConfig_from_JSON(mixed json) { | ||
| 418 | 418 | MarkConfig retval = MarkConfig(); |
| 419 | 419 | |
| 420 | 420 | retval.align = HorizontalAlign_from_JSON(json["align"]); |
| 421 | + if (has_index(json, "angle") && json["angle"] < 0) error("Value below minimum"); | |
| 422 | + if (has_index(json, "angle") && json["angle"] > 360) error("Value above maximum"); | |
| 421 | 423 | retval.angle = json["angle"]; |
| 422 | 424 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 423 | 425 | retval.color = json["color"]; |
| @@ -426,8 +428,11 @@ MarkConfig MarkConfig_from_JSON(mixed json) { | ||
| 426 | 428 | retval.dy = json["dy"]; |
| 427 | 429 | retval.fill = json["fill"]; |
| 428 | 430 | retval.filled = json["filled"]; |
| 431 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] < 0) error("Value below minimum"); | |
| 432 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] > 1) error("Value above maximum"); | |
| 429 | 433 | retval.fill_opacity = json["fillOpacity"]; |
| 430 | 434 | retval.font = json["font"]; |
| 435 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 431 | 436 | retval.font_size = json["fontSize"]; |
| 432 | 437 | retval.font_style = FontStyle_from_JSON(json["fontStyle"]); |
| 433 | 438 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| @@ -435,16 +440,25 @@ MarkConfig MarkConfig_from_JSON(mixed json) { | ||
| 435 | 440 | retval.href = json["href"]; |
| 436 | 441 | retval.interpolate = Interpolate_from_JSON(json["interpolate"]); |
| 437 | 442 | retval.limit = json["limit"]; |
| 443 | + if (has_index(json, "opacity") && json["opacity"] < 0) error("Value below minimum"); | |
| 444 | + if (has_index(json, "opacity") && json["opacity"] > 1) error("Value above maximum"); | |
| 438 | 445 | retval.opacity = json["opacity"]; |
| 439 | 446 | retval.orient = Orient_from_JSON(json["orient"]); |
| 447 | + if (has_index(json, "radius") && json["radius"] < 0) error("Value below minimum"); | |
| 440 | 448 | retval.radius = json["radius"]; |
| 441 | 449 | retval.shape = json["shape"]; |
| 450 | + if (has_index(json, "size") && json["size"] < 0) error("Value below minimum"); | |
| 442 | 451 | retval.size = json["size"]; |
| 443 | 452 | retval.stroke = json["stroke"]; |
| 444 | 453 | retval.stroke_dash = json["strokeDash"]; |
| 445 | 454 | retval.stroke_dash_offset = json["strokeDashOffset"]; |
| 455 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] < 0) error("Value below minimum"); | |
| 456 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] > 1) error("Value above maximum"); | |
| 446 | 457 | retval.stroke_opacity = json["strokeOpacity"]; |
| 458 | + if (has_index(json, "strokeWidth") && json["strokeWidth"] < 0) error("Value below minimum"); | |
| 447 | 459 | retval.stroke_width = json["strokeWidth"]; |
| 460 | + if (has_index(json, "tension") && json["tension"] < 0) error("Value below minimum"); | |
| 461 | + if (has_index(json, "tension") && json["tension"] > 1) error("Value above maximum"); | |
| 448 | 462 | retval.tension = json["tension"]; |
| 449 | 463 | retval.text = json["text"]; |
| 450 | 464 | retval.theta = json["theta"]; |
| @@ -672,8 +686,13 @@ AxisConfig AxisConfig_from_JSON(mixed json) { | ||
| 672 | 686 | retval.grid = json["grid"]; |
| 673 | 687 | retval.grid_color = json["gridColor"]; |
| 674 | 688 | retval.grid_dash = json["gridDash"]; |
| 689 | + if (has_index(json, "gridOpacity") && json["gridOpacity"] < 0) error("Value below minimum"); | |
| 690 | + if (has_index(json, "gridOpacity") && json["gridOpacity"] > 1) error("Value above maximum"); | |
| 675 | 691 | retval.grid_opacity = json["gridOpacity"]; |
| 692 | + if (has_index(json, "gridWidth") && json["gridWidth"] < 0) error("Value below minimum"); | |
| 676 | 693 | retval.grid_width = json["gridWidth"]; |
| 694 | + if (has_index(json, "labelAngle") && json["labelAngle"] < -360) error("Value below minimum"); | |
| 695 | + if (has_index(json, "labelAngle") && json["labelAngle"] > 360) error("Value above maximum"); | |
| 677 | 696 | retval.label_angle = json["labelAngle"]; |
| 678 | 697 | if (arrayp(json["labelBound"])) error("Unexpected array"); |
| 679 | 698 | retval.label_bound = json["labelBound"]; |
| @@ -681,6 +700,7 @@ AxisConfig AxisConfig_from_JSON(mixed json) { | ||
| 681 | 700 | if (arrayp(json["labelFlush"])) error("Unexpected array"); |
| 682 | 701 | retval.label_flush = json["labelFlush"]; |
| 683 | 702 | retval.label_font = json["labelFont"]; |
| 703 | + if (has_index(json, "labelFontSize") && json["labelFontSize"] < 0) error("Value below minimum"); | |
| 684 | 704 | retval.label_font_size = json["labelFontSize"]; |
| 685 | 705 | retval.label_limit = json["labelLimit"]; |
| 686 | 706 | if (arrayp(json["labelOverlap"])) error("Unexpected array"); |
| @@ -693,13 +713,16 @@ AxisConfig AxisConfig_from_JSON(mixed json) { | ||
| 693 | 713 | retval.tick_color = json["tickColor"]; |
| 694 | 714 | retval.tick_round = json["tickRound"]; |
| 695 | 715 | retval.ticks = json["ticks"]; |
| 716 | + if (has_index(json, "tickSize") && json["tickSize"] < 0) error("Value below minimum"); | |
| 696 | 717 | retval.tick_size = json["tickSize"]; |
| 718 | + if (has_index(json, "tickWidth") && json["tickWidth"] < 0) error("Value below minimum"); | |
| 697 | 719 | retval.tick_width = json["tickWidth"]; |
| 698 | 720 | retval.title_align = json["titleAlign"]; |
| 699 | 721 | retval.title_angle = json["titleAngle"]; |
| 700 | 722 | retval.title_baseline = json["titleBaseline"]; |
| 701 | 723 | retval.title_color = json["titleColor"]; |
| 702 | 724 | retval.title_font = json["titleFont"]; |
| 725 | + if (has_index(json, "titleFontSize") && json["titleFontSize"] < 0) error("Value below minimum"); | |
| 703 | 726 | retval.title_font_size = json["titleFontSize"]; |
| 704 | 727 | if (arrayp(json["titleFontWeight"])) error("Unexpected array"); |
| 705 | 728 | retval.title_font_weight = json["titleFontWeight"]; |
| @@ -868,8 +891,13 @@ VgAxisConfig VgAxisConfig_from_JSON(mixed json) { | ||
| 868 | 891 | retval.grid = json["grid"]; |
| 869 | 892 | retval.grid_color = json["gridColor"]; |
| 870 | 893 | retval.grid_dash = json["gridDash"]; |
| 894 | + if (has_index(json, "gridOpacity") && json["gridOpacity"] < 0) error("Value below minimum"); | |
| 895 | + if (has_index(json, "gridOpacity") && json["gridOpacity"] > 1) error("Value above maximum"); | |
| 871 | 896 | retval.grid_opacity = json["gridOpacity"]; |
| 897 | + if (has_index(json, "gridWidth") && json["gridWidth"] < 0) error("Value below minimum"); | |
| 872 | 898 | retval.grid_width = json["gridWidth"]; |
| 899 | + if (has_index(json, "labelAngle") && json["labelAngle"] < -360) error("Value below minimum"); | |
| 900 | + if (has_index(json, "labelAngle") && json["labelAngle"] > 360) error("Value above maximum"); | |
| 873 | 901 | retval.label_angle = json["labelAngle"]; |
| 874 | 902 | if (arrayp(json["labelBound"])) error("Unexpected array"); |
| 875 | 903 | retval.label_bound = json["labelBound"]; |
| @@ -877,6 +905,7 @@ VgAxisConfig VgAxisConfig_from_JSON(mixed json) { | ||
| 877 | 905 | if (arrayp(json["labelFlush"])) error("Unexpected array"); |
| 878 | 906 | retval.label_flush = json["labelFlush"]; |
| 879 | 907 | retval.label_font = json["labelFont"]; |
| 908 | + if (has_index(json, "labelFontSize") && json["labelFontSize"] < 0) error("Value below minimum"); | |
| 880 | 909 | retval.label_font_size = json["labelFontSize"]; |
| 881 | 910 | retval.label_limit = json["labelLimit"]; |
| 882 | 911 | if (arrayp(json["labelOverlap"])) error("Unexpected array"); |
| @@ -888,13 +917,16 @@ VgAxisConfig VgAxisConfig_from_JSON(mixed json) { | ||
| 888 | 917 | retval.tick_color = json["tickColor"]; |
| 889 | 918 | retval.tick_round = json["tickRound"]; |
| 890 | 919 | retval.ticks = json["ticks"]; |
| 920 | + if (has_index(json, "tickSize") && json["tickSize"] < 0) error("Value below minimum"); | |
| 891 | 921 | retval.tick_size = json["tickSize"]; |
| 922 | + if (has_index(json, "tickWidth") && json["tickWidth"] < 0) error("Value below minimum"); | |
| 892 | 923 | retval.tick_width = json["tickWidth"]; |
| 893 | 924 | retval.title_align = json["titleAlign"]; |
| 894 | 925 | retval.title_angle = json["titleAngle"]; |
| 895 | 926 | retval.title_baseline = json["titleBaseline"]; |
| 896 | 927 | retval.title_color = json["titleColor"]; |
| 897 | 928 | retval.title_font = json["titleFont"]; |
| 929 | + if (has_index(json, "titleFontSize") && json["titleFontSize"] < 0) error("Value below minimum"); | |
| 898 | 930 | retval.title_font_size = json["titleFontSize"]; |
| 899 | 931 | if (arrayp(json["titleFontWeight"])) error("Unexpected array"); |
| 900 | 932 | retval.title_font_weight = json["titleFontWeight"]; |
| @@ -988,19 +1020,27 @@ BarConfig BarConfig_from_JSON(mixed json) { | ||
| 988 | 1020 | BarConfig retval = BarConfig(); |
| 989 | 1021 | |
| 990 | 1022 | retval.align = HorizontalAlign_from_JSON(json["align"]); |
| 1023 | + if (has_index(json, "angle") && json["angle"] < 0) error("Value below minimum"); | |
| 1024 | + if (has_index(json, "angle") && json["angle"] > 360) error("Value above maximum"); | |
| 991 | 1025 | retval.angle = json["angle"]; |
| 992 | 1026 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 1027 | + if (has_index(json, "binSpacing") && json["binSpacing"] < 0) error("Value below minimum"); | |
| 993 | 1028 | retval.bin_spacing = json["binSpacing"]; |
| 994 | 1029 | retval.color = json["color"]; |
| 1030 | + if (has_index(json, "continuousBandSize") && json["continuousBandSize"] < 0) error("Value below minimum"); | |
| 995 | 1031 | retval.continuous_band_size = json["continuousBandSize"]; |
| 996 | 1032 | retval.cursor = Cursor_from_JSON(json["cursor"]); |
| 1033 | + if (has_index(json, "discreteBandSize") && json["discreteBandSize"] < 0) error("Value below minimum"); | |
| 997 | 1034 | retval.discrete_band_size = json["discreteBandSize"]; |
| 998 | 1035 | retval.dx = json["dx"]; |
| 999 | 1036 | retval.dy = json["dy"]; |
| 1000 | 1037 | retval.fill = json["fill"]; |
| 1001 | 1038 | retval.filled = json["filled"]; |
| 1039 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] < 0) error("Value below minimum"); | |
| 1040 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] > 1) error("Value above maximum"); | |
| 1002 | 1041 | retval.fill_opacity = json["fillOpacity"]; |
| 1003 | 1042 | retval.font = json["font"]; |
| 1043 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 1004 | 1044 | retval.font_size = json["fontSize"]; |
| 1005 | 1045 | retval.font_style = FontStyle_from_JSON(json["fontStyle"]); |
| 1006 | 1046 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| @@ -1008,16 +1048,25 @@ BarConfig BarConfig_from_JSON(mixed json) { | ||
| 1008 | 1048 | retval.href = json["href"]; |
| 1009 | 1049 | retval.interpolate = Interpolate_from_JSON(json["interpolate"]); |
| 1010 | 1050 | retval.limit = json["limit"]; |
| 1051 | + if (has_index(json, "opacity") && json["opacity"] < 0) error("Value below minimum"); | |
| 1052 | + if (has_index(json, "opacity") && json["opacity"] > 1) error("Value above maximum"); | |
| 1011 | 1053 | retval.opacity = json["opacity"]; |
| 1012 | 1054 | retval.orient = Orient_from_JSON(json["orient"]); |
| 1055 | + if (has_index(json, "radius") && json["radius"] < 0) error("Value below minimum"); | |
| 1013 | 1056 | retval.radius = json["radius"]; |
| 1014 | 1057 | retval.shape = json["shape"]; |
| 1058 | + if (has_index(json, "size") && json["size"] < 0) error("Value below minimum"); | |
| 1015 | 1059 | retval.size = json["size"]; |
| 1016 | 1060 | retval.stroke = json["stroke"]; |
| 1017 | 1061 | retval.stroke_dash = json["strokeDash"]; |
| 1018 | 1062 | retval.stroke_dash_offset = json["strokeDashOffset"]; |
| 1063 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] < 0) error("Value below minimum"); | |
| 1064 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] > 1) error("Value above maximum"); | |
| 1019 | 1065 | retval.stroke_opacity = json["strokeOpacity"]; |
| 1066 | + if (has_index(json, "strokeWidth") && json["strokeWidth"] < 0) error("Value below minimum"); | |
| 1020 | 1067 | retval.stroke_width = json["strokeWidth"]; |
| 1068 | + if (has_index(json, "tension") && json["tension"] < 0) error("Value below minimum"); | |
| 1069 | + if (has_index(json, "tension") && json["tension"] > 1) error("Value above maximum"); | |
| 1021 | 1070 | retval.tension = json["tension"]; |
| 1022 | 1071 | retval.text = json["text"]; |
| 1023 | 1072 | retval.theta = json["theta"]; |
| @@ -1134,19 +1183,24 @@ LegendConfig LegendConfig_from_JSON(mixed json) { | ||
| 1134 | 1183 | retval.corner_radius = json["cornerRadius"]; |
| 1135 | 1184 | retval.entry_padding = json["entryPadding"]; |
| 1136 | 1185 | retval.fill_color = json["fillColor"]; |
| 1186 | + if (has_index(json, "gradientHeight") && json["gradientHeight"] < 0) error("Value below minimum"); | |
| 1137 | 1187 | retval.gradient_height = json["gradientHeight"]; |
| 1138 | 1188 | retval.gradient_label_baseline = json["gradientLabelBaseline"]; |
| 1139 | 1189 | retval.gradient_label_limit = json["gradientLabelLimit"]; |
| 1140 | 1190 | retval.gradient_label_offset = json["gradientLabelOffset"]; |
| 1141 | 1191 | retval.gradient_stroke_color = json["gradientStrokeColor"]; |
| 1192 | + if (has_index(json, "gradientStrokeWidth") && json["gradientStrokeWidth"] < 0) error("Value below minimum"); | |
| 1142 | 1193 | retval.gradient_stroke_width = json["gradientStrokeWidth"]; |
| 1194 | + if (has_index(json, "gradientWidth") && json["gradientWidth"] < 0) error("Value below minimum"); | |
| 1143 | 1195 | retval.gradient_width = json["gradientWidth"]; |
| 1144 | 1196 | retval.label_align = json["labelAlign"]; |
| 1145 | 1197 | retval.label_baseline = json["labelBaseline"]; |
| 1146 | 1198 | retval.label_color = json["labelColor"]; |
| 1147 | 1199 | retval.label_font = json["labelFont"]; |
| 1200 | + if (has_index(json, "labelFontSize") && json["labelFontSize"] < 0) error("Value below minimum"); | |
| 1148 | 1201 | retval.label_font_size = json["labelFontSize"]; |
| 1149 | 1202 | retval.label_limit = json["labelLimit"]; |
| 1203 | + if (has_index(json, "labelOffset") && json["labelOffset"] < 0) error("Value below minimum"); | |
| 1150 | 1204 | retval.label_offset = json["labelOffset"]; |
| 1151 | 1205 | retval.offset = json["offset"]; |
| 1152 | 1206 | retval.orient = LegendOrient_from_JSON(json["orient"]); |
| @@ -1156,7 +1210,9 @@ LegendConfig LegendConfig_from_JSON(mixed json) { | ||
| 1156 | 1210 | retval.stroke_dash = json["strokeDash"]; |
| 1157 | 1211 | retval.stroke_width = json["strokeWidth"]; |
| 1158 | 1212 | retval.symbol_color = json["symbolColor"]; |
| 1213 | + if (has_index(json, "symbolSize") && json["symbolSize"] < 0) error("Value below minimum"); | |
| 1159 | 1214 | retval.symbol_size = json["symbolSize"]; |
| 1215 | + if (has_index(json, "symbolStrokeWidth") && json["symbolStrokeWidth"] < 0) error("Value below minimum"); | |
| 1160 | 1216 | retval.symbol_stroke_width = json["symbolStrokeWidth"]; |
| 1161 | 1217 | retval.symbol_type = json["symbolType"]; |
| 1162 | 1218 | retval.title_align = json["titleAlign"]; |
| @@ -1413,23 +1469,43 @@ class ScaleConfig { | ||
| 1413 | 1469 | ScaleConfig ScaleConfig_from_JSON(mixed json) { |
| 1414 | 1470 | ScaleConfig retval = ScaleConfig(); |
| 1415 | 1471 | |
| 1472 | + if (has_index(json, "bandPaddingInner") && json["bandPaddingInner"] < 0) error("Value below minimum"); | |
| 1473 | + if (has_index(json, "bandPaddingInner") && json["bandPaddingInner"] > 1) error("Value above maximum"); | |
| 1416 | 1474 | retval.band_padding_inner = json["bandPaddingInner"]; |
| 1475 | + if (has_index(json, "bandPaddingOuter") && json["bandPaddingOuter"] < 0) error("Value below minimum"); | |
| 1476 | + if (has_index(json, "bandPaddingOuter") && json["bandPaddingOuter"] > 1) error("Value above maximum"); | |
| 1417 | 1477 | retval.band_padding_outer = json["bandPaddingOuter"]; |
| 1418 | 1478 | retval.clamp = json["clamp"]; |
| 1479 | + if (has_index(json, "continuousPadding") && json["continuousPadding"] < 0) error("Value below minimum"); | |
| 1419 | 1480 | retval.continuous_padding = json["continuousPadding"]; |
| 1481 | + if (has_index(json, "maxBandSize") && json["maxBandSize"] < 0) error("Value below minimum"); | |
| 1420 | 1482 | retval.max_band_size = json["maxBandSize"]; |
| 1483 | + if (has_index(json, "maxFontSize") && json["maxFontSize"] < 0) error("Value below minimum"); | |
| 1421 | 1484 | retval.max_font_size = json["maxFontSize"]; |
| 1485 | + if (has_index(json, "maxOpacity") && json["maxOpacity"] < 0) error("Value below minimum"); | |
| 1486 | + if (has_index(json, "maxOpacity") && json["maxOpacity"] > 1) error("Value above maximum"); | |
| 1422 | 1487 | retval.max_opacity = json["maxOpacity"]; |
| 1488 | + if (has_index(json, "maxSize") && json["maxSize"] < 0) error("Value below minimum"); | |
| 1423 | 1489 | retval.max_size = json["maxSize"]; |
| 1490 | + if (has_index(json, "maxStrokeWidth") && json["maxStrokeWidth"] < 0) error("Value below minimum"); | |
| 1424 | 1491 | retval.max_stroke_width = json["maxStrokeWidth"]; |
| 1492 | + if (has_index(json, "minBandSize") && json["minBandSize"] < 0) error("Value below minimum"); | |
| 1425 | 1493 | retval.min_band_size = json["minBandSize"]; |
| 1494 | + if (has_index(json, "minFontSize") && json["minFontSize"] < 0) error("Value below minimum"); | |
| 1426 | 1495 | retval.min_font_size = json["minFontSize"]; |
| 1496 | + if (has_index(json, "minOpacity") && json["minOpacity"] < 0) error("Value below minimum"); | |
| 1497 | + if (has_index(json, "minOpacity") && json["minOpacity"] > 1) error("Value above maximum"); | |
| 1427 | 1498 | retval.min_opacity = json["minOpacity"]; |
| 1499 | + if (has_index(json, "minSize") && json["minSize"] < 0) error("Value below minimum"); | |
| 1428 | 1500 | retval.min_size = json["minSize"]; |
| 1501 | + if (has_index(json, "minStrokeWidth") && json["minStrokeWidth"] < 0) error("Value below minimum"); | |
| 1429 | 1502 | retval.min_stroke_width = json["minStrokeWidth"]; |
| 1503 | + if (has_index(json, "pointPadding") && json["pointPadding"] < 0) error("Value below minimum"); | |
| 1504 | + if (has_index(json, "pointPadding") && json["pointPadding"] > 1) error("Value above maximum"); | |
| 1430 | 1505 | retval.point_padding = json["pointPadding"]; |
| 1431 | 1506 | retval.range_step = json["rangeStep"]; |
| 1432 | 1507 | retval.round = json["round"]; |
| 1508 | + if (has_index(json, "textXRangeStep") && json["textXRangeStep"] < 0) error("Value below minimum"); | |
| 1433 | 1509 | retval.text_x_range_step = json["textXRangeStep"]; |
| 1434 | 1510 | retval.use_unaggregated_domain = json["useUnaggregatedDomain"]; |
| 1435 | 1511 | |
| @@ -1842,14 +1918,19 @@ VgMarkConfig VgMarkConfig_from_JSON(mixed json) { | ||
| 1842 | 1918 | VgMarkConfig retval = VgMarkConfig(); |
| 1843 | 1919 | |
| 1844 | 1920 | retval.align = HorizontalAlign_from_JSON(json["align"]); |
| 1921 | + if (has_index(json, "angle") && json["angle"] < 0) error("Value below minimum"); | |
| 1922 | + if (has_index(json, "angle") && json["angle"] > 360) error("Value above maximum"); | |
| 1845 | 1923 | retval.angle = json["angle"]; |
| 1846 | 1924 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 1847 | 1925 | retval.cursor = Cursor_from_JSON(json["cursor"]); |
| 1848 | 1926 | retval.dx = json["dx"]; |
| 1849 | 1927 | retval.dy = json["dy"]; |
| 1850 | 1928 | retval.fill = json["fill"]; |
| 1929 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] < 0) error("Value below minimum"); | |
| 1930 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] > 1) error("Value above maximum"); | |
| 1851 | 1931 | retval.fill_opacity = json["fillOpacity"]; |
| 1852 | 1932 | retval.font = json["font"]; |
| 1933 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 1853 | 1934 | retval.font_size = json["fontSize"]; |
| 1854 | 1935 | retval.font_style = FontStyle_from_JSON(json["fontStyle"]); |
| 1855 | 1936 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| @@ -1857,16 +1938,25 @@ VgMarkConfig VgMarkConfig_from_JSON(mixed json) { | ||
| 1857 | 1938 | retval.href = json["href"]; |
| 1858 | 1939 | retval.interpolate = Interpolate_from_JSON(json["interpolate"]); |
| 1859 | 1940 | retval.limit = json["limit"]; |
| 1941 | + if (has_index(json, "opacity") && json["opacity"] < 0) error("Value below minimum"); | |
| 1942 | + if (has_index(json, "opacity") && json["opacity"] > 1) error("Value above maximum"); | |
| 1860 | 1943 | retval.opacity = json["opacity"]; |
| 1861 | 1944 | retval.orient = Orient_from_JSON(json["orient"]); |
| 1945 | + if (has_index(json, "radius") && json["radius"] < 0) error("Value below minimum"); | |
| 1862 | 1946 | retval.radius = json["radius"]; |
| 1863 | 1947 | retval.shape = json["shape"]; |
| 1948 | + if (has_index(json, "size") && json["size"] < 0) error("Value below minimum"); | |
| 1864 | 1949 | retval.size = json["size"]; |
| 1865 | 1950 | retval.stroke = json["stroke"]; |
| 1866 | 1951 | retval.stroke_dash = json["strokeDash"]; |
| 1867 | 1952 | retval.stroke_dash_offset = json["strokeDashOffset"]; |
| 1953 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] < 0) error("Value below minimum"); | |
| 1954 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] > 1) error("Value above maximum"); | |
| 1868 | 1955 | retval.stroke_opacity = json["strokeOpacity"]; |
| 1956 | + if (has_index(json, "strokeWidth") && json["strokeWidth"] < 0) error("Value below minimum"); | |
| 1869 | 1957 | retval.stroke_width = json["strokeWidth"]; |
| 1958 | + if (has_index(json, "tension") && json["tension"] < 0) error("Value below minimum"); | |
| 1959 | + if (has_index(json, "tension") && json["tension"] > 1) error("Value above maximum"); | |
| 1870 | 1960 | retval.tension = json["tension"]; |
| 1871 | 1961 | retval.text = json["text"]; |
| 1872 | 1962 | retval.theta = json["theta"]; |
| @@ -1951,6 +2041,8 @@ TextConfig TextConfig_from_JSON(mixed json) { | ||
| 1951 | 2041 | TextConfig retval = TextConfig(); |
| 1952 | 2042 | |
| 1953 | 2043 | retval.align = HorizontalAlign_from_JSON(json["align"]); |
| 2044 | + if (has_index(json, "angle") && json["angle"] < 0) error("Value below minimum"); | |
| 2045 | + if (has_index(json, "angle") && json["angle"] > 360) error("Value above maximum"); | |
| 1954 | 2046 | retval.angle = json["angle"]; |
| 1955 | 2047 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 1956 | 2048 | retval.color = json["color"]; |
| @@ -1959,8 +2051,11 @@ TextConfig TextConfig_from_JSON(mixed json) { | ||
| 1959 | 2051 | retval.dy = json["dy"]; |
| 1960 | 2052 | retval.fill = json["fill"]; |
| 1961 | 2053 | retval.filled = json["filled"]; |
| 2054 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] < 0) error("Value below minimum"); | |
| 2055 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] > 1) error("Value above maximum"); | |
| 1962 | 2056 | retval.fill_opacity = json["fillOpacity"]; |
| 1963 | 2057 | retval.font = json["font"]; |
| 2058 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 1964 | 2059 | retval.font_size = json["fontSize"]; |
| 1965 | 2060 | retval.font_style = FontStyle_from_JSON(json["fontStyle"]); |
| 1966 | 2061 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| @@ -1968,17 +2063,26 @@ TextConfig TextConfig_from_JSON(mixed json) { | ||
| 1968 | 2063 | retval.href = json["href"]; |
| 1969 | 2064 | retval.interpolate = Interpolate_from_JSON(json["interpolate"]); |
| 1970 | 2065 | retval.limit = json["limit"]; |
| 2066 | + if (has_index(json, "opacity") && json["opacity"] < 0) error("Value below minimum"); | |
| 2067 | + if (has_index(json, "opacity") && json["opacity"] > 1) error("Value above maximum"); | |
| 1971 | 2068 | retval.opacity = json["opacity"]; |
| 1972 | 2069 | retval.orient = Orient_from_JSON(json["orient"]); |
| 2070 | + if (has_index(json, "radius") && json["radius"] < 0) error("Value below minimum"); | |
| 1973 | 2071 | retval.radius = json["radius"]; |
| 1974 | 2072 | retval.shape = json["shape"]; |
| 1975 | 2073 | retval.short_time_labels = json["shortTimeLabels"]; |
| 2074 | + if (has_index(json, "size") && json["size"] < 0) error("Value below minimum"); | |
| 1976 | 2075 | retval.size = json["size"]; |
| 1977 | 2076 | retval.stroke = json["stroke"]; |
| 1978 | 2077 | retval.stroke_dash = json["strokeDash"]; |
| 1979 | 2078 | retval.stroke_dash_offset = json["strokeDashOffset"]; |
| 2079 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] < 0) error("Value below minimum"); | |
| 2080 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] > 1) error("Value above maximum"); | |
| 1980 | 2081 | retval.stroke_opacity = json["strokeOpacity"]; |
| 2082 | + if (has_index(json, "strokeWidth") && json["strokeWidth"] < 0) error("Value below minimum"); | |
| 1981 | 2083 | retval.stroke_width = json["strokeWidth"]; |
| 2084 | + if (has_index(json, "tension") && json["tension"] < 0) error("Value below minimum"); | |
| 2085 | + if (has_index(json, "tension") && json["tension"] > 1) error("Value above maximum"); | |
| 1982 | 2086 | retval.tension = json["tension"]; |
| 1983 | 2087 | retval.text = json["text"]; |
| 1984 | 2088 | retval.theta = json["theta"]; |
| @@ -2065,7 +2169,10 @@ TickConfig TickConfig_from_JSON(mixed json) { | ||
| 2065 | 2169 | TickConfig retval = TickConfig(); |
| 2066 | 2170 | |
| 2067 | 2171 | retval.align = HorizontalAlign_from_JSON(json["align"]); |
| 2172 | + if (has_index(json, "angle") && json["angle"] < 0) error("Value below minimum"); | |
| 2173 | + if (has_index(json, "angle") && json["angle"] > 360) error("Value above maximum"); | |
| 2068 | 2174 | retval.angle = json["angle"]; |
| 2175 | + if (has_index(json, "bandSize") && json["bandSize"] < 0) error("Value below minimum"); | |
| 2069 | 2176 | retval.band_size = json["bandSize"]; |
| 2070 | 2177 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 2071 | 2178 | retval.color = json["color"]; |
| @@ -2074,8 +2181,11 @@ TickConfig TickConfig_from_JSON(mixed json) { | ||
| 2074 | 2181 | retval.dy = json["dy"]; |
| 2075 | 2182 | retval.fill = json["fill"]; |
| 2076 | 2183 | retval.filled = json["filled"]; |
| 2184 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] < 0) error("Value below minimum"); | |
| 2185 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] > 1) error("Value above maximum"); | |
| 2077 | 2186 | retval.fill_opacity = json["fillOpacity"]; |
| 2078 | 2187 | retval.font = json["font"]; |
| 2188 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 2079 | 2189 | retval.font_size = json["fontSize"]; |
| 2080 | 2190 | retval.font_style = FontStyle_from_JSON(json["fontStyle"]); |
| 2081 | 2191 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| @@ -2083,19 +2193,29 @@ TickConfig TickConfig_from_JSON(mixed json) { | ||
| 2083 | 2193 | retval.href = json["href"]; |
| 2084 | 2194 | retval.interpolate = Interpolate_from_JSON(json["interpolate"]); |
| 2085 | 2195 | retval.limit = json["limit"]; |
| 2196 | + if (has_index(json, "opacity") && json["opacity"] < 0) error("Value below minimum"); | |
| 2197 | + if (has_index(json, "opacity") && json["opacity"] > 1) error("Value above maximum"); | |
| 2086 | 2198 | retval.opacity = json["opacity"]; |
| 2087 | 2199 | retval.orient = Orient_from_JSON(json["orient"]); |
| 2200 | + if (has_index(json, "radius") && json["radius"] < 0) error("Value below minimum"); | |
| 2088 | 2201 | retval.radius = json["radius"]; |
| 2089 | 2202 | retval.shape = json["shape"]; |
| 2203 | + if (has_index(json, "size") && json["size"] < 0) error("Value below minimum"); | |
| 2090 | 2204 | retval.size = json["size"]; |
| 2091 | 2205 | retval.stroke = json["stroke"]; |
| 2092 | 2206 | retval.stroke_dash = json["strokeDash"]; |
| 2093 | 2207 | retval.stroke_dash_offset = json["strokeDashOffset"]; |
| 2208 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] < 0) error("Value below minimum"); | |
| 2209 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] > 1) error("Value above maximum"); | |
| 2094 | 2210 | retval.stroke_opacity = json["strokeOpacity"]; |
| 2211 | + if (has_index(json, "strokeWidth") && json["strokeWidth"] < 0) error("Value below minimum"); | |
| 2095 | 2212 | retval.stroke_width = json["strokeWidth"]; |
| 2213 | + if (has_index(json, "tension") && json["tension"] < 0) error("Value below minimum"); | |
| 2214 | + if (has_index(json, "tension") && json["tension"] > 1) error("Value above maximum"); | |
| 2096 | 2215 | retval.tension = json["tension"]; |
| 2097 | 2216 | retval.text = json["text"]; |
| 2098 | 2217 | retval.theta = json["theta"]; |
| 2218 | + if (has_index(json, "thickness") && json["thickness"] < 0) error("Value below minimum"); | |
| 2099 | 2219 | retval.thickness = json["thickness"]; |
| 2100 | 2220 | |
| 2101 | 2221 | return retval; |
| @@ -2142,9 +2262,11 @@ VgTitleConfig VgTitleConfig_from_JSON(mixed json) { | ||
| 2142 | 2262 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 2143 | 2263 | retval.color = json["color"]; |
| 2144 | 2264 | retval.font = json["font"]; |
| 2265 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 2145 | 2266 | retval.font_size = json["fontSize"]; |
| 2146 | 2267 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| 2147 | 2268 | retval.font_weight = json["fontWeight"]; |
| 2269 | + if (has_index(json, "limit") && json["limit"] < 0) error("Value below minimum"); | |
| 2148 | 2270 | retval.limit = json["limit"]; |
| 2149 | 2271 | retval.offset = json["offset"]; |
| 2150 | 2272 | retval.orient = TitleOrient_from_JSON(json["orient"]); |
| @@ -2570,6 +2692,7 @@ BinParams BinParams_from_JSON(mixed json) { | ||
| 2570 | 2692 | retval.base = json["base"]; |
| 2571 | 2693 | retval.divide = json["divide"]; |
| 2572 | 2694 | retval.extent = json["extent"]; |
| 2695 | + if (has_index(json, "maxbins") && json["maxbins"] < 2) error("Value below minimum"); | |
| 2573 | 2696 | retval.maxbins = json["maxbins"]; |
| 2574 | 2697 | retval.minstep = json["minstep"]; |
| 2575 | 2698 | retval.nice = json["nice"]; |
| @@ -2780,15 +2903,27 @@ class DateTime { | ||
| 2780 | 2903 | DateTime DateTime_from_JSON(mixed json) { |
| 2781 | 2904 | DateTime retval = DateTime(); |
| 2782 | 2905 | |
| 2906 | + if (has_index(json, "date") && json["date"] < 1) error("Value below minimum"); | |
| 2907 | + if (has_index(json, "date") && json["date"] > 31) error("Value above maximum"); | |
| 2783 | 2908 | retval.date = json["date"]; |
| 2784 | 2909 | if (arrayp(json["day"])) error("Unexpected array"); |
| 2785 | 2910 | retval.day = json["day"]; |
| 2911 | + if (has_index(json, "hours") && json["hours"] < 0) error("Value below minimum"); | |
| 2912 | + if (has_index(json, "hours") && json["hours"] > 23) error("Value above maximum"); | |
| 2786 | 2913 | retval.hours = json["hours"]; |
| 2914 | + if (has_index(json, "milliseconds") && json["milliseconds"] < 0) error("Value below minimum"); | |
| 2915 | + if (has_index(json, "milliseconds") && json["milliseconds"] > 999) error("Value above maximum"); | |
| 2787 | 2916 | retval.milliseconds = json["milliseconds"]; |
| 2917 | + if (has_index(json, "minutes") && json["minutes"] < 0) error("Value below minimum"); | |
| 2918 | + if (has_index(json, "minutes") && json["minutes"] > 59) error("Value above maximum"); | |
| 2788 | 2919 | retval.minutes = json["minutes"]; |
| 2789 | 2920 | if (arrayp(json["month"])) error("Unexpected array"); |
| 2790 | 2921 | retval.month = json["month"]; |
| 2922 | + if (has_index(json, "quarter") && json["quarter"] < 1) error("Value below minimum"); | |
| 2923 | + if (has_index(json, "quarter") && json["quarter"] > 4) error("Value above maximum"); | |
| 2791 | 2924 | retval.quarter = json["quarter"]; |
| 2925 | + if (has_index(json, "seconds") && json["seconds"] < 0) error("Value below minimum"); | |
| 2926 | + if (has_index(json, "seconds") && json["seconds"] > 59) error("Value above maximum"); | |
| 2792 | 2927 | retval.seconds = json["seconds"]; |
| 2793 | 2928 | retval.utc = json["utc"]; |
| 2794 | 2929 | retval.year = json["year"]; |
| @@ -3027,6 +3162,7 @@ Legend Legend_from_JSON(mixed json) { | ||
| 3027 | 3162 | retval.title = json["title"]; |
| 3028 | 3163 | retval.type = LegendType_from_JSON(json["type"]); |
| 3029 | 3164 | retval.values = json["values"]; |
| 3165 | + if (has_index(json, "zindex") && json["zindex"] < 0) error("Value below minimum"); | |
| 3030 | 3166 | retval.zindex = json["zindex"]; |
| 3031 | 3167 | |
| 3032 | 3168 | return retval; |
| @@ -3103,8 +3239,13 @@ Scale Scale_from_JSON(mixed json) { | ||
| 3103 | 3239 | retval.interpolate = json["interpolate"]; |
| 3104 | 3240 | if (arrayp(json["nice"])) error("Unexpected array"); |
| 3105 | 3241 | retval.nice = json["nice"]; |
| 3242 | + if (has_index(json, "padding") && json["padding"] < 0) error("Value below minimum"); | |
| 3106 | 3243 | retval.padding = json["padding"]; |
| 3244 | + if (has_index(json, "paddingInner") && json["paddingInner"] < 0) error("Value below minimum"); | |
| 3245 | + if (has_index(json, "paddingInner") && json["paddingInner"] > 1) error("Value above maximum"); | |
| 3107 | 3246 | retval.padding_inner = json["paddingInner"]; |
| 3247 | + if (has_index(json, "paddingOuter") && json["paddingOuter"] < 0) error("Value below minimum"); | |
| 3248 | + if (has_index(json, "paddingOuter") && json["paddingOuter"] > 1) error("Value above maximum"); | |
| 3108 | 3249 | retval.padding_outer = json["paddingOuter"]; |
| 3109 | 3250 | retval.range = json["range"]; |
| 3110 | 3251 | retval.range_step = json["rangeStep"]; |
| @@ -3505,6 +3646,8 @@ Header Header_from_JSON(mixed json) { | ||
| 3505 | 3646 | Header retval = Header(); |
| 3506 | 3647 | |
| 3507 | 3648 | retval.format = json["format"]; |
| 3649 | + if (has_index(json, "labelAngle") && json["labelAngle"] < -360) error("Value below minimum"); | |
| 3650 | + if (has_index(json, "labelAngle") && json["labelAngle"] > 360) error("Value above maximum"); | |
| 3508 | 3651 | retval.label_angle = json["labelAngle"]; |
| 3509 | 3652 | retval.title = json["title"]; |
| 3510 | 3653 | |
| @@ -3935,6 +4078,8 @@ Axis Axis_from_JSON(mixed json) { | ||
| 3935 | 4078 | retval.domain = json["domain"]; |
| 3936 | 4079 | retval.format = json["format"]; |
| 3937 | 4080 | retval.grid = json["grid"]; |
| 4081 | + if (has_index(json, "labelAngle") && json["labelAngle"] < -360) error("Value below minimum"); | |
| 4082 | + if (has_index(json, "labelAngle") && json["labelAngle"] > 360) error("Value above maximum"); | |
| 3938 | 4083 | retval.label_angle = json["labelAngle"]; |
| 3939 | 4084 | if (arrayp(json["labelBound"])) error("Unexpected array"); |
| 3940 | 4085 | retval.label_bound = json["labelBound"]; |
| @@ -3951,11 +4096,13 @@ Axis Axis_from_JSON(mixed json) { | ||
| 3951 | 4096 | retval.position = json["position"]; |
| 3952 | 4097 | retval.tick_count = json["tickCount"]; |
| 3953 | 4098 | retval.ticks = json["ticks"]; |
| 4099 | + if (has_index(json, "tickSize") && json["tickSize"] < 0) error("Value below minimum"); | |
| 3954 | 4100 | retval.tick_size = json["tickSize"]; |
| 3955 | 4101 | retval.title = json["title"]; |
| 3956 | 4102 | retval.title_max_length = json["titleMaxLength"]; |
| 3957 | 4103 | retval.title_padding = json["titlePadding"]; |
| 3958 | 4104 | retval.values = json["values"]; |
| 4105 | + if (has_index(json, "zindex") && json["zindex"] < 0) error("Value below minimum"); | |
| 3959 | 4106 | retval.zindex = json["zindex"]; |
| 3960 | 4107 | |
| 3961 | 4108 | return retval; |
| @@ -4341,6 +4488,8 @@ MarkDef MarkDef_from_JSON(mixed json) { | ||
| 4341 | 4488 | MarkDef retval = MarkDef(); |
| 4342 | 4489 | |
| 4343 | 4490 | retval.align = HorizontalAlign_from_JSON(json["align"]); |
| 4491 | + if (has_index(json, "angle") && json["angle"] < 0) error("Value below minimum"); | |
| 4492 | + if (has_index(json, "angle") && json["angle"] > 360) error("Value above maximum"); | |
| 4344 | 4493 | retval.angle = json["angle"]; |
| 4345 | 4494 | retval.baseline = VerticalAlign_from_JSON(json["baseline"]); |
| 4346 | 4495 | retval.clip = json["clip"]; |
| @@ -4350,8 +4499,11 @@ MarkDef MarkDef_from_JSON(mixed json) { | ||
| 4350 | 4499 | retval.dy = json["dy"]; |
| 4351 | 4500 | retval.fill = json["fill"]; |
| 4352 | 4501 | retval.filled = json["filled"]; |
| 4502 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] < 0) error("Value below minimum"); | |
| 4503 | + if (has_index(json, "fillOpacity") && json["fillOpacity"] > 1) error("Value above maximum"); | |
| 4353 | 4504 | retval.fill_opacity = json["fillOpacity"]; |
| 4354 | 4505 | retval.font = json["font"]; |
| 4506 | + if (has_index(json, "fontSize") && json["fontSize"] < 0) error("Value below minimum"); | |
| 4355 | 4507 | retval.font_size = json["fontSize"]; |
| 4356 | 4508 | retval.font_style = FontStyle_from_JSON(json["fontStyle"]); |
| 4357 | 4509 | if (arrayp(json["fontWeight"])) error("Unexpected array"); |
| @@ -4359,17 +4511,26 @@ MarkDef MarkDef_from_JSON(mixed json) { | ||
| 4359 | 4511 | retval.href = json["href"]; |
| 4360 | 4512 | retval.interpolate = Interpolate_from_JSON(json["interpolate"]); |
| 4361 | 4513 | retval.limit = json["limit"]; |
| 4514 | + if (has_index(json, "opacity") && json["opacity"] < 0) error("Value below minimum"); | |
| 4515 | + if (has_index(json, "opacity") && json["opacity"] > 1) error("Value above maximum"); | |
| 4362 | 4516 | retval.opacity = json["opacity"]; |
| 4363 | 4517 | retval.orient = Orient_from_JSON(json["orient"]); |
| 4518 | + if (has_index(json, "radius") && json["radius"] < 0) error("Value below minimum"); | |
| 4364 | 4519 | retval.radius = json["radius"]; |
| 4365 | 4520 | retval.shape = json["shape"]; |
| 4521 | + if (has_index(json, "size") && json["size"] < 0) error("Value below minimum"); | |
| 4366 | 4522 | retval.size = json["size"]; |
| 4367 | 4523 | retval.stroke = json["stroke"]; |
| 4368 | 4524 | retval.stroke_dash = json["strokeDash"]; |
| 4369 | 4525 | retval.stroke_dash_offset = json["strokeDashOffset"]; |
| 4526 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] < 0) error("Value below minimum"); | |
| 4527 | + if (has_index(json, "strokeOpacity") && json["strokeOpacity"] > 1) error("Value above maximum"); | |
| 4370 | 4528 | retval.stroke_opacity = json["strokeOpacity"]; |
| 4529 | + if (has_index(json, "strokeWidth") && json["strokeWidth"] < 0) error("Value below minimum"); | |
| 4371 | 4530 | retval.stroke_width = json["strokeWidth"]; |
| 4372 | 4531 | retval.style = json["style"]; |
| 4532 | + if (has_index(json, "tension") && json["tension"] < 0) error("Value below minimum"); | |
| 4533 | + if (has_index(json, "tension") && json["tension"] > 1) error("Value above maximum"); | |
| 4373 | 4534 | retval.tension = json["tension"]; |
| 4374 | 4535 | retval.text = json["text"]; |
| 4375 | 4536 | retval.theta = json["theta"]; |
No generated files match these filters.