@@ -19,7 +19,7 @@ const isValidURITemplate = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#.
19
19
// Default Json-Schema formats: date-time, email, hostname, ipv4, ipv6, uri, uriref
20
20
const formatValidators = {
21
21
date : ( draft , schema , value , pointer ) => {
22
- if ( typeof value !== "string" ) {
22
+ if ( typeof value !== "string" || value === "" ) {
23
23
return undefined ;
24
24
}
25
25
// https://github.com/cfworker/cfworker/blob/main/packages/json-schema/src/format.ts
@@ -42,7 +42,7 @@ const formatValidators = {
42
42
return errors . formatDateError ( { value, pointer, schema } ) ;
43
43
} ,
44
44
"date-time" : ( draft , schema , value , pointer ) => {
45
- if ( typeof value !== "string" ) {
45
+ if ( typeof value !== "string" || value === "" ) {
46
46
return undefined ;
47
47
}
48
48
if ( value === "" || isValidDateTime . test ( value ) ) {
@@ -55,7 +55,7 @@ const formatValidators = {
55
55
} ,
56
56
email : ( draft , schema , value , pointer ) => {
57
57
// taken from https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js
58
- if ( typeof value !== "string" ) {
58
+ if ( typeof value !== "string" || value === "" ) {
59
59
return undefined ;
60
60
}
61
61
if ( value [ 0 ] === '"' ) {
@@ -145,7 +145,7 @@ const formatValidators = {
145
145
return errors . formatRegExError ( { value, pointer, schema } ) ;
146
146
} ,
147
147
time : ( draft , schema , value , pointer ) => {
148
- if ( typeof value !== "string" ) {
148
+ if ( typeof value !== "string" || value === "" ) {
149
149
return undefined ;
150
150
}
151
151
// https://github.com/cfworker/cfworker/blob/main/packages/json-schema/src/format.ts
0 commit comments