Test case
1 generated file · +30 −0test/inputs/schema/minmaxlength.schema
Mschema-kotlindefault / TopLevel.kt+30 −0
| @@ -27,6 +27,36 @@ data class TopLevel ( | ||
| 27 | 27 | val minMaxUnion: String, |
| 28 | 28 | val union: String |
| 29 | 29 | ) { |
| 30 | + init { | |
| 31 | + require(intersection.length >= 4) | |
| 32 | + } | |
| 33 | + init { | |
| 34 | + require(intersection.length <= 5) | |
| 35 | + } | |
| 36 | + init { | |
| 37 | + require(maxlength.length <= 5) | |
| 38 | + } | |
| 39 | + init { | |
| 40 | + require(minlength.length >= 3) | |
| 41 | + } | |
| 42 | + init { | |
| 43 | + require(minMaxIntersection.length >= 3) | |
| 44 | + } | |
| 45 | + init { | |
| 46 | + require(minMaxIntersection.length <= 5) | |
| 47 | + } | |
| 48 | + init { | |
| 49 | + require(minmaxlength.length >= 3) | |
| 50 | + } | |
| 51 | + init { | |
| 52 | + require(minmaxlength.length <= 5) | |
| 53 | + } | |
| 54 | + init { | |
| 55 | + require(union.length >= 3) | |
| 56 | + } | |
| 57 | + init { | |
| 58 | + require(union.length <= 6) | |
| 59 | + } | |
| 30 | 60 | public fun toJson() = klaxon.toJsonString(this) |
| 31 | 61 | |
| 32 | 62 | companion object { |
Test case
1 generated file · +12 −0test/inputs/schema/optional-const-ref.schema
Mschema-kotlindefault / TopLevel.kt+12 −0
| @@ -23,12 +23,24 @@ data class TopLevel ( | ||
| 23 | 23 | init { |
| 24 | 24 | count?.let { require(it <= 100) } |
| 25 | 25 | } |
| 26 | + init { | |
| 27 | + label?.let { require(it.length >= 2) } | |
| 28 | + } | |
| 29 | + init { | |
| 30 | + label?.let { require(it.length <= 16) } | |
| 31 | + } | |
| 26 | 32 | init { |
| 27 | 33 | require(requiredCount >= 1) |
| 28 | 34 | } |
| 29 | 35 | init { |
| 30 | 36 | require(requiredCount <= 100) |
| 31 | 37 | } |
| 38 | + init { | |
| 39 | + require(requiredLabel.length >= 2) | |
| 40 | + } | |
| 41 | + init { | |
| 42 | + require(requiredLabel.length <= 16) | |
| 43 | + } | |
| 32 | 44 | init { |
| 33 | 45 | weight?.let { require(it >= 0.5) } |
| 34 | 46 | } |
Test case
1 generated file · +6 −0test/inputs/schema/optional-constraints.schema
Mschema-kotlindefault / TopLevel.kt+6 −0
| @@ -27,6 +27,12 @@ data class TopLevel ( | ||
| 27 | 27 | init { |
| 28 | 28 | optInt?.let { require(it <= 100) } |
| 29 | 29 | } |
| 30 | + init { | |
| 31 | + optString?.let { require(it.length >= 3) } | |
| 32 | + } | |
| 33 | + init { | |
| 34 | + optString?.let { require(it.length <= 10) } | |
| 35 | + } | |
| 30 | 36 | init { |
| 31 | 37 | require(reqZeroMin >= 0) |
| 32 | 38 | } |
Test case
1 generated file · +6 −0test/inputs/schema/schema-constraints.schema
Mschema-kotlindefault / TopLevel.kt+6 −0
| @@ -12,6 +12,12 @@ data class TopLevel ( | ||
| 12 | 12 | val minMaxLength: String, |
| 13 | 13 | val percent: Double |
| 14 | 14 | ) { |
| 15 | + init { | |
| 16 | + require(minMaxLength.length >= 5) | |
| 17 | + } | |
| 18 | + init { | |
| 19 | + require(minMaxLength.length <= 5) | |
| 20 | + } | |
| 15 | 21 | init { |
| 16 | 22 | require(percent >= 0) |
| 17 | 23 | } |
No generated files match these filters.