Skip to content

Commit a9ae178

Browse files
author
yevhenii-nadtochii
committed
Proofread text
1 parent ecb4b30 commit a9ae178

File tree

3 files changed

+61
-61
lines changed

3 files changed

+61
-61
lines changed

model/src/main/kotlin/io/spine/validation/bound/BoundFieldSupport.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ internal object BoundFieldSupport {
6767
val primitive = field.type.extractPrimitive()
6868
Compilation.check(primitive in numericPrimitives, file, field.span) {
6969
"""
70-
The `($option)` option was applied to a filed of unsupported type.
71-
Target field: `${field.qualifiedName}`.
72-
Field type: `${field.type.name}`.
73-
Supported field types: floating-point and integer numbers, repeated of numbers.
70+
The `($option)` option was applied to a filed of an unsupported type.
71+
Target field: `${field.qualifiedName}`.
72+
Field type: `${field.type.name}`.
73+
Supported field types: floating-point and integer numbers (including repeated fields).
7474
""".trimIndent()
7575
}
7676
return primitive!!

model/src/main/kotlin/io/spine/validation/bound/NumericBoundParser.kt

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ internal class NumericBoundParser(
8383
with(metadata) {
8484
Compilation.check(bound.isNotEmpty(), file, field.span) {
8585
"""
86-
The `($optionName)` option could not parse the passed bound value.
87-
Target field: `${field.qualifiedName}`.
88-
Reason: the passed value is empty.
89-
Please provide either a numeric value or refer to a value of another field via its name or a path, if the field is nested.
86+
The `($optionName)` option could not parse the passed bound value.
87+
Target field: `${field.qualifiedName}`.
88+
Reason: the value is empty.
89+
Please provide either a numeric literal or refer to a value of another field via its name or a path (for nested fields).
9090
""".trimIndent()
9191
}
9292
}
@@ -104,23 +104,23 @@ internal class NumericBoundParser(
104104
if (fieldType in listOf(TYPE_FLOAT, TYPE_DOUBLE)) {
105105
Compilation.check(FLOAT.matches(number), file, field.span) {
106106
"""
107-
The `($optionName)` option could not parse the passed bound value.
108-
The passed value: `$number`.
109-
Target field: `${field.qualifiedName}`.
110-
Field type: `${field.type.name}`.
111-
Reason: a floating-point number is expected for floating-point fields.
112-
Examples: `12.3`, `-0.1`, `6.02E2`.
107+
The `($optionName)` option could not parse the passed bound value.
108+
Value: `$number`.
109+
Target field: `${field.qualifiedName}`.
110+
Field type: `${field.type.name}`.
111+
Reason: a floating-point number is required for this field type.
112+
Examples: `12.3`, `-0.1`, `6.02E2`.
113113
""".trimIndent()
114114
}
115115
} else {
116116
Compilation.check(INTEGER.matches(number), file, field.span) {
117117
"""
118-
The `($optionName)` option could not parse the passed bound value.
119-
The passed value: `$number`.
120-
Target field: `${field.qualifiedName}`.
121-
Field type: `${field.type.name}`.
122-
Reason: an integer number is expected for integer fields.
123-
Examples: `123`, `-567823`.
118+
The `($optionName)` option could not parse the passed bound value.
119+
Value: `$number`.
120+
Target field: `${field.qualifiedName}`.
121+
Field type: `${field.type.name}`.
122+
Reason: an integer number is required for this field type.
123+
Examples: `123`, `-567823`.
124124
""".trimIndent()
125125
}
126126
}
@@ -137,11 +137,11 @@ internal class NumericBoundParser(
137137

138138
Compilation.check(parsed != null, file, field.span) {
139139
"""
140-
The `($optionName)` option could not parse the passed bound value.
141-
The passed value: `$number`.
142-
Target field: `${field.qualifiedName}`.
143-
Field type: `${field.type.name}`.
144-
Reason: the value is out of range for the field type.
140+
The `($optionName)` option could not parse the passed bound value.
141+
Value: `$number`.
142+
Target field: `${field.qualifiedName}`.
143+
Field type: `${field.type.name}`.
144+
Reason: the value is out of range for this field type.
145145
""".trimIndent()
146146
}
147147

@@ -154,11 +154,11 @@ internal class NumericBoundParser(
154154
): KNumericBound {
155155
Compilation.check(fieldPath != field.name.value, file, field.span) {
156156
"""
157-
The `($optionName)` option cannot use the specified field value as a bound.
158-
The specified field: `$fieldPath`.
159-
Target field: `${field.qualifiedName}`.
160-
Reason: self-referencing is prohibited.
161-
Please refer to a value of another field via its name or a path, if the field is nested.
157+
The `($optionName)` option cannot use the specified field as a bound.
158+
Field path: `$fieldPath`.
159+
Target field: `${field.qualifiedName}`.
160+
Reason: self-referencing is not allowed.
161+
Please refer to a value of another field via its name or a path (for nested fields).
162162
""".trimIndent()
163163
}
164164

@@ -172,24 +172,24 @@ internal class NumericBoundParser(
172172
} catch (e: IllegalStateException) {
173173
Compilation.error(file, field.span) {
174174
"""
175-
The `($optionName)` option could not parse the specified field path.
176-
The specified field path: `$fieldPath`.
177-
Target field: `${field.qualifiedName}`.
178-
Reason: the specified field does not exist, or one of the components of the field path represents a non-message field.
179-
Please make sure the provided field path references an existing field.
175+
The `($optionName)` option could not resolve the specified field path.
176+
Field path: `$fieldPath`.
177+
Target field: `${field.qualifiedName}`.
178+
Reason: the specified field does not exist, or one of the components of the field path represents a non-message field.
179+
Please make sure the field path refers to a valid field.
180180
""".trimIndent()
181181
}
182182
}
183183

184184
val boundFieldType = boundField.type.primitive
185185
Compilation.check(boundFieldType in numericPrimitives, file, field.span) {
186186
"""
187-
The `($optionName)` option cannot use the specified field as a bound value.
188-
The specified field: `$fieldPath`.
189-
Type of the specified field: `${boundFieldType.name}`.
190-
Target field: `${field.qualifiedName}`.
191-
Reason: the specified field is not of numeric type.
192-
Please specify a field of singular numeric type.
187+
The `($optionName)` option cannot use the specified field as a bound.
188+
Field path: `$fieldPath`.
189+
Field type: `${boundFieldType.name}`.
190+
Target field: `${field.qualifiedName}`.
191+
Reason: the specified field is not of a numeric type.
192+
Please use a field with a singular numeric type.
193193
""".trimIndent()
194194
}
195195

model/src/main/kotlin/io/spine/validation/bound/RangeOption.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ private fun RangeOptionMetadata.checkDelimiter(): String =
161161
DELIMITER.find(range)?.value
162162
?: Compilation.error(file, field.span) {
163163
"""
164-
The `($RANGE)` option could not parse the passed range value.
165-
The passed value: `$range`.
166-
Target field: `${field.qualifiedName}`.
167-
Reason: the lower and upper bounds should be separated either with `..` or ` .. ` delimiter.
168-
Examples of the correct ranges: `(0..10]`, `[0 .. 10)`.
164+
The `($RANGE)` option could not parse the passed range value.
165+
Value: `$range`.
166+
Target field: `${field.qualifiedName}`.
167+
Reason: the lower and upper bounds must be separated either with `..` or ` .. `.
168+
Examples of correct ranges: `(0..10]`, `[0 .. 10)`.
169169
""".trimIndent()
170170
}
171171

@@ -178,11 +178,11 @@ private fun RangeOptionMetadata.checkBrackets(
178178
'[' -> false
179179
else -> Compilation.error(file, field.span) {
180180
"""
181-
The `($RANGE)` option could not parse the passed range value.
182-
The passed value: `$range`.
183-
Target field: `${field.qualifiedName}`.
184-
Reason: the lower bound should begin either with `(` for exclusive or `[` for inclusive values.
185-
Examples of the correct lower bounds: `(5`, `[3`.
181+
The `($RANGE)` option could not parse the passed range value.
182+
Value: `$range`.
183+
Target field: `${field.qualifiedName}`.
184+
Reason: the lower bound must begin either with `(` for exclusive or `[` for inclusive values.
185+
Examples: `(5`, `[3`.
186186
""".trimIndent()
187187
}
188188
}
@@ -191,11 +191,11 @@ private fun RangeOptionMetadata.checkBrackets(
191191
']' -> false
192192
else -> Compilation.error(file, field.span) {
193193
"""
194-
The `($RANGE)` option could not parse the passed range value.
195-
The passed value: `$range`.
196-
Target field: `${field.qualifiedName}`.
197-
Reason: the upper bound should end either with `)` for exclusive or `]` for inclusive values.
198-
Examples of the correct upper bounds: `5)`, `3]`.
194+
The `($RANGE)` option could not parse the passed range value.
195+
Value: `$range`.
196+
Target field: `${field.qualifiedName}`.
197+
Reason: the upper bound must end either with `)` for exclusive or `]` for inclusive values.
198+
Examples: `5)`, `3]`.
199199
""".trimIndent()
200200
}
201201
}
@@ -205,11 +205,11 @@ private fun RangeOptionMetadata.checkBrackets(
205205
private fun RangeOptionMetadata.checkRelation(lower: KNumericBound, upper: KNumericBound) {
206206
Compilation.check(lower <= upper, file, field.span) {
207207
"""
208-
The `($RANGE)` option could not parse the passed range value.
209-
The passed value: `$range`.
210-
Target field: `${field.qualifiedName}`.
211-
Reason: the lower bound `${lower.value}` must be less than the upper `${upper.value}` bound.
212-
Examples of the correct ranges: `(-5..5]`, `[0 .. 10)`.
208+
The `($RANGE)` option could not parse the passed range value.
209+
Value: `$range`.
210+
Target field: `${field.qualifiedName}`.
211+
Reason: the lower bound `${lower.value}` must be less than the upper bound `${upper.value}`.
212+
Examples of the correct ranges: `(-5..5]`, `[0 .. 10)`.
213213
""".trimIndent()
214214
}
215215
}

0 commit comments

Comments
 (0)