vld 0.5.0

Type-safe runtime validation library for Rust, inspired by Zod
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
//! Built-in non-English template tables (`russian()`, `german()`, `spanish()`).
//!
//! Every table covers every key of the English table, plus `type.<name>`
//! entries that translate the `{expected}` / `{received}` type names.

pub(super) const RUSSIAN: &[(&str, &str)] = &[
    ("invalid_type", "Ожидался тип «{expected}», получен «{received}»"),
    ("type.string", "строка"),
    ("type.number", "число"),
    ("type.integer", "целое число"),
    ("type.boolean", "логическое значение"),
    ("type.array", "массив"),
    ("type.object", "объект"),
    ("type.null", "null"),
    ("type.never", "ничего"),
    ("type.date", "дата (ГГГГ-ММ-ДД)"),
    ("type.datetime", "дата и время"),
    ("type.time", "время (ЧЧ:ММ:СС)"),
    ("type.duration", "длительность (секунды или строка)"),
    ("type.decimal", "десятичное число (строка или число)"),
    ("type.path", "путь"),
    ("type.file", "путь к файлу"),
    ("type.socket_addr", "адрес сокета"),
    ("type.ip_network", "IP-сеть (CIDR)"),
    ("type.bytes", "массив байтов"),
    ("type.bytes_or_string", "массив байтов или закодированная строка"),
    ("type.byte", "байт (целое 0..=255)"),
    ("too_small", "Значение должно быть не менее {minimum}"),
    ("too_small.string", "Строка должна содержать не менее {minimum} символов"),
    ("too_small.string_one", "Строка должна содержать не менее {minimum} символа"),
    ("too_small.number", "Число должно быть не менее {minimum}"),
    ("too_small.decimal", "Десятичное число должно быть не менее {minimum}"),
    ("too_small.array", "Массив должен содержать не менее {minimum} элементов"),
    ("too_small.array_one", "Массив должен содержать не менее {minimum} элемента"),
    ("too_small.set", "Множество должно содержать не менее {minimum} уникальных элементов"),
    ("too_small.set_one", "Множество должно содержать не менее {minimum} уникального элемента"),
    ("too_small.record", "Запись должна содержать не менее {minimum} ключей"),
    ("too_small.record_one", "Запись должна содержать не менее {minimum} ключа"),
    ("too_small.object", "Объект должен содержать не менее {minimum} ключей"),
    ("too_small.object_one", "Объект должен содержать не менее {minimum} ключа"),
    ("too_small.bytes", "Длина в байтах должна быть не менее {minimum}"),
    ("too_small.date", "Дата должна быть не раньше {minimum}"),
    ("too_small.datetime", "Дата и время должны быть не раньше {minimum}"),
    ("too_small.time", "Время должно быть не раньше {minimum}"),
    ("too_small.duration", "Длительность должна быть не менее {minimum} с"),
    ("too_small.file", "Размер файла должен быть не менее {minimum} байт"),
    ("too_small.image_width", "Ширина изображения должна быть >= {minimum}"),
    ("too_small.image_height", "Высота изображения должна быть >= {minimum}"),
    ("too_small.port", "Порт должен быть не менее {minimum}"),
    ("too_small.contains", "Массив должен содержать требуемое значение не менее {minimum} раз"),
    ("too_small_exclusive", "Значение должно быть больше {minimum}"),
    ("too_small_exclusive.number", "Число должно быть больше {minimum}"),
    ("too_small_exclusive.decimal", "Десятичное число должно быть больше {minimum}"),
    ("too_big", "Значение должно быть не более {maximum}"),
    ("too_big.string", "Строка должна содержать не более {maximum} символов"),
    ("too_big.string_one", "Строка должна содержать не более {maximum} символа"),
    ("too_big.number", "Число должно быть не более {maximum}"),
    ("too_big.decimal", "Десятичное число должно быть не более {maximum}"),
    ("too_big.array", "Массив должен содержать не более {maximum} элементов"),
    ("too_big.array_one", "Массив должен содержать не более {maximum} элемента"),
    ("too_big.set", "Множество должно содержать не более {maximum} уникальных элементов"),
    ("too_big.set_one", "Множество должно содержать не более {maximum} уникального элемента"),
    ("too_big.record", "Запись должна содержать не более {maximum} ключей"),
    ("too_big.record_one", "Запись должна содержать не более {maximum} ключа"),
    ("too_big.object", "Объект должен содержать не более {maximum} ключей"),
    ("too_big.object_one", "Объект должен содержать не более {maximum} ключа"),
    ("too_big.bytes", "Длина в байтах должна быть не более {maximum}"),
    ("too_big.date", "Дата должна быть не позже {maximum}"),
    ("too_big.datetime", "Дата и время должны быть не позже {maximum}"),
    ("too_big.time", "Время должно быть не позже {maximum}"),
    ("too_big.duration", "Длительность должна быть не более {maximum} с"),
    ("too_big.file", "Размер файла должен быть не более {maximum} байт"),
    ("too_big.image_width", "Ширина изображения должна быть <= {maximum}"),
    ("too_big.image_height", "Высота изображения должна быть <= {maximum}"),
    ("too_big.port", "Порт должен быть не более {maximum}"),
    ("too_big.contains", "Массив должен содержать требуемое значение не более {maximum} раз"),
    ("too_big_exclusive", "Значение должно быть меньше {maximum}"),
    ("too_big_exclusive.number", "Число должно быть меньше {maximum}"),
    ("too_big_exclusive.decimal", "Десятичное число должно быть меньше {maximum}"),
    ("invalid_length", "Длина должна быть ровно {expected}"),
    ("invalid_length.string", "Строка должна содержать ровно {expected} символов"),
    ("invalid_length.string_one", "Строка должна содержать ровно {expected} символ"),
    ("invalid_length.string_few", "Строка должна содержать ровно {expected} символа"),
    ("invalid_length.array", "Массив должен содержать ровно {expected} элементов"),
    ("invalid_length.array_one", "Массив должен содержать ровно {expected} элемент"),
    ("invalid_length.array_few", "Массив должен содержать ровно {expected} элемента"),
    ("invalid_length.tuple", "Ожидался кортеж из {expected} элементов"),
    ("invalid_length.tuple_one", "Ожидался кортеж из {expected} элемента"),
    ("invalid_length.bytes", "Длина в байтах должна быть ровно {expected}"),
    ("invalid_string", "Некорректная строка ({validation})"),
    ("invalid_string.email", "Некорректный адрес электронной почты"),
    ("invalid_string.url", "Некорректный URL"),
    ("invalid_string.url_strict", "Некорректный строгий URL"),
    ("invalid_string.uri", "Некорректный URI"),
    ("invalid_string.uuid", "Некорректный UUID"),
    ("invalid_string.uuid_v1", "Некорректный UUID v1"),
    ("invalid_string.uuid_v4", "Некорректный UUID v4"),
    ("invalid_string.uuid_v7", "Некорректный UUID v7"),
    ("invalid_string.ip", "Некорректный IP-адрес"),
    ("invalid_string.slug", "Некорректный slug"),
    ("invalid_string.color", "Некорректный цвет"),
    ("invalid_string.currency", "Некорректный код валюты"),
    ("invalid_string.country_code", "Некорректный код страны"),
    ("invalid_string.locale", "Некорректная локаль"),
    ("invalid_string.cron", "Некорректное cron-выражение"),
    ("invalid_string.regex", "Строка не соответствует шаблону"),
    ("invalid_string.starts_with", "Строка должна начинаться с \"{prefix}\""),
    ("invalid_string.ends_with", "Строка должна заканчиваться на \"{suffix}\""),
    ("invalid_string.contains", "Строка должна содержать \"{substring}\""),
    ("invalid_string.ipv4", "Некорректный IPv4-адрес"),
    ("invalid_string.ipv6", "Некорректный IPv6-адрес"),
    ("invalid_string.cidr", "Некорректный CIDR"),
    ("invalid_string.mac", "Некорректный MAC-адрес"),
    ("invalid_string.hex", "Некорректная шестнадцатеричная строка"),
    ("invalid_string.credit_card", "Некорректный номер карты"),
    ("invalid_string.phone", "Некорректный номер телефона"),
    ("invalid_string.phone_e164", "Некорректный номер телефона E.164"),
    ("invalid_string.semver", "Некорректная версия semver"),
    ("invalid_string.semver_full", "Некорректная семантическая версия"),
    ("invalid_string.jwt", "Некорректный JWT"),
    ("invalid_string.ascii", "Строка должна содержать только символы ASCII"),
    ("invalid_string.alpha", "Строка должна содержать только буквы"),
    ("invalid_string.alphanumeric", "Строка должна содержать только буквы и цифры"),
    ("invalid_string.lowercase", "Строка должна быть в нижнем регистре"),
    ("invalid_string.uppercase", "Строка должна быть в верхнем регистре"),
    ("invalid_string.base64", "Некорректная строка Base64"),
    ("invalid_string.base64url", "Некорректная строка Base64URL"),
    ("invalid_string.json", "Некорректная строка JSON"),
    ("invalid_string.iso_date", "Некорректная дата ISO (ожидалось ГГГГ-ММ-ДД)"),
    ("invalid_string.iso_datetime", "Некорректные дата и время ISO"),
    ("invalid_string.iso_time", "Некорректное время ISO"),
    ("invalid_string.hostname", "Некорректное имя хоста"),
    ("invalid_string.cuid2", "Некорректный CUID2"),
    ("invalid_string.ulid", "Некорректный ULID"),
    ("invalid_string.nanoid", "Некорректный Nano ID"),
    ("invalid_string.emoji", "Строка должна содержать только эмодзи"),
    ("invalid_format", "Некорректный формат ({format})"),
    ("invalid_format.decimal", "Некорректное десятичное число"),
    ("invalid_format.ip_network", "Некорректная IP-сеть/CIDR"),
    ("invalid_format.ipv4_network", "Ожидалась сеть IPv4"),
    ("invalid_format.ipv6_network", "Ожидалась сеть IPv6"),
    (
        "invalid_format.socket_addr",
        "Некорректный адрес сокета (ожидалось `ipv4:порт` или `[ipv6]:порт`; имена хостов не разрешаются)",
    ),
    ("invalid_format.base64", "Некорректная байтовая строка Base64"),
    ("invalid_format.base64url", "Некорректная байтовая строка Base64URL"),
    ("invalid_format.hex", "Некорректная шестнадцатеричная байтовая строка"),
    ("invalid_format.image", "Не удалось декодировать изображение"),
    ("invalid_format.from_str", "Некорректное значение"),
    ("invalid_date", "Некорректное значение ({kind})"),
    ("invalid_date.date", "Некорректный формат даты: ожидалось ГГГГ-ММ-ДД"),
    ("invalid_date.datetime", "Некорректный формат даты и времени"),
    ("invalid_date.time", "Некорректный формат времени: ожидалось ЧЧ:ММ:СС[.доли]"),
    ("invalid_timezone_offset", "Смещение часового пояса должно быть {expected}"),
    ("not_in_past", "Значение должно быть в прошлом"),
    ("not_in_past.date", "Дата должна быть в прошлом"),
    ("not_in_past.datetime", "Дата и время должны быть в прошлом"),
    ("not_in_future", "Значение должно быть в будущем"),
    ("not_in_future.date", "Дата должна быть в будущем"),
    ("not_in_future.datetime", "Дата и время должны быть в будущем"),
    ("not_int", "Ожидалось целое число"),
    ("not_finite", "Число должно быть конечным"),
    ("not_multiple_of", "Число должно быть кратно {divisor}"),
    (
        "not_safe_integer",
        "Число должно быть безопасным целым (от -(2^53-1) до 2^53-1)",
    ),
    ("invalid_literal", "Ожидалось значение {expected}"),
    ("invalid_enum_value", "Недопустимое значение. Ожидалось одно из: {options}"),
    ("invalid_union", "Значение не соответствует ни одному из вариантов"),
    ("union_variant", "[вариант {n}]"),
    (
        "invalid_discriminator",
        "Недопустимое значение дискриминатора. Ожидалось одно из: {options}",
    ),
    ("not_unique", "Элементы массива должны быть уникальными"),
    ("missing_contains", "Массив должен содержать требуемое значение"),
    ("duplicate_key", "Повторяющийся ключ"),
    (
        "invalid_map_entry",
        "Каждая запись Map должна быть массивом [ключ, значение] длины 2",
    ),
    ("missing_field", "Обязательное поле отсутствует"),
    ("unrecognized_field", "Неизвестное поле"),
    ("path_outside_base", "Путь должен находиться внутри каталога: {base}"),
    ("path_not_absolute", "Путь должен быть абсолютным"),
    ("path_not_relative", "Путь должен быть относительным"),
    ("path_not_found", "Путь не существует"),
    ("path_not_file", "Путь не является файлом"),
    ("path_not_dir", "Путь не является каталогом"),
    ("json_too_deep", "Глубина JSON превышает максимум {max_depth}"),
    (
        "file_type_not_allowed",
        "Файл ({kind}) `{actual}` не разрешён (ожидалось одно из: {allowed})",
    ),
    ("file_type_denied", "Файл ({kind}) `{actual}` запрещён"),
    ("file_type_unknown", "Не удалось определить файл ({kind})"),
    ("checksum_mismatch", "Контрольная сумма {algorithm} не совпадает"),
    ("missing_exif", "Изображение должно содержать метаданные EXIF"),
    ("serialize_error", "Ошибка сериализации: {detail}"),
    ("io_error", "Ошибка ввода-вывода"),
    ("parse_error", "Ошибка разбора входных данных"),
    ("custom", "Ошибка валидации: {code}"),
];

pub(super) const GERMAN: &[(&str, &str)] = &[
    ("invalid_type", "{expected} erwartet, {received} erhalten"),
    ("type.string", "Zeichenkette"),
    ("type.number", "Zahl"),
    ("type.integer", "Ganzzahl"),
    ("type.boolean", "Wahrheitswert"),
    ("type.array", "Array"),
    ("type.object", "Objekt"),
    ("type.null", "null"),
    ("type.never", "nichts"),
    ("type.date", "Datum (JJJJ-MM-TT)"),
    ("type.datetime", "Datum mit Uhrzeit"),
    ("type.time", "Uhrzeit (HH:MM:SS)"),
    ("type.duration", "Dauer (Sekunden oder Zeichenkette)"),
    ("type.decimal", "Dezimalzahl (Zeichenkette oder Zahl)"),
    ("type.path", "Pfad"),
    ("type.file", "Dateipfad"),
    ("type.socket_addr", "Socket-Adresse"),
    ("type.ip_network", "IP-Netz (CIDR)"),
    ("type.bytes", "Byte-Array"),
    ("type.bytes_or_string", "Byte-Array oder kodierte Zeichenkette"),
    ("type.byte", "Byte (Ganzzahl 0..=255)"),
    ("too_small", "Wert muss mindestens {minimum} sein"),
    ("too_small.string", "Zeichenkette muss mindestens {minimum} Zeichen lang sein"),
    ("too_small.string_one", "Zeichenkette muss mindestens {minimum} Zeichen lang sein"),
    ("too_small.number", "Zahl muss mindestens {minimum} sein"),
    ("too_small.decimal", "Dezimalzahl muss mindestens {minimum} sein"),
    ("too_small.array", "Array muss mindestens {minimum} Elemente enthalten"),
    ("too_small.array_one", "Array muss mindestens {minimum} Element enthalten"),
    ("too_small.set", "Menge muss mindestens {minimum} eindeutige Elemente enthalten"),
    ("too_small.set_one", "Menge muss mindestens {minimum} eindeutiges Element enthalten"),
    ("too_small.record", "Datensatz muss mindestens {minimum} Schlüssel enthalten"),
    ("too_small.record_one", "Datensatz muss mindestens {minimum} Schlüssel enthalten"),
    ("too_small.object", "Objekt muss mindestens {minimum} Schlüssel enthalten"),
    ("too_small.object_one", "Objekt muss mindestens {minimum} Schlüssel enthalten"),
    ("too_small.bytes", "Bytelänge muss mindestens {minimum} sein"),
    ("too_small.date", "Datum muss am oder nach dem {minimum} liegen"),
    ("too_small.datetime", "Zeitpunkt muss am oder nach {minimum} liegen"),
    ("too_small.time", "Uhrzeit muss um oder nach {minimum} liegen"),
    ("too_small.duration", "Dauer muss mindestens {minimum} s betragen"),
    ("too_small.file", "Dateigröße muss mindestens {minimum} Bytes betragen"),
    ("too_small.image_width", "Bildbreite muss >= {minimum} sein"),
    ("too_small.image_height", "Bildhöhe muss >= {minimum} sein"),
    ("too_small.port", "Port muss mindestens {minimum} sein"),
    ("too_small.contains", "Array muss den geforderten Wert mindestens {minimum}-mal enthalten"),
    ("too_small_exclusive", "Wert muss größer als {minimum} sein"),
    ("too_small_exclusive.number", "Zahl muss größer als {minimum} sein"),
    ("too_small_exclusive.decimal", "Dezimalzahl muss größer als {minimum} sein"),
    ("too_big", "Wert darf höchstens {maximum} sein"),
    ("too_big.string", "Zeichenkette darf höchstens {maximum} Zeichen lang sein"),
    ("too_big.string_one", "Zeichenkette darf höchstens {maximum} Zeichen lang sein"),
    ("too_big.number", "Zahl darf höchstens {maximum} sein"),
    ("too_big.decimal", "Dezimalzahl darf höchstens {maximum} sein"),
    ("too_big.array", "Array darf höchstens {maximum} Elemente enthalten"),
    ("too_big.array_one", "Array darf höchstens {maximum} Element enthalten"),
    ("too_big.set", "Menge darf höchstens {maximum} eindeutige Elemente enthalten"),
    ("too_big.set_one", "Menge darf höchstens {maximum} eindeutiges Element enthalten"),
    ("too_big.record", "Datensatz darf höchstens {maximum} Schlüssel enthalten"),
    ("too_big.record_one", "Datensatz darf höchstens {maximum} Schlüssel enthalten"),
    ("too_big.object", "Objekt darf höchstens {maximum} Schlüssel enthalten"),
    ("too_big.object_one", "Objekt darf höchstens {maximum} Schlüssel enthalten"),
    ("too_big.bytes", "Bytelänge darf höchstens {maximum} sein"),
    ("too_big.date", "Datum muss am oder vor dem {maximum} liegen"),
    ("too_big.datetime", "Zeitpunkt muss am oder vor {maximum} liegen"),
    ("too_big.time", "Uhrzeit muss um oder vor {maximum} liegen"),
    ("too_big.duration", "Dauer darf höchstens {maximum} s betragen"),
    ("too_big.file", "Dateigröße darf höchstens {maximum} Bytes betragen"),
    ("too_big.image_width", "Bildbreite muss <= {maximum} sein"),
    ("too_big.image_height", "Bildhöhe muss <= {maximum} sein"),
    ("too_big.port", "Port darf höchstens {maximum} sein"),
    ("too_big.contains", "Array darf den geforderten Wert höchstens {maximum}-mal enthalten"),
    ("too_big_exclusive", "Wert muss kleiner als {maximum} sein"),
    ("too_big_exclusive.number", "Zahl muss kleiner als {maximum} sein"),
    ("too_big_exclusive.decimal", "Dezimalzahl muss kleiner als {maximum} sein"),
    ("invalid_length", "Länge muss genau {expected} sein"),
    ("invalid_length.string", "Zeichenkette muss genau {expected} Zeichen lang sein"),
    ("invalid_length.string_one", "Zeichenkette muss genau {expected} Zeichen lang sein"),
    ("invalid_length.array", "Array muss genau {expected} Elemente enthalten"),
    ("invalid_length.array_one", "Array muss genau {expected} Element enthalten"),
    ("invalid_length.tuple", "Tupel mit {expected} Elementen erwartet"),
    ("invalid_length.tuple_one", "Tupel mit {expected} Element erwartet"),
    ("invalid_length.bytes", "Bytelänge muss genau {expected} sein"),
    ("invalid_string", "Ungültige Zeichenkette ({validation})"),
    ("invalid_string.email", "Ungültige E-Mail-Adresse"),
    ("invalid_string.url", "Ungültige URL"),
    ("invalid_string.url_strict", "Ungültige strikte URL"),
    ("invalid_string.uri", "Ungültige URI"),
    ("invalid_string.uuid", "Ungültige UUID"),
    ("invalid_string.uuid_v1", "Ungültige UUID v1"),
    ("invalid_string.uuid_v4", "Ungültige UUID v4"),
    ("invalid_string.uuid_v7", "Ungültige UUID v7"),
    ("invalid_string.ip", "Ungültige IP-Adresse"),
    ("invalid_string.slug", "Ungültiger Slug"),
    ("invalid_string.color", "Ungültige Farbe"),
    ("invalid_string.currency", "Ungültiger Währungscode"),
    ("invalid_string.country_code", "Ungültiger Ländercode"),
    ("invalid_string.locale", "Ungültiges Gebietsschema"),
    ("invalid_string.cron", "Ungültiger Cron-Ausdruck"),
    ("invalid_string.regex", "Zeichenkette entspricht nicht dem Muster"),
    ("invalid_string.starts_with", "Zeichenkette muss mit \"{prefix}\" beginnen"),
    ("invalid_string.ends_with", "Zeichenkette muss mit \"{suffix}\" enden"),
    ("invalid_string.contains", "Zeichenkette muss \"{substring}\" enthalten"),
    ("invalid_string.ipv4", "Ungültige IPv4-Adresse"),
    ("invalid_string.ipv6", "Ungültige IPv6-Adresse"),
    ("invalid_string.cidr", "Ungültiger CIDR"),
    ("invalid_string.mac", "Ungültige MAC-Adresse"),
    ("invalid_string.hex", "Ungültige Hexadezimal-Zeichenkette"),
    ("invalid_string.credit_card", "Ungültige Kreditkartennummer"),
    ("invalid_string.phone", "Ungültige Telefonnummer"),
    ("invalid_string.phone_e164", "Ungültige E.164-Telefonnummer"),
    ("invalid_string.semver", "Ungültige Semver-Version"),
    ("invalid_string.semver_full", "Ungültige semantische Version"),
    ("invalid_string.jwt", "Ungültiges JWT"),
    ("invalid_string.ascii", "Zeichenkette darf nur ASCII-Zeichen enthalten"),
    ("invalid_string.alpha", "Zeichenkette darf nur Buchstaben enthalten"),
    ("invalid_string.alphanumeric", "Zeichenkette darf nur Buchstaben und Ziffern enthalten"),
    ("invalid_string.lowercase", "Zeichenkette muss kleingeschrieben sein"),
    ("invalid_string.uppercase", "Zeichenkette muss großgeschrieben sein"),
    ("invalid_string.base64", "Ungültige Base64-Zeichenkette"),
    ("invalid_string.base64url", "Ungültige Base64URL-Zeichenkette"),
    ("invalid_string.json", "Ungültige JSON-Zeichenkette"),
    ("invalid_string.iso_date", "Ungültiges ISO-Datum (erwartet JJJJ-MM-TT)"),
    ("invalid_string.iso_datetime", "Ungültiger ISO-Zeitpunkt"),
    ("invalid_string.iso_time", "Ungültige ISO-Uhrzeit"),
    ("invalid_string.hostname", "Ungültiger Hostname"),
    ("invalid_string.cuid2", "Ungültige CUID2"),
    ("invalid_string.ulid", "Ungültige ULID"),
    ("invalid_string.nanoid", "Ungültige Nano ID"),
    ("invalid_string.emoji", "Zeichenkette darf nur Emojis enthalten"),
    ("invalid_format", "Ungültiges Format ({format})"),
    ("invalid_format.decimal", "Ungültiger Dezimalwert"),
    ("invalid_format.ip_network", "Ungültiges IP-Netz/CIDR"),
    ("invalid_format.ipv4_network", "IPv4-Netz erwartet"),
    ("invalid_format.ipv6_network", "IPv6-Netz erwartet"),
    (
        "invalid_format.socket_addr",
        "Ungültige Socket-Adresse (erwartet `ipv4:port` oder `[ipv6]:port`; Hostnamen werden nicht aufgelöst)",
    ),
    ("invalid_format.base64", "Ungültige Base64-Bytefolge"),
    ("invalid_format.base64url", "Ungültige Base64URL-Bytefolge"),
    ("invalid_format.hex", "Ungültige Hex-Bytefolge"),
    ("invalid_format.image", "Bild konnte nicht dekodiert werden"),
    ("invalid_format.from_str", "Ungültiger Wert"),
    ("invalid_date", "Ungültiger Wert ({kind})"),
    ("invalid_date.date", "Ungültiges Datumsformat: erwartet JJJJ-MM-TT"),
    ("invalid_date.datetime", "Ungültiges Zeitpunktformat"),
    ("invalid_date.time", "Ungültiges Uhrzeitformat: erwartet HH:MM:SS[.Bruchteil]"),
    ("invalid_timezone_offset", "Zeitzonenversatz muss {expected} sein"),
    ("not_in_past", "Wert muss in der Vergangenheit liegen"),
    ("not_in_past.date", "Datum muss in der Vergangenheit liegen"),
    ("not_in_past.datetime", "Zeitpunkt muss in der Vergangenheit liegen"),
    ("not_in_future", "Wert muss in der Zukunft liegen"),
    ("not_in_future.date", "Datum muss in der Zukunft liegen"),
    ("not_in_future.datetime", "Zeitpunkt muss in der Zukunft liegen"),
    ("not_int", "Ganzzahl erwartet"),
    ("not_finite", "Zahl muss endlich sein"),
    ("not_multiple_of", "Zahl muss ein Vielfaches von {divisor} sein"),
    (
        "not_safe_integer",
        "Zahl muss eine sichere Ganzzahl sein (-(2^53-1) bis 2^53-1)",
    ),
    ("invalid_literal", "Literal {expected} erwartet"),
    ("invalid_enum_value", "Ungültiger Enum-Wert. Erwartet einer von: {options}"),
    ("invalid_union", "Eingabe passt zu keiner Variante der Union"),
    ("union_variant", "[Variante {n}]"),
    (
        "invalid_discriminator",
        "Ungültiger Diskriminatorwert. Erwartet einer von: {options}",
    ),
    ("not_unique", "Array-Elemente müssen eindeutig sein"),
    ("missing_contains", "Array muss den geforderten Wert enthalten"),
    ("duplicate_key", "Doppelter Map-Schlüssel"),
    (
        "invalid_map_entry",
        "Jeder Map-Eintrag muss ein [Schlüssel, Wert]-Array der Länge 2 sein",
    ),
    ("missing_field", "Pflichtfeld fehlt"),
    ("unrecognized_field", "Unbekanntes Feld"),
    ("path_outside_base", "Pfad muss innerhalb des Basisverzeichnisses liegen: {base}"),
    ("path_not_absolute", "Pfad muss absolut sein"),
    ("path_not_relative", "Pfad muss relativ sein"),
    ("path_not_found", "Pfad existiert nicht"),
    ("path_not_file", "Pfad ist keine Datei"),
    ("path_not_dir", "Pfad ist kein Verzeichnis"),
    ("json_too_deep", "JSON-Tiefe überschreitet das Maximum {max_depth}"),
    (
        "file_type_not_allowed",
        "Datei ({kind}) `{actual}` ist nicht erlaubt (erwartet einer von: {allowed})",
    ),
    ("file_type_denied", "Datei ({kind}) `{actual}` ist verboten"),
    ("file_type_unknown", "Datei ({kind}) konnte nicht erkannt werden"),
    ("checksum_mismatch", "{algorithm}-Prüfsumme stimmt nicht überein"),
    ("missing_exif", "Bild muss EXIF-Metadaten enthalten"),
    ("serialize_error", "Serialisierungsfehler: {detail}"),
    ("io_error", "E/A-Fehler"),
    ("parse_error", "Eingabe konnte nicht verarbeitet werden"),
    ("custom", "Validierungsfehler: {code}"),
];

pub(super) const SPANISH: &[(&str, &str)] = &[
    ("invalid_type", "Se esperaba {expected}, se recibió {received}"),
    ("type.string", "cadena"),
    ("type.number", "número"),
    ("type.integer", "entero"),
    ("type.boolean", "booleano"),
    ("type.array", "arreglo"),
    ("type.object", "objeto"),
    ("type.null", "null"),
    ("type.never", "nada"),
    ("type.date", "fecha (AAAA-MM-DD)"),
    ("type.datetime", "fecha y hora"),
    ("type.time", "hora (HH:MM:SS)"),
    ("type.duration", "duración (segundos o cadena)"),
    ("type.decimal", "decimal (cadena o número)"),
    ("type.path", "ruta"),
    ("type.file", "ruta de archivo"),
    ("type.socket_addr", "dirección de socket"),
    ("type.ip_network", "red IP (CIDR)"),
    ("type.bytes", "arreglo de bytes"),
    ("type.bytes_or_string", "arreglo de bytes o cadena codificada"),
    ("type.byte", "byte (entero 0..=255)"),
    ("too_small", "El valor debe ser al menos {minimum}"),
    ("too_small.string", "La cadena debe tener al menos {minimum} caracteres"),
    ("too_small.string_one", "La cadena debe tener al menos {minimum} carácter"),
    ("too_small.number", "El número debe ser al menos {minimum}"),
    ("too_small.decimal", "El decimal debe ser al menos {minimum}"),
    ("too_small.array", "El arreglo debe tener al menos {minimum} elementos"),
    ("too_small.array_one", "El arreglo debe tener al menos {minimum} elemento"),
    ("too_small.set", "El conjunto debe tener al menos {minimum} elementos únicos"),
    ("too_small.set_one", "El conjunto debe tener al menos {minimum} elemento único"),
    ("too_small.record", "El registro debe tener al menos {minimum} claves"),
    ("too_small.record_one", "El registro debe tener al menos {minimum} clave"),
    ("too_small.object", "El objeto debe contener al menos {minimum} claves"),
    ("too_small.object_one", "El objeto debe contener al menos {minimum} clave"),
    ("too_small.bytes", "La longitud en bytes debe ser al menos {minimum}"),
    ("too_small.date", "La fecha debe ser igual o posterior a {minimum}"),
    ("too_small.datetime", "La fecha y hora debe ser igual o posterior a {minimum}"),
    ("too_small.time", "La hora debe ser igual o posterior a {minimum}"),
    ("too_small.duration", "La duración debe ser al menos {minimum} s"),
    ("too_small.file", "El tamaño del archivo debe ser al menos {minimum} bytes"),
    ("too_small.image_width", "El ancho de la imagen debe ser >= {minimum}"),
    ("too_small.image_height", "El alto de la imagen debe ser >= {minimum}"),
    ("too_small.port", "El puerto debe ser al menos {minimum}"),
    ("too_small.contains", "El arreglo debe contener el valor requerido al menos {minimum} vez/veces"),
    ("too_small_exclusive", "El valor debe ser mayor que {minimum}"),
    ("too_small_exclusive.number", "El número debe ser mayor que {minimum}"),
    ("too_small_exclusive.decimal", "El decimal debe ser mayor que {minimum}"),
    ("too_big", "El valor debe ser como máximo {maximum}"),
    ("too_big.string", "La cadena debe tener como máximo {maximum} caracteres"),
    ("too_big.string_one", "La cadena debe tener como máximo {maximum} carácter"),
    ("too_big.number", "El número debe ser como máximo {maximum}"),
    ("too_big.decimal", "El decimal debe ser como máximo {maximum}"),
    ("too_big.array", "El arreglo debe tener como máximo {maximum} elementos"),
    ("too_big.array_one", "El arreglo debe tener como máximo {maximum} elemento"),
    ("too_big.set", "El conjunto debe tener como máximo {maximum} elementos únicos"),
    ("too_big.set_one", "El conjunto debe tener como máximo {maximum} elemento único"),
    ("too_big.record", "El registro debe tener como máximo {maximum} claves"),
    ("too_big.record_one", "El registro debe tener como máximo {maximum} clave"),
    ("too_big.object", "El objeto debe contener como máximo {maximum} claves"),
    ("too_big.object_one", "El objeto debe contener como máximo {maximum} clave"),
    ("too_big.bytes", "La longitud en bytes debe ser como máximo {maximum}"),
    ("too_big.date", "La fecha debe ser igual o anterior a {maximum}"),
    ("too_big.datetime", "La fecha y hora debe ser igual o anterior a {maximum}"),
    ("too_big.time", "La hora debe ser igual o anterior a {maximum}"),
    ("too_big.duration", "La duración debe ser como máximo {maximum} s"),
    ("too_big.file", "El tamaño del archivo debe ser como máximo {maximum} bytes"),
    ("too_big.image_width", "El ancho de la imagen debe ser <= {maximum}"),
    ("too_big.image_height", "El alto de la imagen debe ser <= {maximum}"),
    ("too_big.port", "El puerto debe ser como máximo {maximum}"),
    ("too_big.contains", "El arreglo debe contener el valor requerido como máximo {maximum} vez/veces"),
    ("too_big_exclusive", "El valor debe ser menor que {maximum}"),
    ("too_big_exclusive.number", "El número debe ser menor que {maximum}"),
    ("too_big_exclusive.decimal", "El decimal debe ser menor que {maximum}"),
    ("invalid_length", "La longitud debe ser exactamente {expected}"),
    ("invalid_length.string", "La cadena debe tener exactamente {expected} caracteres"),
    ("invalid_length.string_one", "La cadena debe tener exactamente {expected} carácter"),
    ("invalid_length.array", "El arreglo debe tener exactamente {expected} elementos"),
    ("invalid_length.array_one", "El arreglo debe tener exactamente {expected} elemento"),
    ("invalid_length.tuple", "Se esperaba una tupla de {expected} elementos"),
    ("invalid_length.tuple_one", "Se esperaba una tupla de {expected} elemento"),
    ("invalid_length.bytes", "La longitud en bytes debe ser exactamente {expected}"),
    ("invalid_string", "Cadena inválida ({validation})"),
    ("invalid_string.email", "Correo electrónico inválido"),
    ("invalid_string.url", "URL inválida"),
    ("invalid_string.url_strict", "URL estricta inválida"),
    ("invalid_string.uri", "URI inválida"),
    ("invalid_string.uuid", "UUID inválido"),
    ("invalid_string.uuid_v1", "UUID v1 inválido"),
    ("invalid_string.uuid_v4", "UUID v4 inválido"),
    ("invalid_string.uuid_v7", "UUID v7 inválido"),
    ("invalid_string.ip", "Dirección IP inválida"),
    ("invalid_string.slug", "Slug inválido"),
    ("invalid_string.color", "Color inválido"),
    ("invalid_string.currency", "Código de moneda inválido"),
    ("invalid_string.country_code", "Código de país inválido"),
    ("invalid_string.locale", "Configuración regional inválida"),
    ("invalid_string.cron", "Expresión cron inválida"),
    ("invalid_string.regex", "La cadena no coincide con el patrón"),
    ("invalid_string.starts_with", "La cadena debe empezar con \"{prefix}\""),
    ("invalid_string.ends_with", "La cadena debe terminar con \"{suffix}\""),
    ("invalid_string.contains", "La cadena debe contener \"{substring}\""),
    ("invalid_string.ipv4", "Dirección IPv4 inválida"),
    ("invalid_string.ipv6", "Dirección IPv6 inválida"),
    ("invalid_string.cidr", "CIDR inválido"),
    ("invalid_string.mac", "Dirección MAC inválida"),
    ("invalid_string.hex", "Cadena hexadecimal inválida"),
    ("invalid_string.credit_card", "Número de tarjeta inválido"),
    ("invalid_string.phone", "Número de teléfono inválido"),
    ("invalid_string.phone_e164", "Número de teléfono E.164 inválido"),
    ("invalid_string.semver", "Versión semver inválida"),
    ("invalid_string.semver_full", "Versión semántica inválida"),
    ("invalid_string.jwt", "JWT inválido"),
    ("invalid_string.ascii", "La cadena solo debe contener caracteres ASCII"),
    ("invalid_string.alpha", "La cadena solo debe contener letras"),
    ("invalid_string.alphanumeric", "La cadena solo debe contener letras y números"),
    ("invalid_string.lowercase", "La cadena debe estar en minúsculas"),
    ("invalid_string.uppercase", "La cadena debe estar en mayúsculas"),
    ("invalid_string.base64", "Cadena Base64 inválida"),
    ("invalid_string.base64url", "Cadena Base64URL inválida"),
    ("invalid_string.json", "Cadena JSON inválida"),
    ("invalid_string.iso_date", "Fecha ISO inválida (se esperaba AAAA-MM-DD)"),
    ("invalid_string.iso_datetime", "Fecha y hora ISO inválida"),
    ("invalid_string.iso_time", "Hora ISO inválida"),
    ("invalid_string.hostname", "Nombre de host inválido"),
    ("invalid_string.cuid2", "CUID2 inválido"),
    ("invalid_string.ulid", "ULID inválido"),
    ("invalid_string.nanoid", "Nano ID inválido"),
    ("invalid_string.emoji", "La cadena solo debe contener emojis"),
    ("invalid_format", "Formato inválido ({format})"),
    ("invalid_format.decimal", "Valor decimal inválido"),
    ("invalid_format.ip_network", "Red IP/CIDR inválida"),
    ("invalid_format.ipv4_network", "Se esperaba una red IPv4"),
    ("invalid_format.ipv6_network", "Se esperaba una red IPv6"),
    (
        "invalid_format.socket_addr",
        "Dirección de socket inválida (se esperaba `ipv4:puerto` o `[ipv6]:puerto`; los nombres de host no se resuelven)",
    ),
    ("invalid_format.base64", "Cadena de bytes Base64 inválida"),
    ("invalid_format.base64url", "Cadena de bytes Base64URL inválida"),
    ("invalid_format.hex", "Cadena de bytes hexadecimal inválida"),
    ("invalid_format.image", "No se pudo decodificar la imagen"),
    ("invalid_format.from_str", "Valor inválido"),
    ("invalid_date", "Valor inválido ({kind})"),
    ("invalid_date.date", "Formato de fecha inválido: se esperaba AAAA-MM-DD"),
    ("invalid_date.datetime", "Formato de fecha y hora inválido"),
    ("invalid_date.time", "Formato de hora inválido: se esperaba HH:MM:SS[.fracción]"),
    ("invalid_timezone_offset", "El desfase horario debe ser {expected}"),
    ("not_in_past", "El valor debe estar en el pasado"),
    ("not_in_past.date", "La fecha debe estar en el pasado"),
    ("not_in_past.datetime", "La fecha y hora debe estar en el pasado"),
    ("not_in_future", "El valor debe estar en el futuro"),
    ("not_in_future.date", "La fecha debe estar en el futuro"),
    ("not_in_future.datetime", "La fecha y hora debe estar en el futuro"),
    ("not_int", "Se esperaba un número entero"),
    ("not_finite", "El número debe ser finito"),
    ("not_multiple_of", "El número debe ser múltiplo de {divisor}"),
    (
        "not_safe_integer",
        "El número debe ser un entero seguro (-(2^53-1) a 2^53-1)",
    ),
    ("invalid_literal", "Se esperaba el literal {expected}"),
    ("invalid_enum_value", "Valor de enumeración inválido. Se esperaba uno de: {options}"),
    ("invalid_union", "La entrada no coincide con ninguna variante de la unión"),
    ("union_variant", "[variante {n}]"),
    (
        "invalid_discriminator",
        "Valor de discriminador inválido. Se esperaba uno de: {options}",
    ),
    ("not_unique", "Los elementos del arreglo deben ser únicos"),
    ("missing_contains", "El arreglo debe contener el valor requerido"),
    ("duplicate_key", "Clave de mapa duplicada"),
    (
        "invalid_map_entry",
        "Cada entrada del Map debe ser un arreglo [clave, valor] de longitud 2",
    ),
    ("missing_field", "Campo obligatorio faltante"),
    ("unrecognized_field", "Campo no reconocido"),
    ("path_outside_base", "La ruta debe estar dentro del directorio base: {base}"),
    ("path_not_absolute", "La ruta debe ser absoluta"),
    ("path_not_relative", "La ruta debe ser relativa"),
    ("path_not_found", "La ruta no existe"),
    ("path_not_file", "La ruta no es un archivo"),
    ("path_not_dir", "La ruta no es un directorio"),
    ("json_too_deep", "La profundidad del JSON supera el máximo {max_depth}"),
    (
        "file_type_not_allowed",
        "El archivo ({kind}) `{actual}` no está permitido (se esperaba uno de: {allowed})",
    ),
    ("file_type_denied", "El archivo ({kind}) `{actual}` está denegado"),
    ("file_type_unknown", "No se pudo detectar el archivo ({kind})"),
    ("checksum_mismatch", "La suma de verificación {algorithm} no coincide"),
    ("missing_exif", "La imagen debe contener metadatos EXIF"),
    ("serialize_error", "Error de serialización: {detail}"),
    ("io_error", "Error de E/S"),
    ("parse_error", "Error al procesar la entrada"),
    ("custom", "Error de validación: {code}"),
];