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
| @@ -2636,13 +2636,17 @@ BinParams BinParams_from_JSON(mixed json) { | ||
| 2636 | 2636 | BinParams retval = BinParams(); |
| 2637 | 2637 | |
| 2638 | 2638 | retval.base = json["base"]; |
| 2639 | + if (has_index(json, "divide") && sizeof(json["divide"]) < 1) error("Array too short"); | |
| 2639 | 2640 | retval.divide = json["divide"]; |
| 2641 | + if (has_index(json, "extent") && sizeof(json["extent"]) < 2) error("Array too short"); | |
| 2642 | + if (has_index(json, "extent") && sizeof(json["extent"]) > 2) error("Array too long"); | |
| 2640 | 2643 | retval.extent = json["extent"]; |
| 2641 | 2644 | if (has_index(json, "maxbins") && json["maxbins"] < 2) error("Value below minimum"); |
| 2642 | 2645 | retval.maxbins = json["maxbins"]; |
| 2643 | 2646 | retval.minstep = json["minstep"]; |
| 2644 | 2647 | retval.nice = json["nice"]; |
| 2645 | 2648 | retval.step = json["step"]; |
| 2649 | + if (has_index(json, "steps") && sizeof(json["steps"]) < 1) error("Array too short"); | |
| 2646 | 2650 | retval.steps = json["steps"]; |
| 2647 | 2651 | |
| 2648 | 2652 | return retval; |
| @@ -2783,6 +2787,8 @@ Predicate Predicate_from_JSON(mixed json) { | ||
| 2783 | 2787 | retval.equal = json["equal"]; |
| 2784 | 2788 | retval.field = json["field"]; |
| 2785 | 2789 | retval.time_unit = TimeUnit_from_JSON(json["timeUnit"]); |
| 2790 | + if (has_index(json, "range") && sizeof(json["range"]) < 2) error("Array too short"); | |
| 2791 | + if (has_index(json, "range") && sizeof(json["range"]) > 2) error("Array too long"); | |
| 2786 | 2792 | retval.range = json["range"]; |
| 2787 | 2793 | retval.one_of = json["oneOf"]; |
| 2788 | 2794 | if (arrayp(json["selection"])) error("Unexpected array"); |
No generated files match these filters.