Test case
1 generated file · +8 −8test/inputs/schema/integer-type.schema
Mschema-rubydefault / TopLevel.rb+8 −8
| @@ -20,14 +20,14 @@ module Types | ||
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | - attribute :above_i32_max, Types::Integer | |
| 24 | - attribute :below_i32_min, Types::Integer | |
| 25 | - attribute :i32_range, Types::Integer | |
| 26 | - attribute :large_bounds, Types::Integer | |
| 27 | - attribute :only_maximum, Types::Integer | |
| 28 | - attribute :only_minimum, Types::Integer | |
| 29 | - attribute :small_negative, Types::Integer | |
| 30 | - attribute :small_positive, Types::Integer | |
| 23 | + attribute :above_i32_max, Types::Integer.constrained(gteq: 0, lteq: 2147483648) | |
| 24 | + attribute :below_i32_min, Types::Integer.constrained(gteq: -2147483649, lteq: 0) | |
| 25 | + attribute :i32_range, Types::Integer.constrained(gteq: -2147483648, lteq: 2147483647) | |
| 26 | + attribute :large_bounds, Types::Integer.constrained(gteq: -9007199254740991, lteq: 9007199254740991) | |
| 27 | + attribute :only_maximum, Types::Integer.constrained(lteq: 0) | |
| 28 | + attribute :only_minimum, Types::Integer.constrained(gteq: 0) | |
| 29 | + attribute :small_negative, Types::Integer.constrained(gteq: -100, lteq: 0) | |
| 30 | + attribute :small_positive, Types::Integer.constrained(gteq: 0, lteq: 100) | |
| 31 | 31 | attribute :unbounded, Types::Integer |
| 32 | 32 | |
| 33 | 33 | def self.from_dynamic!(d) |
Test case
1 generated file · +6 −6test/inputs/schema/minmax-integer.schema
Mschema-rubydefault / TopLevel.rb+6 −6
| @@ -21,13 +21,13 @@ end | ||
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | 23 | attribute :free, Types::Integer |
| 24 | - attribute :intersection, Types::Integer | |
| 25 | - attribute :max, Types::Integer | |
| 26 | - attribute :min, Types::Integer | |
| 27 | - attribute :minmax, Types::Integer | |
| 28 | - attribute :min_max_intersection, Types::Integer | |
| 24 | + attribute :intersection, Types::Integer.constrained(gteq: 4, lteq: 5) | |
| 25 | + attribute :max, Types::Integer.constrained(lteq: 5) | |
| 26 | + attribute :min, Types::Integer.constrained(gteq: 3) | |
| 27 | + attribute :minmax, Types::Integer.constrained(gteq: 3, lteq: 5) | |
| 28 | + attribute :min_max_intersection, Types::Integer.constrained(gteq: 3, lteq: 5) | |
| 29 | 29 | attribute :min_max_union, Types::Integer |
| 30 | - attribute :union, Types::Integer | |
| 30 | + attribute :union, Types::Integer.constrained(gteq: 3, lteq: 6) | |
| 31 | 31 | |
| 32 | 32 | def self.from_dynamic!(d) |
| 33 | 33 | d = Types::Hash[d] |
Test case
1 generated file · +6 −6test/inputs/schema/minmax.schema
Mschema-rubydefault / TopLevel.rb+6 −6
| @@ -21,13 +21,13 @@ end | ||
| 21 | 21 | |
| 22 | 22 | class TopLevel < Dry::Struct |
| 23 | 23 | attribute :free, Types::Double |
| 24 | - attribute :intersection, Types::Double | |
| 25 | - attribute :max, Types::Double | |
| 26 | - attribute :min, Types::Double | |
| 27 | - attribute :minmax, Types::Double | |
| 28 | - attribute :min_max_intersection, Types::Double | |
| 24 | + attribute :intersection, Types::Double.constrained(gteq: 4, lteq: 5) | |
| 25 | + attribute :max, Types::Double.constrained(lteq: 5) | |
| 26 | + attribute :min, Types::Double.constrained(gteq: 3) | |
| 27 | + attribute :minmax, Types::Double.constrained(gteq: 3, lteq: 5) | |
| 28 | + attribute :min_max_intersection, Types::Double.constrained(gteq: 3, lteq: 5) | |
| 29 | 29 | attribute :min_max_union, Types::Double |
| 30 | - attribute :union, Types::Double | |
| 30 | + attribute :union, Types::Double.constrained(gteq: 3, lteq: 6) | |
| 31 | 31 | |
| 32 | 32 | def self.from_dynamic!(d) |
| 33 | 33 | d = Types::Hash[d] |
Test case
1 generated file · +3 −3test/inputs/schema/optional-const-ref.schema
Mschema-rubydefault / TopLevel.rb+3 −3
| @@ -51,12 +51,12 @@ end | ||
| 51 | 51 | |
| 52 | 52 | class TopLevel < Dry::Struct |
| 53 | 53 | attribute :coordinates, Types.Array(Coordinate).optional |
| 54 | - attribute :count, Types::Integer.optional | |
| 54 | + attribute :count, Types::Integer.constrained(gteq: 1, lteq: 100).optional | |
| 55 | 55 | attribute :label, Types::String.optional |
| 56 | 56 | attribute :required_coordinates, Types.Array(Coordinate) |
| 57 | - attribute :required_count, Types::Integer | |
| 57 | + attribute :required_count, Types::Integer.constrained(gteq: 1, lteq: 100) | |
| 58 | 58 | attribute :required_label, Types::String |
| 59 | - attribute :weight, Types::Double.optional | |
| 59 | + attribute :weight, Types::Double.constrained(gteq: 0.5, lteq: 99.5).optional | |
| 60 | 60 | |
| 61 | 61 | def self.from_dynamic!(d) |
| 62 | 62 | d = Types::Hash[d] |
Test case
1 generated file · +3 −3test/inputs/schema/optional-constraints.schema
Mschema-rubydefault / TopLevel.rb+3 −3
| @@ -22,11 +22,11 @@ module Types | ||
| 22 | 22 | end |
| 23 | 23 | |
| 24 | 24 | class TopLevel < Dry::Struct |
| 25 | - attribute :opt_double, Types::Double.optional | |
| 26 | - attribute :opt_int, Types::Integer.optional | |
| 25 | + attribute :opt_double, Types::Double.constrained(gteq: 0.5, lteq: 99.5).optional | |
| 26 | + attribute :opt_int, Types::Integer.constrained(gteq: 0, lteq: 100).optional | |
| 27 | 27 | attribute :opt_pattern, Types::String.optional |
| 28 | 28 | attribute :opt_string, Types::String.optional |
| 29 | - attribute :req_zero_min, Types::Integer | |
| 29 | + attribute :req_zero_min, Types::Integer.constrained(gteq: 0, lteq: 100) | |
| 30 | 30 | |
| 31 | 31 | def self.from_dynamic!(d) |
| 32 | 32 | d = Types::Hash[d] |
Test case
1 generated file · +1 −1test/inputs/schema/schema-constraints.schema
Mschema-rubydefault / TopLevel.rb+1 −1
| @@ -22,7 +22,7 @@ end | ||
| 22 | 22 | |
| 23 | 23 | class TopLevel < Dry::Struct |
| 24 | 24 | attribute :min_max_length, Types::String |
| 25 | - attribute :percent, Types::Double | |
| 25 | + attribute :percent, Types::Double.constrained(gteq: 0, lteq: 1) | |
| 26 | 26 | |
| 27 | 27 | def self.from_dynamic!(d) |
| 28 | 28 | d = Types::Hash[d] |
Test case
1 generated file · +117 −117test/inputs/schema/vega-lite.schema
Mschema-rubydefault / TopLevel.rb+117 −117
| @@ -253,7 +253,7 @@ end | ||
| 253 | 253 | # |
| 254 | 254 | # Font weight for title text. |
| 255 | 255 | class FontWeightUnion < Dry::Struct |
| 256 | - attribute :double, Types::Double.optional | |
| 256 | + attribute :double, Types::Double.constrained(gteq: 100, lteq: 900).optional | |
| 257 | 257 | attribute :enum_1, Types::FontWeight.optional |
| 258 | 258 | |
| 259 | 259 | def self.from_dynamic!(d) |
| @@ -354,7 +354,7 @@ class MarkConfig < Dry::Struct | ||
| 354 | 354 | attribute :align, Types::HorizontalAlign.optional |
| 355 | 355 | |
| 356 | 356 | # The rotation angle of the text, in degrees. |
| 357 | - attribute :angle, Types::Double.optional | |
| 357 | + attribute :angle, Types::Double.constrained(gteq: 0, lteq: 360).optional | |
| 358 | 358 | |
| 359 | 359 | # The vertical alignment of the text. One of `"top"`, `"middle"`, `"bottom"`. |
| 360 | 360 | # |
| @@ -398,13 +398,13 @@ class MarkConfig < Dry::Struct | ||
| 398 | 398 | # The fill opacity (value between [0,1]). |
| 399 | 399 | # |
| 400 | 400 | # __Default value:__ `1` |
| 401 | - attribute :fill_opacity, Types::Double.optional | |
| 401 | + attribute :fill_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 402 | 402 | |
| 403 | 403 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 404 | 404 | attribute :font, Types::String.optional |
| 405 | 405 | |
| 406 | 406 | # The font size, in pixels. |
| 407 | - attribute :font_size, Types::Double.optional | |
| 407 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 408 | 408 | |
| 409 | 409 | # The font style (e.g., `"italic"`). |
| 410 | 410 | attribute :font_style, Types::FontStyle.optional |
| @@ -443,7 +443,7 @@ class MarkConfig < Dry::Struct | ||
| 443 | 443 | # |
| 444 | 444 | # __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or |
| 445 | 445 | # `square` marks or layered `bar` charts and `1` otherwise. |
| 446 | - attribute :opacity, Types::Double.optional | |
| 446 | + attribute :opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 447 | 447 | |
| 448 | 448 | # The orientation of a non-stacked bar, tick, area, and line charts. |
| 449 | 449 | # The value is either horizontal (default) or vertical. |
| @@ -458,7 +458,7 @@ class MarkConfig < Dry::Struct | ||
| 458 | 458 | |
| 459 | 459 | # Polar coordinate radial offset, in pixels, of the text label from the origin determined |
| 460 | 460 | # by the `x` and `y` properties. |
| 461 | - attribute :radius, Types::Double.optional | |
| 461 | + attribute :radius, Types::Double.constrained(gteq: 0).optional | |
| 462 | 462 | |
| 463 | 463 | # The default symbol shape to use. One of: `"circle"` (default), `"square"`, `"cross"`, |
| 464 | 464 | # `"diamond"`, `"triangle-up"`, or `"triangle-down"`, or a custom SVG path. |
| @@ -471,7 +471,7 @@ class MarkConfig < Dry::Struct | ||
| 471 | 471 | # of the size value. |
| 472 | 472 | # |
| 473 | 473 | # __Default value:__ `30` |
| 474 | - attribute :size, Types::Double.optional | |
| 474 | + attribute :size, Types::Double.constrained(gteq: 0).optional | |
| 475 | 475 | |
| 476 | 476 | # Default Stroke Color. This has higher precedence than config.color |
| 477 | 477 | # |
| @@ -487,13 +487,13 @@ class MarkConfig < Dry::Struct | ||
| 487 | 487 | # The stroke opacity (value between [0,1]). |
| 488 | 488 | # |
| 489 | 489 | # __Default value:__ `1` |
| 490 | - attribute :stroke_opacity, Types::Double.optional | |
| 490 | + attribute :stroke_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 491 | 491 | |
| 492 | 492 | # The stroke width, in pixels. |
| 493 | - attribute :stroke_width, Types::Double.optional | |
| 493 | + attribute :stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 494 | 494 | |
| 495 | 495 | # Depending on the interpolation type, sets the tension parameter (for line and area marks). |
| 496 | - attribute :tension, Types::Double.optional | |
| 496 | + attribute :tension, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 497 | 497 | |
| 498 | 498 | # Placeholder text if the `text` channel is not specified |
| 499 | 499 | attribute :text, Types::String.optional |
| @@ -743,15 +743,15 @@ class AxisConfig < Dry::Struct | ||
| 743 | 743 | # The stroke opacity of grid (value between [0,1]) |
| 744 | 744 | # |
| 745 | 745 | # __Default value:__ (`1` by default) |
| 746 | - attribute :grid_opacity, Types::Double.optional | |
| 746 | + attribute :grid_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 747 | 747 | |
| 748 | 748 | # The grid width, in pixels. |
| 749 | - attribute :grid_width, Types::Double.optional | |
| 749 | + attribute :grid_width, Types::Double.constrained(gteq: 0).optional | |
| 750 | 750 | |
| 751 | 751 | # The rotation angle of the axis labels. |
| 752 | 752 | # |
| 753 | 753 | # __Default value:__ `-90` for nominal and ordinal fields; `0` otherwise. |
| 754 | - attribute :label_angle, Types::Double.optional | |
| 754 | + attribute :label_angle, Types::Double.constrained(gteq: -360, lteq: 360).optional | |
| 755 | 755 | |
| 756 | 756 | # Indicates if labels should be hidden if they exceed the axis range. If `false `(the |
| 757 | 757 | # default) no bounds overlap analysis is performed. If `true`, labels will be hidden if |
| @@ -780,7 +780,7 @@ class AxisConfig < Dry::Struct | ||
| 780 | 780 | attribute :label_font, Types::String.optional |
| 781 | 781 | |
| 782 | 782 | # The font size of the label, in pixels. |
| 783 | - attribute :label_font_size, Types::Double.optional | |
| 783 | + attribute :label_font_size, Types::Double.constrained(gteq: 0).optional | |
| 784 | 784 | |
| 785 | 785 | # Maximum allowed pixel width of axis tick labels. |
| 786 | 786 | attribute :label_limit, Types::Double.optional |
| @@ -830,10 +830,10 @@ class AxisConfig < Dry::Struct | ||
| 830 | 830 | attribute :ticks, Types::Bool.optional |
| 831 | 831 | |
| 832 | 832 | # The size in pixels of axis ticks. |
| 833 | - attribute :tick_size, Types::Double.optional | |
| 833 | + attribute :tick_size, Types::Double.constrained(gteq: 0).optional | |
| 834 | 834 | |
| 835 | 835 | # The width, in pixels, of ticks. |
| 836 | - attribute :tick_width, Types::Double.optional | |
| 836 | + attribute :tick_width, Types::Double.constrained(gteq: 0).optional | |
| 837 | 837 | |
| 838 | 838 | # Horizontal text alignment of axis titles. |
| 839 | 839 | attribute :title_align, Types::String.optional |
| @@ -851,7 +851,7 @@ class AxisConfig < Dry::Struct | ||
| 851 | 851 | attribute :title_font, Types::String.optional |
| 852 | 852 | |
| 853 | 853 | # Font size of the title. |
| 854 | - attribute :title_font_size, Types::Double.optional | |
| 854 | + attribute :title_font_size, Types::Double.constrained(gteq: 0).optional | |
| 855 | 855 | |
| 856 | 856 | # Font weight of the title. (e.g., `"bold"`). |
| 857 | 857 | attribute :title_font_weight, Types.Instance(TitleFontWeight).optional |
| @@ -1021,15 +1021,15 @@ class VGAxisConfig < Dry::Struct | ||
| 1021 | 1021 | # The stroke opacity of grid (value between [0,1]) |
| 1022 | 1022 | # |
| 1023 | 1023 | # __Default value:__ (`1` by default) |
| 1024 | - attribute :grid_opacity, Types::Double.optional | |
| 1024 | + attribute :grid_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 1025 | 1025 | |
| 1026 | 1026 | # The grid width, in pixels. |
| 1027 | - attribute :grid_width, Types::Double.optional | |
| 1027 | + attribute :grid_width, Types::Double.constrained(gteq: 0).optional | |
| 1028 | 1028 | |
| 1029 | 1029 | # The rotation angle of the axis labels. |
| 1030 | 1030 | # |
| 1031 | 1031 | # __Default value:__ `-90` for nominal and ordinal fields; `0` otherwise. |
| 1032 | - attribute :label_angle, Types::Double.optional | |
| 1032 | + attribute :label_angle, Types::Double.constrained(gteq: -360, lteq: 360).optional | |
| 1033 | 1033 | |
| 1034 | 1034 | # Indicates if labels should be hidden if they exceed the axis range. If `false `(the |
| 1035 | 1035 | # default) no bounds overlap analysis is performed. If `true`, labels will be hidden if |
| @@ -1058,7 +1058,7 @@ class VGAxisConfig < Dry::Struct | ||
| 1058 | 1058 | attribute :label_font, Types::String.optional |
| 1059 | 1059 | |
| 1060 | 1060 | # The font size of the label, in pixels. |
| 1061 | - attribute :label_font_size, Types::Double.optional | |
| 1061 | + attribute :label_font_size, Types::Double.constrained(gteq: 0).optional | |
| 1062 | 1062 | |
| 1063 | 1063 | # Maximum allowed pixel width of axis tick labels. |
| 1064 | 1064 | attribute :label_limit, Types::Double.optional |
| @@ -1103,10 +1103,10 @@ class VGAxisConfig < Dry::Struct | ||
| 1103 | 1103 | attribute :ticks, Types::Bool.optional |
| 1104 | 1104 | |
| 1105 | 1105 | # The size in pixels of axis ticks. |
| 1106 | - attribute :tick_size, Types::Double.optional | |
| 1106 | + attribute :tick_size, Types::Double.constrained(gteq: 0).optional | |
| 1107 | 1107 | |
| 1108 | 1108 | # The width, in pixels, of ticks. |
| 1109 | - attribute :tick_width, Types::Double.optional | |
| 1109 | + attribute :tick_width, Types::Double.constrained(gteq: 0).optional | |
| 1110 | 1110 | |
| 1111 | 1111 | # Horizontal text alignment of axis titles. |
| 1112 | 1112 | attribute :title_align, Types::String.optional |
| @@ -1124,7 +1124,7 @@ class VGAxisConfig < Dry::Struct | ||
| 1124 | 1124 | attribute :title_font, Types::String.optional |
| 1125 | 1125 | |
| 1126 | 1126 | # Font size of the title. |
| 1127 | - attribute :title_font_size, Types::Double.optional | |
| 1127 | + attribute :title_font_size, Types::Double.constrained(gteq: 0).optional | |
| 1128 | 1128 | |
| 1129 | 1129 | # Font weight of the title. (e.g., `"bold"`). |
| 1130 | 1130 | attribute :title_font_weight, Types.Instance(TitleFontWeight).optional |
| @@ -1248,7 +1248,7 @@ class BarConfig < Dry::Struct | ||
| 1248 | 1248 | attribute :align, Types::HorizontalAlign.optional |
| 1249 | 1249 | |
| 1250 | 1250 | # The rotation angle of the text, in degrees. |
| 1251 | - attribute :angle, Types::Double.optional | |
| 1251 | + attribute :angle, Types::Double.constrained(gteq: 0, lteq: 360).optional | |
| 1252 | 1252 | |
| 1253 | 1253 | # The vertical alignment of the text. One of `"top"`, `"middle"`, `"bottom"`. |
| 1254 | 1254 | # |
| @@ -1259,7 +1259,7 @@ class BarConfig < Dry::Struct | ||
| 1259 | 1259 | # statisticians) or 1 (Vega-Lite Default, D3 example style). |
| 1260 | 1260 | # |
| 1261 | 1261 | # __Default value:__ `1` |
| 1262 | - attribute :bin_spacing, Types::Double.optional | |
| 1262 | + attribute :bin_spacing, Types::Double.constrained(gteq: 0).optional | |
| 1263 | 1263 | |
| 1264 | 1264 | # Default color. Note that `fill` and `stroke` have higher precedence than `color` and |
| 1265 | 1265 | # will override `color`. |
| @@ -1272,7 +1272,7 @@ class BarConfig < Dry::Struct | ||
| 1272 | 1272 | # The default size of the bars on continuous scales. |
| 1273 | 1273 | # |
| 1274 | 1274 | # __Default value:__ `5` |
| 1275 | - attribute :continuous_band_size, Types::Double.optional | |
| 1275 | + attribute :continuous_band_size, Types::Double.constrained(gteq: 0).optional | |
| 1276 | 1276 | |
| 1277 | 1277 | # The mouse cursor used over the mark. Any valid [CSS cursor |
| 1278 | 1278 | # type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. |
| @@ -1280,7 +1280,7 @@ class BarConfig < Dry::Struct | ||
| 1280 | 1280 | |
| 1281 | 1281 | # The size of the bars. If unspecified, the default size is `bandSize-1`, |
| 1282 | 1282 | # which provides 1 pixel offset between bars. |
| 1283 | - attribute :discrete_band_size, Types::Double.optional | |
| 1283 | + attribute :discrete_band_size, Types::Double.constrained(gteq: 0).optional | |
| 1284 | 1284 | |
| 1285 | 1285 | # The horizontal offset, in pixels, between the text label and its anchor point. The offset |
| 1286 | 1286 | # is applied after rotation by the _angle_ property. |
| @@ -1307,13 +1307,13 @@ class BarConfig < Dry::Struct | ||
| 1307 | 1307 | # The fill opacity (value between [0,1]). |
| 1308 | 1308 | # |
| 1309 | 1309 | # __Default value:__ `1` |
| 1310 | - attribute :fill_opacity, Types::Double.optional | |
| 1310 | + attribute :fill_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 1311 | 1311 | |
| 1312 | 1312 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 1313 | 1313 | attribute :font, Types::String.optional |
| 1314 | 1314 | |
| 1315 | 1315 | # The font size, in pixels. |
| 1316 | - attribute :font_size, Types::Double.optional | |
| 1316 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 1317 | 1317 | |
| 1318 | 1318 | # The font style (e.g., `"italic"`). |
| 1319 | 1319 | attribute :font_style, Types::FontStyle.optional |
| @@ -1352,7 +1352,7 @@ class BarConfig < Dry::Struct | ||
| 1352 | 1352 | # |
| 1353 | 1353 | # __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or |
| 1354 | 1354 | # `square` marks or layered `bar` charts and `1` otherwise. |
| 1355 | - attribute :opacity, Types::Double.optional | |
| 1355 | + attribute :opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 1356 | 1356 | |
| 1357 | 1357 | # The orientation of a non-stacked bar, tick, area, and line charts. |
| 1358 | 1358 | # The value is either horizontal (default) or vertical. |
| @@ -1367,7 +1367,7 @@ class BarConfig < Dry::Struct | ||
| 1367 | 1367 | |
| 1368 | 1368 | # Polar coordinate radial offset, in pixels, of the text label from the origin determined |
| 1369 | 1369 | # by the `x` and `y` properties. |
| 1370 | - attribute :radius, Types::Double.optional | |
| 1370 | + attribute :radius, Types::Double.constrained(gteq: 0).optional | |
| 1371 | 1371 | |
| 1372 | 1372 | # The default symbol shape to use. One of: `"circle"` (default), `"square"`, `"cross"`, |
| 1373 | 1373 | # `"diamond"`, `"triangle-up"`, or `"triangle-down"`, or a custom SVG path. |
| @@ -1380,7 +1380,7 @@ class BarConfig < Dry::Struct | ||
| 1380 | 1380 | # of the size value. |
| 1381 | 1381 | # |
| 1382 | 1382 | # __Default value:__ `30` |
| 1383 | - attribute :size, Types::Double.optional | |
| 1383 | + attribute :size, Types::Double.constrained(gteq: 0).optional | |
| 1384 | 1384 | |
| 1385 | 1385 | # Default Stroke Color. This has higher precedence than config.color |
| 1386 | 1386 | # |
| @@ -1396,13 +1396,13 @@ class BarConfig < Dry::Struct | ||
| 1396 | 1396 | # The stroke opacity (value between [0,1]). |
| 1397 | 1397 | # |
| 1398 | 1398 | # __Default value:__ `1` |
| 1399 | - attribute :stroke_opacity, Types::Double.optional | |
| 1399 | + attribute :stroke_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 1400 | 1400 | |
| 1401 | 1401 | # The stroke width, in pixels. |
| 1402 | - attribute :stroke_width, Types::Double.optional | |
| 1402 | + attribute :stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 1403 | 1403 | |
| 1404 | 1404 | # Depending on the interpolation type, sets the tension parameter (for line and area marks). |
| 1405 | - attribute :tension, Types::Double.optional | |
| 1405 | + attribute :tension, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 1406 | 1406 | |
| 1407 | 1407 | # Placeholder text if the `text` channel is not specified |
| 1408 | 1408 | attribute :text, Types::String.optional |
| @@ -1551,7 +1551,7 @@ class LegendConfig < Dry::Struct | ||
| 1551 | 1551 | attribute :fill_color, Types::String.optional |
| 1552 | 1552 | |
| 1553 | 1553 | # The height of the gradient, in pixels. |
| 1554 | - attribute :gradient_height, Types::Double.optional | |
| 1554 | + attribute :gradient_height, Types::Double.constrained(gteq: 0).optional | |
| 1555 | 1555 | |
| 1556 | 1556 | # Text baseline for color ramp gradient labels. |
| 1557 | 1557 | attribute :gradient_label_baseline, Types::String.optional |
| @@ -1566,10 +1566,10 @@ class LegendConfig < Dry::Struct | ||
| 1566 | 1566 | attribute :gradient_stroke_color, Types::String.optional |
| 1567 | 1567 | |
| 1568 | 1568 | # The width of the gradient stroke, in pixels. |
| 1569 | - attribute :gradient_stroke_width, Types::Double.optional | |
| 1569 | + attribute :gradient_stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 1570 | 1570 | |
| 1571 | 1571 | # The width of the gradient, in pixels. |
| 1572 | - attribute :gradient_width, Types::Double.optional | |
| 1572 | + attribute :gradient_width, Types::Double.constrained(gteq: 0).optional | |
| 1573 | 1573 | |
| 1574 | 1574 | # The alignment of the legend label, can be left, middle or right. |
| 1575 | 1575 | attribute :label_align, Types::String.optional |
| @@ -1586,13 +1586,13 @@ class LegendConfig < Dry::Struct | ||
| 1586 | 1586 | # The font size of legend label. |
| 1587 | 1587 | # |
| 1588 | 1588 | # __Default value:__ `10`. |
| 1589 | - attribute :label_font_size, Types::Double.optional | |
| 1589 | + attribute :label_font_size, Types::Double.constrained(gteq: 0).optional | |
| 1590 | 1590 | |
| 1591 | 1591 | # Maximum allowed pixel width of axis tick labels. |
| 1592 | 1592 | attribute :label_limit, Types::Double.optional |
| 1593 | 1593 | |
| 1594 | 1594 | # The offset of the legend label. |
| 1595 | - attribute :label_offset, Types::Double.optional | |
| 1595 | + attribute :label_offset, Types::Double.constrained(gteq: 0).optional | |
| 1596 | 1596 | |
| 1597 | 1597 | # The offset, in pixels, by which to displace the legend from the edge of the enclosing |
| 1598 | 1598 | # group or data rectangle. |
| @@ -1628,10 +1628,10 @@ class LegendConfig < Dry::Struct | ||
| 1628 | 1628 | attribute :symbol_color, Types::String.optional |
| 1629 | 1629 | |
| 1630 | 1630 | # The size of the legend symbol, in pixels. |
| 1631 | - attribute :symbol_size, Types::Double.optional | |
| 1631 | + attribute :symbol_size, Types::Double.constrained(gteq: 0).optional | |
| 1632 | 1632 | |
| 1633 | 1633 | # The width of the symbol's stroke. |
| 1634 | - attribute :symbol_stroke_width, Types::Double.optional | |
| 1634 | + attribute :symbol_stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 1635 | 1635 | |
| 1636 | 1636 | # Default shape type (such as "circle") for legend symbols. |
| 1637 | 1637 | attribute :symbol_type, Types::String.optional |
| @@ -2040,11 +2040,11 @@ class ScaleConfig < Dry::Struct | ||
| 2040 | 2040 | # Default inner padding for `x` and `y` band-ordinal scales. |
| 2041 | 2041 | # |
| 2042 | 2042 | # __Default value:__ `0.1` |
| 2043 | - attribute :band_padding_inner, Types::Double.optional | |
| 2043 | + attribute :band_padding_inner, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2044 | 2044 | |
| 2045 | 2045 | # Default outer padding for `x` and `y` band-ordinal scales. |
| 2046 | 2046 | # If not specified, by default, band scale's paddingOuter is paddingInner/2. |
| 2047 | - attribute :band_padding_outer, Types::Double.optional | |
| 2047 | + attribute :band_padding_outer, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2048 | 2048 | |
| 2049 | 2049 | # If true, values that exceed the data domain are clamped to either the minimum or maximum |
| 2050 | 2050 | # range value |
| @@ -2054,68 +2054,68 @@ class ScaleConfig < Dry::Struct | ||
| 2054 | 2054 | # |
| 2055 | 2055 | # __Default:__ `5` for continuous x-scale of a vertical bar and continuous y-scale of a |
| 2056 | 2056 | # horizontal bar.; `0` otherwise. |
| 2057 | - attribute :continuous_padding, Types::Double.optional | |
| 2057 | + attribute :continuous_padding, Types::Double.constrained(gteq: 0).optional | |
| 2058 | 2058 | |
| 2059 | 2059 | # The default max value for mapping quantitative fields to bar's size/bandSize. |
| 2060 | 2060 | # |
| 2061 | 2061 | # If undefined (default), we will use the scale's `rangeStep` - 1. |
| 2062 | - attribute :max_band_size, Types::Double.optional | |
| 2062 | + attribute :max_band_size, Types::Double.constrained(gteq: 0).optional | |
| 2063 | 2063 | |
| 2064 | 2064 | # The default max value for mapping quantitative fields to text's size/fontSize. |
| 2065 | 2065 | # |
| 2066 | 2066 | # __Default value:__ `40` |
| 2067 | - attribute :max_font_size, Types::Double.optional | |
| 2067 | + attribute :max_font_size, Types::Double.constrained(gteq: 0).optional | |
| 2068 | 2068 | |
| 2069 | 2069 | # Default max opacity for mapping a field to opacity. |
| 2070 | 2070 | # |
| 2071 | 2071 | # __Default value:__ `0.8` |
| 2072 | - attribute :max_opacity, Types::Double.optional | |
| 2072 | + attribute :max_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2073 | 2073 | |
| 2074 | 2074 | # Default max value for point size scale. |
| 2075 | - attribute :max_size, Types::Double.optional | |
| 2075 | + attribute :max_size, Types::Double.constrained(gteq: 0).optional | |
| 2076 | 2076 | |
| 2077 | 2077 | # Default max strokeWidth for strokeWidth (or rule/line's size) scale. |
| 2078 | 2078 | # |
| 2079 | 2079 | # __Default value:__ `4` |
| 2080 | - attribute :max_stroke_width, Types::Double.optional | |
| 2080 | + attribute :max_stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 2081 | 2081 | |
| 2082 | 2082 | # The default min value for mapping quantitative fields to bar and tick's size/bandSize |
| 2083 | 2083 | # scale with zero=false. |
| 2084 | 2084 | # |
| 2085 | 2085 | # __Default value:__ `2` |
| 2086 | - attribute :min_band_size, Types::Double.optional | |
| 2086 | + attribute :min_band_size, Types::Double.constrained(gteq: 0).optional | |
| 2087 | 2087 | |
| 2088 | 2088 | # The default min value for mapping quantitative fields to tick's size/fontSize scale with |
| 2089 | 2089 | # zero=false |
| 2090 | 2090 | # |
| 2091 | 2091 | # __Default value:__ `8` |
| 2092 | - attribute :min_font_size, Types::Double.optional | |
| 2092 | + attribute :min_font_size, Types::Double.constrained(gteq: 0).optional | |
| 2093 | 2093 | |
| 2094 | 2094 | # Default minimum opacity for mapping a field to opacity. |
| 2095 | 2095 | # |
| 2096 | 2096 | # __Default value:__ `0.3` |
| 2097 | - attribute :min_opacity, Types::Double.optional | |
| 2097 | + attribute :min_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2098 | 2098 | |
| 2099 | 2099 | # Default minimum value for point size scale with zero=false. |
| 2100 | 2100 | # |
| 2101 | 2101 | # __Default value:__ `9` |
| 2102 | - attribute :min_size, Types::Double.optional | |
| 2102 | + attribute :min_size, Types::Double.constrained(gteq: 0).optional | |
| 2103 | 2103 | |
| 2104 | 2104 | # Default minimum strokeWidth for strokeWidth (or rule/line's size) scale with zero=false. |
| 2105 | 2105 | # |
| 2106 | 2106 | # __Default value:__ `1` |
| 2107 | - attribute :min_stroke_width, Types::Double.optional | |
| 2107 | + attribute :min_stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 2108 | 2108 | |
| 2109 | 2109 | # Default outer padding for `x` and `y` point-ordinal scales. |
| 2110 | 2110 | # |
| 2111 | 2111 | # __Default value:__ `0.5` |
| 2112 | - attribute :point_padding, Types::Double.optional | |
| 2112 | + attribute :point_padding, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2113 | 2113 | |
| 2114 | 2114 | # Default range step for band and point scales of (1) the `y` channel |
| 2115 | 2115 | # and (2) the `x` channel when the mark is not `text`. |
| 2116 | 2116 | # |
| 2117 | 2117 | # __Default value:__ `21` |
| 2118 | - attribute :range_step, Types::Double.optional.optional | |
| 2118 | + attribute :range_step, Types::Double.constrained(gteq: 0).optional.optional | |
| 2119 | 2119 | |
| 2120 | 2120 | # If true, rounds numeric output values to integers. |
| 2121 | 2121 | # This can be helpful for snapping to the pixel grid. |
| @@ -2125,7 +2125,7 @@ class ScaleConfig < Dry::Struct | ||
| 2125 | 2125 | # Default range step for `x` band and point scales of text marks. |
| 2126 | 2126 | # |
| 2127 | 2127 | # __Default value:__ `90` |
| 2128 | - attribute :text_x_range_step, Types::Double.optional | |
| 2128 | + attribute :text_x_range_step, Types::Double.constrained(gteq: 0).optional | |
| 2129 | 2129 | |
| 2130 | 2130 | # Use the source data range before aggregation as scale domain instead of aggregated data |
| 2131 | 2131 | # for aggregate axis. |
| @@ -2725,7 +2725,7 @@ class VGMarkConfig < Dry::Struct | ||
| 2725 | 2725 | attribute :align, Types::HorizontalAlign.optional |
| 2726 | 2726 | |
| 2727 | 2727 | # The rotation angle of the text, in degrees. |
| 2728 | - attribute :angle, Types::Double.optional | |
| 2728 | + attribute :angle, Types::Double.constrained(gteq: 0, lteq: 360).optional | |
| 2729 | 2729 | |
| 2730 | 2730 | # The vertical alignment of the text. One of `"top"`, `"middle"`, `"bottom"`. |
| 2731 | 2731 | # |
| @@ -2752,13 +2752,13 @@ class VGMarkConfig < Dry::Struct | ||
| 2752 | 2752 | # The fill opacity (value between [0,1]). |
| 2753 | 2753 | # |
| 2754 | 2754 | # __Default value:__ `1` |
| 2755 | - attribute :fill_opacity, Types::Double.optional | |
| 2755 | + attribute :fill_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2756 | 2756 | |
| 2757 | 2757 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2758 | 2758 | attribute :font, Types::String.optional |
| 2759 | 2759 | |
| 2760 | 2760 | # The font size, in pixels. |
| 2761 | - attribute :font_size, Types::Double.optional | |
| 2761 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 2762 | 2762 | |
| 2763 | 2763 | # The font style (e.g., `"italic"`). |
| 2764 | 2764 | attribute :font_style, Types::FontStyle.optional |
| @@ -2797,7 +2797,7 @@ class VGMarkConfig < Dry::Struct | ||
| 2797 | 2797 | # |
| 2798 | 2798 | # __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or |
| 2799 | 2799 | # `square` marks or layered `bar` charts and `1` otherwise. |
| 2800 | - attribute :opacity, Types::Double.optional | |
| 2800 | + attribute :opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2801 | 2801 | |
| 2802 | 2802 | # The orientation of a non-stacked bar, tick, area, and line charts. |
| 2803 | 2803 | # The value is either horizontal (default) or vertical. |
| @@ -2812,7 +2812,7 @@ class VGMarkConfig < Dry::Struct | ||
| 2812 | 2812 | |
| 2813 | 2813 | # Polar coordinate radial offset, in pixels, of the text label from the origin determined |
| 2814 | 2814 | # by the `x` and `y` properties. |
| 2815 | - attribute :radius, Types::Double.optional | |
| 2815 | + attribute :radius, Types::Double.constrained(gteq: 0).optional | |
| 2816 | 2816 | |
| 2817 | 2817 | # The default symbol shape to use. One of: `"circle"` (default), `"square"`, `"cross"`, |
| 2818 | 2818 | # `"diamond"`, `"triangle-up"`, or `"triangle-down"`, or a custom SVG path. |
| @@ -2825,7 +2825,7 @@ class VGMarkConfig < Dry::Struct | ||
| 2825 | 2825 | # of the size value. |
| 2826 | 2826 | # |
| 2827 | 2827 | # __Default value:__ `30` |
| 2828 | - attribute :size, Types::Double.optional | |
| 2828 | + attribute :size, Types::Double.constrained(gteq: 0).optional | |
| 2829 | 2829 | |
| 2830 | 2830 | # Default Stroke Color. This has higher precedence than config.color |
| 2831 | 2831 | # |
| @@ -2841,13 +2841,13 @@ class VGMarkConfig < Dry::Struct | ||
| 2841 | 2841 | # The stroke opacity (value between [0,1]). |
| 2842 | 2842 | # |
| 2843 | 2843 | # __Default value:__ `1` |
| 2844 | - attribute :stroke_opacity, Types::Double.optional | |
| 2844 | + attribute :stroke_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2845 | 2845 | |
| 2846 | 2846 | # The stroke width, in pixels. |
| 2847 | - attribute :stroke_width, Types::Double.optional | |
| 2847 | + attribute :stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 2848 | 2848 | |
| 2849 | 2849 | # Depending on the interpolation type, sets the tension parameter (for line and area marks). |
| 2850 | - attribute :tension, Types::Double.optional | |
| 2850 | + attribute :tension, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2851 | 2851 | |
| 2852 | 2852 | # Placeholder text if the `text` channel is not specified |
| 2853 | 2853 | attribute :text, Types::String.optional |
| @@ -2941,7 +2941,7 @@ class TextConfig < Dry::Struct | ||
| 2941 | 2941 | attribute :align, Types::HorizontalAlign.optional |
| 2942 | 2942 | |
| 2943 | 2943 | # The rotation angle of the text, in degrees. |
| 2944 | - attribute :angle, Types::Double.optional | |
| 2944 | + attribute :angle, Types::Double.constrained(gteq: 0, lteq: 360).optional | |
| 2945 | 2945 | |
| 2946 | 2946 | # The vertical alignment of the text. One of `"top"`, `"middle"`, `"bottom"`. |
| 2947 | 2947 | # |
| @@ -2985,13 +2985,13 @@ class TextConfig < Dry::Struct | ||
| 2985 | 2985 | # The fill opacity (value between [0,1]). |
| 2986 | 2986 | # |
| 2987 | 2987 | # __Default value:__ `1` |
| 2988 | - attribute :fill_opacity, Types::Double.optional | |
| 2988 | + attribute :fill_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 2989 | 2989 | |
| 2990 | 2990 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 2991 | 2991 | attribute :font, Types::String.optional |
| 2992 | 2992 | |
| 2993 | 2993 | # The font size, in pixels. |
| 2994 | - attribute :font_size, Types::Double.optional | |
| 2994 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 2995 | 2995 | |
| 2996 | 2996 | # The font style (e.g., `"italic"`). |
| 2997 | 2997 | attribute :font_style, Types::FontStyle.optional |
| @@ -3030,7 +3030,7 @@ class TextConfig < Dry::Struct | ||
| 3030 | 3030 | # |
| 3031 | 3031 | # __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or |
| 3032 | 3032 | # `square` marks or layered `bar` charts and `1` otherwise. |
| 3033 | - attribute :opacity, Types::Double.optional | |
| 3033 | + attribute :opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3034 | 3034 | |
| 3035 | 3035 | # The orientation of a non-stacked bar, tick, area, and line charts. |
| 3036 | 3036 | # The value is either horizontal (default) or vertical. |
| @@ -3045,7 +3045,7 @@ class TextConfig < Dry::Struct | ||
| 3045 | 3045 | |
| 3046 | 3046 | # Polar coordinate radial offset, in pixels, of the text label from the origin determined |
| 3047 | 3047 | # by the `x` and `y` properties. |
| 3048 | - attribute :radius, Types::Double.optional | |
| 3048 | + attribute :radius, Types::Double.constrained(gteq: 0).optional | |
| 3049 | 3049 | |
| 3050 | 3050 | # The default symbol shape to use. One of: `"circle"` (default), `"square"`, `"cross"`, |
| 3051 | 3051 | # `"diamond"`, `"triangle-up"`, or `"triangle-down"`, or a custom SVG path. |
| @@ -3061,7 +3061,7 @@ class TextConfig < Dry::Struct | ||
| 3061 | 3061 | # of the size value. |
| 3062 | 3062 | # |
| 3063 | 3063 | # __Default value:__ `30` |
| 3064 | - attribute :size, Types::Double.optional | |
| 3064 | + attribute :size, Types::Double.constrained(gteq: 0).optional | |
| 3065 | 3065 | |
| 3066 | 3066 | # Default Stroke Color. This has higher precedence than config.color |
| 3067 | 3067 | # |
| @@ -3077,13 +3077,13 @@ class TextConfig < Dry::Struct | ||
| 3077 | 3077 | # The stroke opacity (value between [0,1]). |
| 3078 | 3078 | # |
| 3079 | 3079 | # __Default value:__ `1` |
| 3080 | - attribute :stroke_opacity, Types::Double.optional | |
| 3080 | + attribute :stroke_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3081 | 3081 | |
| 3082 | 3082 | # The stroke width, in pixels. |
| 3083 | - attribute :stroke_width, Types::Double.optional | |
| 3083 | + attribute :stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 3084 | 3084 | |
| 3085 | 3085 | # Depending on the interpolation type, sets the tension parameter (for line and area marks). |
| 3086 | - attribute :tension, Types::Double.optional | |
| 3086 | + attribute :tension, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3087 | 3087 | |
| 3088 | 3088 | # Placeholder text if the `text` channel is not specified |
| 3089 | 3089 | attribute :text, Types::String.optional |
| @@ -3183,12 +3183,12 @@ class TickConfig < Dry::Struct | ||
| 3183 | 3183 | attribute :align, Types::HorizontalAlign.optional |
| 3184 | 3184 | |
| 3185 | 3185 | # The rotation angle of the text, in degrees. |
| 3186 | - attribute :angle, Types::Double.optional | |
| 3186 | + attribute :angle, Types::Double.constrained(gteq: 0, lteq: 360).optional | |
| 3187 | 3187 | |
| 3188 | 3188 | # The width of the ticks. |
| 3189 | 3189 | # |
| 3190 | 3190 | # __Default value:__ 2/3 of rangeStep. |
| 3191 | - attribute :band_size, Types::Double.optional | |
| 3191 | + attribute :band_size, Types::Double.constrained(gteq: 0).optional | |
| 3192 | 3192 | |
| 3193 | 3193 | # The vertical alignment of the text. One of `"top"`, `"middle"`, `"bottom"`. |
| 3194 | 3194 | # |
| @@ -3232,13 +3232,13 @@ class TickConfig < Dry::Struct | ||
| 3232 | 3232 | # The fill opacity (value between [0,1]). |
| 3233 | 3233 | # |
| 3234 | 3234 | # __Default value:__ `1` |
| 3235 | - attribute :fill_opacity, Types::Double.optional | |
| 3235 | + attribute :fill_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3236 | 3236 | |
| 3237 | 3237 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 3238 | 3238 | attribute :font, Types::String.optional |
| 3239 | 3239 | |
| 3240 | 3240 | # The font size, in pixels. |
| 3241 | - attribute :font_size, Types::Double.optional | |
| 3241 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 3242 | 3242 | |
| 3243 | 3243 | # The font style (e.g., `"italic"`). |
| 3244 | 3244 | attribute :font_style, Types::FontStyle.optional |
| @@ -3277,7 +3277,7 @@ class TickConfig < Dry::Struct | ||
| 3277 | 3277 | # |
| 3278 | 3278 | # __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or |
| 3279 | 3279 | # `square` marks or layered `bar` charts and `1` otherwise. |
| 3280 | - attribute :opacity, Types::Double.optional | |
| 3280 | + attribute :opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3281 | 3281 | |
| 3282 | 3282 | # The orientation of a non-stacked bar, tick, area, and line charts. |
| 3283 | 3283 | # The value is either horizontal (default) or vertical. |
| @@ -3292,7 +3292,7 @@ class TickConfig < Dry::Struct | ||
| 3292 | 3292 | |
| 3293 | 3293 | # Polar coordinate radial offset, in pixels, of the text label from the origin determined |
| 3294 | 3294 | # by the `x` and `y` properties. |
| 3295 | - attribute :radius, Types::Double.optional | |
| 3295 | + attribute :radius, Types::Double.constrained(gteq: 0).optional | |
| 3296 | 3296 | |
| 3297 | 3297 | # The default symbol shape to use. One of: `"circle"` (default), `"square"`, `"cross"`, |
| 3298 | 3298 | # `"diamond"`, `"triangle-up"`, or `"triangle-down"`, or a custom SVG path. |
| @@ -3305,7 +3305,7 @@ class TickConfig < Dry::Struct | ||
| 3305 | 3305 | # of the size value. |
| 3306 | 3306 | # |
| 3307 | 3307 | # __Default value:__ `30` |
| 3308 | - attribute :size, Types::Double.optional | |
| 3308 | + attribute :size, Types::Double.constrained(gteq: 0).optional | |
| 3309 | 3309 | |
| 3310 | 3310 | # Default Stroke Color. This has higher precedence than config.color |
| 3311 | 3311 | # |
| @@ -3321,13 +3321,13 @@ class TickConfig < Dry::Struct | ||
| 3321 | 3321 | # The stroke opacity (value between [0,1]). |
| 3322 | 3322 | # |
| 3323 | 3323 | # __Default value:__ `1` |
| 3324 | - attribute :stroke_opacity, Types::Double.optional | |
| 3324 | + attribute :stroke_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3325 | 3325 | |
| 3326 | 3326 | # The stroke width, in pixels. |
| 3327 | - attribute :stroke_width, Types::Double.optional | |
| 3327 | + attribute :stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 3328 | 3328 | |
| 3329 | 3329 | # Depending on the interpolation type, sets the tension parameter (for line and area marks). |
| 3330 | - attribute :tension, Types::Double.optional | |
| 3330 | + attribute :tension, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 3331 | 3331 | |
| 3332 | 3332 | # Placeholder text if the `text` channel is not specified |
| 3333 | 3333 | attribute :text, Types::String.optional |
| @@ -3341,7 +3341,7 @@ class TickConfig < Dry::Struct | ||
| 3341 | 3341 | # Thickness of the tick mark. |
| 3342 | 3342 | # |
| 3343 | 3343 | # __Default value:__ `1` |
| 3344 | - attribute :thickness, Types::Double.optional | |
| 3344 | + attribute :thickness, Types::Double.constrained(gteq: 0).optional | |
| 3345 | 3345 | |
| 3346 | 3346 | def self.from_dynamic!(d) |
| 3347 | 3347 | d = Types::Hash[d] |
| @@ -3492,13 +3492,13 @@ class VGTitleConfig < Dry::Struct | ||
| 3492 | 3492 | # Font size in pixels for title text. |
| 3493 | 3493 | # |
| 3494 | 3494 | # __Default value:__ `10`. |
| 3495 | - attribute :font_size, Types::Double.optional | |
| 3495 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 3496 | 3496 | |
| 3497 | 3497 | # Font weight for title text. |
| 3498 | 3498 | attribute :font_weight, Types.Instance(FontWeightUnion).optional |
| 3499 | 3499 | |
| 3500 | 3500 | # The maximum allowed length in pixels of legend labels. |
| 3501 | - attribute :limit, Types::Double.optional | |
| 3501 | + attribute :limit, Types::Double.constrained(gteq: 0).optional | |
| 3502 | 3502 | |
| 3503 | 3503 | # Offset in pixels of the title from the chart body and axes. |
| 3504 | 3504 | attribute :offset, Types::Double.optional |
| @@ -4238,7 +4238,7 @@ class BinParams < Dry::Struct | ||
| 4238 | 4238 | # Maximum number of bins. |
| 4239 | 4239 | # |
| 4240 | 4240 | # __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels |
| 4241 | - attribute :maxbins, Types::Double.optional | |
| 4241 | + attribute :maxbins, Types::Double.constrained(gteq: 2).optional | |
| 4242 | 4242 | |
| 4243 | 4243 | # A minimum allowable step size (particularly useful for integer values). |
| 4244 | 4244 | attribute :minstep, Types::Double.optional |
| @@ -4332,7 +4332,7 @@ end | ||
| 4332 | 4332 | # DateTime definition object with `day`** should not be combined with `year`, `quarter`, |
| 4333 | 4333 | # `month`, or `date`. |
| 4334 | 4334 | class Day < Dry::Struct |
| 4335 | - attribute :double, Types::Double.optional | |
| 4335 | + attribute :double, Types::Double.constrained(gteq: 1, lteq: 7).optional | |
| 4336 | 4336 | attribute :string, Types::String.optional |
| 4337 | 4337 | |
| 4338 | 4338 | def self.from_dynamic!(d) |
| @@ -4366,7 +4366,7 @@ end | ||
| 4366 | 4366 | # (2) case-insensitive month name (e.g., `"January"`); (3) case-insensitive, 3-character |
| 4367 | 4367 | # short month name (e.g., `"Jan"`). |
| 4368 | 4368 | class Month < Dry::Struct |
| 4369 | - attribute :double, Types::Double.optional | |
| 4369 | + attribute :double, Types::Double.constrained(gteq: 1, lteq: 12).optional | |
| 4370 | 4370 | attribute :string, Types::String.optional |
| 4371 | 4371 | |
| 4372 | 4372 | def self.from_dynamic!(d) |
| @@ -4403,7 +4403,7 @@ end | ||
| 4403 | 4403 | class DateTime < Dry::Struct |
| 4404 | 4404 | |
| 4405 | 4405 | # Integer value representing the date from 1-31. |
| 4406 | - attribute :date, Types::Double.optional | |
| 4406 | + attribute :date, Types::Double.constrained(gteq: 1, lteq: 31).optional | |
| 4407 | 4407 | |
| 4408 | 4408 | # Value representing the day of a week. This can be one of: (1) integer value -- `1` |
| 4409 | 4409 | # represents Monday; (2) case-insensitive day name (e.g., `"Monday"`); (3) |
| @@ -4413,13 +4413,13 @@ class DateTime < Dry::Struct | ||
| 4413 | 4413 | attribute :day, Types.Instance(Day).optional |
| 4414 | 4414 | |
| 4415 | 4415 | # Integer value representing the hour of a day from 0-23. |
| 4416 | - attribute :hours, Types::Double.optional | |
| 4416 | + attribute :hours, Types::Double.constrained(gteq: 0, lteq: 23).optional | |
| 4417 | 4417 | |
| 4418 | 4418 | # Integer value representing the millisecond segment of time. |
| 4419 | - attribute :milliseconds, Types::Double.optional | |
| 4419 | + attribute :milliseconds, Types::Double.constrained(gteq: 0, lteq: 999).optional | |
| 4420 | 4420 | |
| 4421 | 4421 | # Integer value representing the minute segment of time from 0-59. |
| 4422 | - attribute :minutes, Types::Double.optional | |
| 4422 | + attribute :minutes, Types::Double.constrained(gteq: 0, lteq: 59).optional | |
| 4423 | 4423 | |
| 4424 | 4424 | # One of: (1) integer value representing the month from `1`-`12`. `1` represents January; |
| 4425 | 4425 | # (2) case-insensitive month name (e.g., `"January"`); (3) case-insensitive, 3-character |
| @@ -4427,10 +4427,10 @@ class DateTime < Dry::Struct | ||
| 4427 | 4427 | attribute :month, Types.Instance(Month).optional |
| 4428 | 4428 | |
| 4429 | 4429 | # Integer value representing the quarter of the year (from 1-4). |
| 4430 | - attribute :quarter, Types::Double.optional | |
| 4430 | + attribute :quarter, Types::Double.constrained(gteq: 1, lteq: 4).optional | |
| 4431 | 4431 | |
| 4432 | 4432 | # Integer value representing the second segment (0-59) of a time value |
| 4433 | - attribute :seconds, Types::Double.optional | |
| 4433 | + attribute :seconds, Types::Double.constrained(gteq: 0, lteq: 59).optional | |
| 4434 | 4434 | |
| 4435 | 4435 | # A boolean flag indicating if date time is in utc time. If false, the date time is in |
| 4436 | 4436 | # local time |
| @@ -5080,7 +5080,7 @@ class Legend < Dry::Struct | ||
| 5080 | 5080 | # A non-positive integer indicating z-index of the legend. |
| 5081 | 5081 | # If zindex is 0, legend should be drawn behind all chart elements. |
| 5082 | 5082 | # To put them in front, use zindex = 1. |
| 5083 | - attribute :zindex, Types::Double.optional | |
| 5083 | + attribute :zindex, Types::Double.constrained(gteq: 0).optional | |
| 5084 | 5084 | |
| 5085 | 5085 | def self.from_dynamic!(d) |
| 5086 | 5086 | d = Types::Hash[d] |
| @@ -5671,7 +5671,7 @@ class Scale < Dry::Struct | ||
| 5671 | 5671 | # __Default value:__ For _continuous_ scales, derived from the [scale |
| 5672 | 5672 | # config](scale.html#config)'s `continuousPadding`. |
| 5673 | 5673 | # For _band and point_ scales, see `paddingInner` and `paddingOuter`. |
| 5674 | - attribute :padding, Types::Double.optional | |
| 5674 | + attribute :padding, Types::Double.constrained(gteq: 0).optional | |
| 5675 | 5675 | |
| 5676 | 5676 | # The inner padding (spacing) within each band step of band scales, as a fraction of the |
| 5677 | 5677 | # step size. This value must lie in the range [0,1]. |
| @@ -5681,14 +5681,14 @@ class Scale < Dry::Struct | ||
| 5681 | 5681 | # |
| 5682 | 5682 | # __Default value:__ derived from the [scale config](scale.html#config)'s |
| 5683 | 5683 | # `bandPaddingInner`. |
| 5684 | - attribute :padding_inner, Types::Double.optional | |
| 5684 | + attribute :padding_inner, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 5685 | 5685 | |
| 5686 | 5686 | # The outer padding (spacing) at the ends of the range of band and point scales, |
| 5687 | 5687 | # as a fraction of the step size. This value must lie in the range [0,1]. |
| 5688 | 5688 | # |
| 5689 | 5689 | # __Default value:__ derived from the [scale config](scale.html#config)'s |
| 5690 | 5690 | # `bandPaddingOuter` for band scales and `pointPadding` for point scales. |
| 5691 | - attribute :padding_outer, Types::Double.optional | |
| 5691 | + attribute :padding_outer, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 5692 | 5692 | |
| 5693 | 5693 | # The range of the scale. One of: |
| 5694 | 5694 | # |
| @@ -5728,7 +5728,7 @@ class Scale < Dry::Struct | ||
| 5728 | 5728 | # __Warning__: If `rangeStep` is `null` and the cardinality of the scale's domain is higher |
| 5729 | 5729 | # than `width` or `height`, the rangeStep might become less than one pixel and the mark |
| 5730 | 5730 | # might not appear correctly. |
| 5731 | - attribute :range_step, Types::Double.optional.optional | |
| 5731 | + attribute :range_step, Types::Double.constrained(gteq: 0).optional.optional | |
| 5732 | 5732 | |
| 5733 | 5733 | # If `true`, rounds numeric output values to integers. This can be helpful for snapping to |
| 5734 | 5734 | # the pixel grid. |
| @@ -6238,7 +6238,7 @@ class Header < Dry::Struct | ||
| 6238 | 6238 | # The rotation angle of the header labels. |
| 6239 | 6239 | # |
| 6240 | 6240 | # __Default value:__ `0`. |
| 6241 | - attribute :label_angle, Types::Double.optional | |
| 6241 | + attribute :label_angle, Types::Double.constrained(gteq: -360, lteq: 360).optional | |
| 6242 | 6242 | |
| 6243 | 6243 | # A title for the field. If `null`, the title will be removed. |
| 6244 | 6244 | # |
| @@ -7106,7 +7106,7 @@ class Axis < Dry::Struct | ||
| 7106 | 7106 | # The rotation angle of the axis labels. |
| 7107 | 7107 | # |
| 7108 | 7108 | # __Default value:__ `-90` for nominal and ordinal fields; `0` otherwise. |
| 7109 | - attribute :label_angle, Types::Double.optional | |
| 7109 | + attribute :label_angle, Types::Double.constrained(gteq: -360, lteq: 360).optional | |
| 7110 | 7110 | |
| 7111 | 7111 | # Indicates if labels should be hidden if they exceed the axis range. If `false `(the |
| 7112 | 7112 | # default) no bounds overlap analysis is performed. If `true`, labels will be hidden if |
| @@ -7188,7 +7188,7 @@ class Axis < Dry::Struct | ||
| 7188 | 7188 | attribute :ticks, Types::Bool.optional |
| 7189 | 7189 | |
| 7190 | 7190 | # The size in pixels of axis ticks. |
| 7191 | - attribute :tick_size, Types::Double.optional | |
| 7191 | + attribute :tick_size, Types::Double.constrained(gteq: 0).optional | |
| 7192 | 7192 | |
| 7193 | 7193 | # A title for the field. If `null`, the title will be removed. |
| 7194 | 7194 | # |
| @@ -7220,7 +7220,7 @@ class Axis < Dry::Struct | ||
| 7220 | 7220 | # |
| 7221 | 7221 | # __Default value:__ `1` (in front of the marks) for actual axis and `0` (behind the marks) |
| 7222 | 7222 | # for grids. |
| 7223 | - attribute :zindex, Types::Double.optional | |
| 7223 | + attribute :zindex, Types::Double.constrained(gteq: 0).optional | |
| 7224 | 7224 | |
| 7225 | 7225 | def self.from_dynamic!(d) |
| 7226 | 7226 | d = Types::Hash[d] |
| @@ -7842,7 +7842,7 @@ class MarkDef < Dry::Struct | ||
| 7842 | 7842 | attribute :align, Types::HorizontalAlign.optional |
| 7843 | 7843 | |
| 7844 | 7844 | # The rotation angle of the text, in degrees. |
| 7845 | - attribute :angle, Types::Double.optional | |
| 7845 | + attribute :angle, Types::Double.constrained(gteq: 0, lteq: 360).optional | |
| 7846 | 7846 | |
| 7847 | 7847 | # The vertical alignment of the text. One of `"top"`, `"middle"`, `"bottom"`. |
| 7848 | 7848 | # |
| @@ -7889,13 +7889,13 @@ class MarkDef < Dry::Struct | ||
| 7889 | 7889 | # The fill opacity (value between [0,1]). |
| 7890 | 7890 | # |
| 7891 | 7891 | # __Default value:__ `1` |
| 7892 | - attribute :fill_opacity, Types::Double.optional | |
| 7892 | + attribute :fill_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 7893 | 7893 | |
| 7894 | 7894 | # The typeface to set the text in (e.g., `"Helvetica Neue"`). |
| 7895 | 7895 | attribute :font, Types::String.optional |
| 7896 | 7896 | |
| 7897 | 7897 | # The font size, in pixels. |
| 7898 | - attribute :font_size, Types::Double.optional | |
| 7898 | + attribute :font_size, Types::Double.constrained(gteq: 0).optional | |
| 7899 | 7899 | |
| 7900 | 7900 | # The font style (e.g., `"italic"`). |
| 7901 | 7901 | attribute :font_style, Types::FontStyle.optional |
| @@ -7934,7 +7934,7 @@ class MarkDef < Dry::Struct | ||
| 7934 | 7934 | # |
| 7935 | 7935 | # __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or |
| 7936 | 7936 | # `square` marks or layered `bar` charts and `1` otherwise. |
| 7937 | - attribute :opacity, Types::Double.optional | |
| 7937 | + attribute :opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 7938 | 7938 | |
| 7939 | 7939 | # The orientation of a non-stacked bar, tick, area, and line charts. |
| 7940 | 7940 | # The value is either horizontal (default) or vertical. |
| @@ -7949,7 +7949,7 @@ class MarkDef < Dry::Struct | ||
| 7949 | 7949 | |
| 7950 | 7950 | # Polar coordinate radial offset, in pixels, of the text label from the origin determined |
| 7951 | 7951 | # by the `x` and `y` properties. |
| 7952 | - attribute :radius, Types::Double.optional | |
| 7952 | + attribute :radius, Types::Double.constrained(gteq: 0).optional | |
| 7953 | 7953 | |
| 7954 | 7954 | # The default symbol shape to use. One of: `"circle"` (default), `"square"`, `"cross"`, |
| 7955 | 7955 | # `"diamond"`, `"triangle-up"`, or `"triangle-down"`, or a custom SVG path. |
| @@ -7962,7 +7962,7 @@ class MarkDef < Dry::Struct | ||
| 7962 | 7962 | # of the size value. |
| 7963 | 7963 | # |
| 7964 | 7964 | # __Default value:__ `30` |
| 7965 | - attribute :size, Types::Double.optional | |
| 7965 | + attribute :size, Types::Double.constrained(gteq: 0).optional | |
| 7966 | 7966 | |
| 7967 | 7967 | # Default Stroke Color. This has higher precedence than config.color |
| 7968 | 7968 | # |
| @@ -7978,10 +7978,10 @@ class MarkDef < Dry::Struct | ||
| 7978 | 7978 | # The stroke opacity (value between [0,1]). |
| 7979 | 7979 | # |
| 7980 | 7980 | # __Default value:__ `1` |
| 7981 | - attribute :stroke_opacity, Types::Double.optional | |
| 7981 | + attribute :stroke_opacity, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 7982 | 7982 | |
| 7983 | 7983 | # The stroke width, in pixels. |
| 7984 | - attribute :stroke_width, Types::Double.optional | |
| 7984 | + attribute :stroke_width, Types::Double.constrained(gteq: 0).optional | |
| 7985 | 7985 | |
| 7986 | 7986 | # A string or array of strings indicating the name of custom styles to apply to the mark. A |
| 7987 | 7987 | # style is a named collection of mark property defaults defined within the [style |
| @@ -7997,7 +7997,7 @@ class MarkDef < Dry::Struct | ||
| 7997 | 7997 | attribute :style, Types.Instance(Style).optional |
| 7998 | 7998 | |
| 7999 | 7999 | # Depending on the interpolation type, sets the tension parameter (for line and area marks). |
| 8000 | - attribute :tension, Types::Double.optional | |
| 8000 | + attribute :tension, Types::Double.constrained(gteq: 0, lteq: 1).optional | |
| 8001 | 8001 | |
| 8002 | 8002 | # Placeholder text if the `text` channel is not specified |
| 8003 | 8003 | attribute :text, Types::String.optional |
No generated files match these filters.