Test case
1 generated file · +5 −0test/inputs/schema/min-max-items.schema
Mschema-pikedefault / TopLevel.pmod+5 −0
| @@ -35,10 +35,15 @@ class TopLevel { | ||
| 35 | 35 | TopLevel TopLevel_from_JSON(mixed json) { |
| 36 | 36 | TopLevel retval = TopLevel(); |
| 37 | 37 | |
| 38 | + if (sizeof(json["maxOnly"]) > 3) error("Array too long"); | |
| 38 | 39 | retval.max_only = json["maxOnly"]; |
| 40 | + if (sizeof(json["minAndMax"]) < 1) error("Array too short"); | |
| 41 | + if (sizeof(json["minAndMax"]) > 4) error("Array too long"); | |
| 39 | 42 | retval.min_and_max = json["minAndMax"]; |
| 43 | + if (sizeof(json["minOnly"]) < 2) error("Array too short"); | |
| 40 | 44 | retval.min_only = json["minOnly"]; |
| 41 | 45 | retval.plain = json["plain"]; |
| 46 | + if (sizeof(json["unionItems"]) < 2) error("Array too short"); | |
| 42 | 47 | retval.union_items = json["unionItems"]; |
| 43 | 48 | |
| 44 | 49 | return retval; |
Test case
1 generated file · +6 −0test/inputs/schema/vega-lite.schema
Mschema-pikedefault / TopLevel.pmod+6 −0
| @@ -2690,13 +2690,17 @@ BinParams BinParams_from_JSON(mixed json) { | ||
| 2690 | 2690 | BinParams retval = BinParams(); |
| 2691 | 2691 | |
| 2692 | 2692 | retval.base = json["base"]; |
| 2693 | + if (has_index(json, "divide") && sizeof(json["divide"]) < 1) error("Array too short"); | |
| 2693 | 2694 | retval.divide = json["divide"]; |
| 2695 | + if (has_index(json, "extent") && sizeof(json["extent"]) < 2) error("Array too short"); | |
| 2696 | + if (has_index(json, "extent") && sizeof(json["extent"]) > 2) error("Array too long"); | |
| 2694 | 2697 | retval.extent = json["extent"]; |
| 2695 | 2698 | if (has_index(json, "maxbins") && json["maxbins"] < 2) error("Value below minimum"); |
| 2696 | 2699 | retval.maxbins = json["maxbins"]; |
| 2697 | 2700 | retval.minstep = json["minstep"]; |
| 2698 | 2701 | retval.nice = json["nice"]; |
| 2699 | 2702 | retval.step = json["step"]; |
| 2703 | + if (has_index(json, "steps") && sizeof(json["steps"]) < 1) error("Array too short"); | |
| 2700 | 2704 | retval.steps = json["steps"]; |
| 2701 | 2705 | |
| 2702 | 2706 | return retval; |
| @@ -2837,6 +2841,8 @@ Predicate Predicate_from_JSON(mixed json) { | ||
| 2837 | 2841 | retval.equal = json["equal"]; |
| 2838 | 2842 | retval.field = json["field"]; |
| 2839 | 2843 | retval.time_unit = TimeUnit_from_JSON(json["timeUnit"]); |
| 2844 | + if (has_index(json, "range") && sizeof(json["range"]) < 2) error("Array too short"); | |
| 2845 | + if (has_index(json, "range") && sizeof(json["range"]) > 2) error("Array too long"); | |
| 2840 | 2846 | retval.range = json["range"]; |
| 2841 | 2847 | retval.one_of = json["oneOf"]; |
| 2842 | 2848 | if (arrayp(json["selection"])) error("Unexpected array"); |
No generated files match these filters.