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