@@ -26,186 +26,195 @@ pub enum ErrorKind {
26
26
RecursionLoop ,
27
27
// ---------------------
28
28
// typed dict specific errors
29
- #[ strum( message = "Value must be a valid dictionary or instance to extract fields from" ) ]
29
+ #[ strum( message = "Input should be a valid dictionary or instance to extract fields from" ) ]
30
30
DictAttributesType ,
31
31
#[ strum( message = "Field required" ) ]
32
32
Missing ,
33
- #[ strum( message = "Extra values are not permitted" ) ]
33
+ #[ strum( message = "Extra inputs are not permitted" ) ]
34
34
ExtraForbidden ,
35
- #[ strum( message = "Keys must be strings" ) ]
35
+ #[ strum( message = "Keys should be strings" ) ]
36
36
InvalidKey ,
37
37
#[ strum( message = "Error extracting attribute: {error}" ) ]
38
38
GetAttributeError {
39
39
error : String ,
40
40
} ,
41
41
// ---------------------
42
42
// model class specific errors
43
- #[ strum( message = "Value must be an instance of {class_name}" ) ]
43
+ #[ strum( message = "Input should be an instance of {class_name}" ) ]
44
44
ModelClassType {
45
45
class_name : String ,
46
46
} ,
47
47
// ---------------------
48
48
// None errors
49
- #[ strum( message = "Value must be None/null" ) ]
49
+ #[ strum( message = "Input should be None/null" ) ]
50
50
NoneRequired ,
51
51
// boolean errors
52
- #[ strum( message = "Value must be a valid boolean" ) ]
52
+ #[ strum( message = "Input should be a valid boolean" ) ]
53
53
Bool ,
54
54
// ---------------------
55
55
// generic comparison errors - used for all inequality comparisons except int and float which have their
56
56
// own type, bounds arguments are Strings so they can be created from any type
57
- #[ strum( message = "Value must be greater than {gt}" ) ]
57
+ #[ strum( message = "Input should be greater than {gt}" ) ]
58
58
GreaterThan {
59
59
gt : String ,
60
60
} ,
61
- #[ strum( message = "Value must be greater than or equal to {ge}" ) ]
61
+ #[ strum( message = "Input should be greater than or equal to {ge}" ) ]
62
62
GreaterThanEqual {
63
63
ge : String ,
64
64
} ,
65
- #[ strum( message = "Value must be less than {lt}" ) ]
65
+ #[ strum( message = "Input should be less than {lt}" ) ]
66
66
LessThan {
67
67
lt : String ,
68
68
} ,
69
- #[ strum( message = "Value must be less than or equal to {le}" ) ]
69
+ #[ strum( message = "Input should be less than or equal to {le}" ) ]
70
70
LessThanEqual {
71
71
le : String ,
72
72
} ,
73
73
// ---------------------
74
74
// generic length errors - used for everything with a length except strings and bytes which need custom messages
75
75
#[ strum(
76
- message = "Input must have at least {min_length} item{expected_plural}, got {input_length} item{input_plural}"
76
+ message = "Input should have at least {min_length} item{expected_plural}, got {input_length} item{input_plural}"
77
77
) ]
78
78
TooShort {
79
79
min_length : usize ,
80
80
input_length : usize ,
81
81
} ,
82
82
#[ strum(
83
- message = "Input must have at most {max_length} item{expected_plural}, got {input_length} item{input_plural}"
83
+ message = "Input should have at most {max_length} item{expected_plural}, got {input_length} item{input_plural}"
84
84
) ]
85
85
TooLong {
86
86
max_length : usize ,
87
87
input_length : usize ,
88
88
} ,
89
89
// ---------------------
90
90
// string errors
91
- #[ strum( message = "Value must be a valid string" ) ]
91
+ #[ strum( message = "Input should be a valid string" ) ]
92
92
StrType ,
93
- #[ strum( message = "Value must be a valid string, unable to parse raw data as a unicode string" ) ]
93
+ #[ strum( message = "Input should be a valid string, unable to parse raw data as a unicode string" ) ]
94
94
StrUnicode ,
95
95
#[ strum(
96
- message = "String must have at least {min_length} characters" ,
96
+ message = "String should have at least {min_length} characters" ,
97
97
serialize = "too_short"
98
98
) ]
99
99
StrTooShort {
100
100
min_length : usize ,
101
101
} ,
102
- #[ strum( message = "String must have at most {max_length} characters" , serialize = "too_long" ) ]
102
+ #[ strum(
103
+ message = "String should have at most {max_length} characters" ,
104
+ serialize = "too_long"
105
+ ) ]
103
106
StrTooLong {
104
107
max_length : usize ,
105
108
} ,
106
- #[ strum( message = "String must match pattern '{pattern}'" ) ]
109
+ #[ strum( message = "String should match pattern '{pattern}'" ) ]
107
110
StrPatternMismatch {
108
111
pattern : String ,
109
112
} ,
110
113
// ---------------------
111
114
// dict errors
112
- #[ strum( message = "Value must be a valid dictionary" ) ]
115
+ #[ strum( message = "Input should be a valid dictionary" ) ]
113
116
DictType ,
114
117
#[ strum( message = "Unable to convert mapping to a dictionary, error: {error}" ) ]
115
118
DictFromMapping {
116
119
error : String ,
117
120
} ,
118
121
// ---------------------
119
122
// list errors
120
- #[ strum( message = "Value must be a valid list/array" ) ]
123
+ #[ strum( message = "Input should be a valid list/array" ) ]
121
124
ListType ,
122
125
// ---------------------
123
126
// tuple errors
124
- #[ strum( message = "Value must be a valid tuple" ) ]
127
+ #[ strum( message = "Input should be a valid tuple" ) ]
125
128
TupleType ,
126
129
// ---------------------
127
130
// set errors
128
- #[ strum( message = "Value must be a valid set" ) ]
131
+ #[ strum( message = "Input should be a valid set" ) ]
129
132
SetType ,
130
133
// ---------------------
131
134
// bool errors
132
- #[ strum( message = "Value must be a valid boolean" ) ]
135
+ #[ strum( message = "Input should be a valid boolean" ) ]
133
136
BoolType ,
134
- #[ strum( message = "Value must be a valid boolean, unable to interpret input" ) ]
137
+ #[ strum( message = "Input should be a valid boolean, unable to interpret input" ) ]
135
138
BoolParsing ,
136
139
// ---------------------
137
140
// int errors
138
- #[ strum( message = "Value must be a valid integer" ) ]
141
+ #[ strum( message = "Input should be a valid integer" ) ]
139
142
IntType ,
140
- #[ strum( message = "Value must be a valid integer, unable to parse string as an integer" ) ]
143
+ #[ strum( message = "Input should be a valid integer, unable to parse string as an integer" ) ]
141
144
IntParsing ,
142
- #[ strum( message = "Value must be a valid integer, got a number with a fractional part" ) ]
145
+ #[ strum( message = "Input should be a valid integer, got a number with a fractional part" ) ]
143
146
IntFromFloat ,
144
- #[ strum( message = "Value must be a valid integer, got {nan_value}" ) ]
147
+ #[ strum( message = "Input should be a valid integer, got {nan_value}" ) ]
145
148
IntNan {
146
149
nan_value : & ' static str ,
147
150
} ,
148
- #[ strum( serialize = "multiple_of" , message = "Value must be a multiple of {multiple_of}" ) ]
151
+ #[ strum( serialize = "multiple_of" , message = "Input should be a multiple of {multiple_of}" ) ]
149
152
IntMultipleOf {
150
153
multiple_of : i64 ,
151
154
} ,
152
- #[ strum( serialize = "greater_than" , message = "Value must be greater than {gt}" ) ]
155
+ #[ strum( serialize = "greater_than" , message = "Input should be greater than {gt}" ) ]
153
156
IntGreaterThan {
154
157
gt : i64 ,
155
158
} ,
156
159
#[ strum(
157
160
serialize = "greater_than_equal" ,
158
- message = "Value must be greater than or equal to {ge}"
161
+ message = "Input should be greater than or equal to {ge}"
159
162
) ]
160
163
IntGreaterThanEqual {
161
164
ge : i64 ,
162
165
} ,
163
- #[ strum( serialize = "less_than" , message = "Value must be less than {lt}" ) ]
166
+ #[ strum( serialize = "less_than" , message = "Input should be less than {lt}" ) ]
164
167
IntLessThan {
165
168
lt : i64 ,
166
169
} ,
167
- #[ strum( serialize = "less_than_equal" , message = "Value must be less than or equal to {le}" ) ]
170
+ #[ strum(
171
+ serialize = "less_than_equal" ,
172
+ message = "Input should be less than or equal to {le}"
173
+ ) ]
168
174
IntLessThanEqual {
169
175
le : i64 ,
170
176
} ,
171
177
// ---------------------
172
178
// float errors
173
- #[ strum( message = "Value must be a valid number" ) ]
179
+ #[ strum( message = "Input should be a valid number" ) ]
174
180
FloatType ,
175
- #[ strum( message = "Value must be a valid number, unable to parse string as an number" ) ]
181
+ #[ strum( message = "Input should be a valid number, unable to parse string as an number" ) ]
176
182
FloatParsing ,
177
- #[ strum( serialize = "multiple_of" , message = "Value must be a multiple of {multiple_of}" ) ]
183
+ #[ strum( serialize = "multiple_of" , message = "Input should be a multiple of {multiple_of}" ) ]
178
184
FloatMultipleOf {
179
185
multiple_of : f64 ,
180
186
} ,
181
- #[ strum( serialize = "greater_than" , message = "Value must be greater than {gt}" ) ]
187
+ #[ strum( serialize = "greater_than" , message = "Input should be greater than {gt}" ) ]
182
188
FloatGreaterThan {
183
189
gt : f64 ,
184
190
} ,
185
191
#[ strum(
186
192
serialize = "greater_than_equal" ,
187
- message = "Value must be greater than or equal to {ge}"
193
+ message = "Input should be greater than or equal to {ge}"
188
194
) ]
189
195
FloatGreaterThanEqual {
190
196
ge : f64 ,
191
197
} ,
192
- #[ strum( serialize = "less_than" , message = "Value must be less than {lt}" ) ]
198
+ #[ strum( serialize = "less_than" , message = "Input should be less than {lt}" ) ]
193
199
FloatLessThan {
194
200
lt : f64 ,
195
201
} ,
196
- #[ strum( serialize = "less_than_equal" , message = "Value must be less than or equal to {le}" ) ]
202
+ #[ strum(
203
+ serialize = "less_than_equal" ,
204
+ message = "Input should be less than or equal to {le}"
205
+ ) ]
197
206
FloatLessThanEqual {
198
207
le : f64 ,
199
208
} ,
200
209
// ---------------------
201
210
// bytes errors
202
- #[ strum( message = "Value must be a valid bytes" ) ]
211
+ #[ strum( message = "Input should be a valid bytes" ) ]
203
212
BytesType ,
204
- #[ strum( message = "Data must have at least {min_length} bytes" , serialize = "too_short" ) ]
213
+ #[ strum( message = "Data should have at least {min_length} bytes" , serialize = "too_short" ) ]
205
214
BytesTooShort {
206
215
min_length : usize ,
207
216
} ,
208
- #[ strum( message = "Data must have at most {max_length} bytes" , serialize = "too_long" ) ]
217
+ #[ strum( message = "Data should have at most {max_length} bytes" , serialize = "too_long" ) ]
209
218
BytesTooLong {
210
219
max_length : usize ,
211
220
} ,
@@ -225,41 +234,44 @@ pub enum ErrorKind {
225
234
} ,
226
235
// ---------------------
227
236
// literals
228
- #[ strum( serialize = "literal_error" , message = "Value must be {expected}" ) ]
237
+ #[ strum( serialize = "literal_error" , message = "Input should be {expected}" ) ]
229
238
LiteralSingleError {
230
239
expected : String ,
231
240
} ,
232
- #[ strum( serialize = "literal_error" , message = "Value must be one of: {expected}" ) ]
241
+ #[ strum( serialize = "literal_error" , message = "Input should be one of: {expected}" ) ]
233
242
LiteralMultipleError {
234
243
expected : String ,
235
244
} ,
236
245
// ---------------------
237
246
// date errors
238
- #[ strum( message = "Value must be a valid date" ) ]
247
+ #[ strum( message = "Input should be a valid date" ) ]
239
248
DateType ,
240
- #[ strum( message = "Value must be a valid date in the format YYYY-MM-DD, {error}" ) ]
249
+ #[ strum( message = "Input should be a valid date in the format YYYY-MM-DD, {error}" ) ]
241
250
DateParsing {
242
251
error : & ' static str ,
243
252
} ,
244
- #[ strum( message = "Value must be a valid date or datetime, {error}" ) ]
253
+ #[ strum( message = "Input should be a valid date or datetime, {error}" ) ]
245
254
DateFromDatetimeParsing {
246
255
error : String ,
247
256
} ,
248
- #[ strum( message = "Datetimes provided to dates must have zero time - e.g. be exact dates" ) ]
257
+ #[ strum( message = "Datetimes provided to dates should have zero time - e.g. be exact dates" ) ]
249
258
DateFromDatetimeInexact ,
250
259
// ---------------------
251
260
// date errors
252
- #[ strum( message = "Value must be a valid time" ) ]
261
+ #[ strum( message = "Input should be a valid time" ) ]
253
262
TimeType ,
254
- #[ strum( message = "Value must be in a valid time format, {error}" ) ]
263
+ #[ strum( message = "Input should be in a valid time format, {error}" ) ]
255
264
TimeParsing {
256
265
error : & ' static str ,
257
266
} ,
258
267
// ---------------------
259
268
// datetime errors
260
- #[ strum( serialize = "datetime_type" , message = "Value must be a valid datetime" ) ]
269
+ #[ strum( serialize = "datetime_type" , message = "Input should be a valid datetime" ) ]
261
270
DateTimeType ,
262
- #[ strum( serialize = "datetime_parsing" , message = "Value must be a valid datetime, {error}" ) ]
271
+ #[ strum(
272
+ serialize = "datetime_parsing" ,
273
+ message = "Input should be a valid datetime, {error}"
274
+ ) ]
263
275
DateTimeParsing {
264
276
error : & ' static str ,
265
277
} ,
@@ -272,23 +284,23 @@ pub enum ErrorKind {
272
284
} ,
273
285
// ---------------------
274
286
// timedelta errors
275
- #[ strum( message = "Value must be a valid timedelta" ) ]
287
+ #[ strum( message = "Input should be a valid timedelta" ) ]
276
288
TimeDeltaType ,
277
- #[ strum( message = "Value must be a valid timedelta, {error}" ) ]
289
+ #[ strum( message = "Input should be a valid timedelta, {error}" ) ]
278
290
TimeDeltaParsing {
279
291
error : & ' static str ,
280
292
} ,
281
293
// ---------------------
282
294
// frozenset errors
283
- #[ strum( message = "Value must be a valid frozenset" ) ]
295
+ #[ strum( message = "Input should be a valid frozenset" ) ]
284
296
FrozenSetType ,
285
297
// ---------------------
286
298
// introspection types - e.g. isinstance, callable
287
- #[ strum( message = "Input must be an instance of {class}" ) ]
299
+ #[ strum( message = "Input should be an instance of {class}" ) ]
288
300
IsInstanceOf {
289
301
class : String ,
290
302
} ,
291
- #[ strum( message = "Input must be callable" ) ]
303
+ #[ strum( message = "Input should be callable" ) ]
292
304
CallableType ,
293
305
// ---------------------
294
306
// union errors
0 commit comments