Skip to content

Commit 4e84a71

Browse files
committed
fix: Added uri format message.
1 parent 18ae7ee commit 4e84a71

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

dist/cjs/validation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ exports.validationMessagesFormatters = {
3131
timestamp: () => 'must be a valid ISO 8601 / RFC 3339 timestamp (example: 2018-07-06T12:34:56Z)',
3232
date: () => 'must be a valid ISO 8601 / RFC 3339 date (example: 2018-07-06)',
3333
time: () => 'must be a valid ISO 8601 / RFC 3339 time (example: 12:34:56)',
34+
uri: () => 'must be a valid URI',
3435
hostname: () => 'must be a valid hostname',
3536
ipv4: () => 'must be a valid IPv4',
3637
ipv6: () => 'must be a valid IPv6',

dist/mjs/validation.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const validationMessagesFormatters = {
2424
timestamp: () => 'must be a valid ISO 8601 / RFC 3339 timestamp (example: 2018-07-06T12:34:56Z)',
2525
date: () => 'must be a valid ISO 8601 / RFC 3339 date (example: 2018-07-06)',
2626
time: () => 'must be a valid ISO 8601 / RFC 3339 time (example: 12:34:56)',
27+
uri: () => 'must be a valid URI',
2728
hostname: () => 'must be a valid hostname',
2829
ipv4: () => 'must be a valid IPv4',
2930
ipv6: () => 'must be a valid IPv6',

src/validation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const validationMessagesFormatters: { [key: string]: ValidationFormatter
3636
timestamp: () => 'must be a valid ISO 8601 / RFC 3339 timestamp (example: 2018-07-06T12:34:56Z)',
3737
date: () => 'must be a valid ISO 8601 / RFC 3339 date (example: 2018-07-06)',
3838
time: () => 'must be a valid ISO 8601 / RFC 3339 time (example: 12:34:56)',
39+
uri: () => 'must be a valid URI',
3940
hostname: () => 'must be a valid hostname',
4041
ipv4: () => 'must be a valid IPv4',
4142
ipv6: () => 'must be a valid IPv6',

test/validation.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ t.test('Validation', (t: Test) => {
263263
type: 'string',
264264
format: 'date-time'
265265
},
266+
uri: {
267+
type: 'string',
268+
format: 'uri'
269+
},
266270
noMessage: {
267271
type: 'string',
268272
format: 'noMessage'
@@ -322,6 +326,7 @@ t.test('Validation', (t: Test) => {
322326
date: 'whatever',
323327
time: 'whatever',
324328
dateTime: 'whatever',
329+
uri: 'whatever',
325330
noMessage: true,
326331
arrayPath: ['abc'],
327332
objectPath: {
@@ -363,6 +368,7 @@ t.test('Validation', (t: Test) => {
363368
date: 'must be a valid ISO 8601 / RFC 3339 date (example: 2018-07-06)',
364369
time: 'must be a valid ISO 8601 / RFC 3339 time (example: 12:34:56)',
365370
dateTime: 'must be a valid ISO 8601 / RFC 3339 timestamp (example: 2018-07-06T12:34:56Z)',
371+
uri: 'must be a valid URI',
366372
noMessage: 'must match format "noMessage" (format)',
367373
'needs-quotes': 'must be a valid number',
368374
uniqueItems: 'must NOT have duplicate items (items ## 0 and 1 are identical) (uniqueItems)'

0 commit comments

Comments
 (0)