@@ -395,6 +395,22 @@ var validateTests = []struct {
395395 input : map [string ]any {"value" : "alice" },
396396 errs : []string {"expected string to be RFC 5322 email: mail: missing '@' or angle-addr" },
397397 },
398+ {
399+ name : "expected email bare addr-spec rejects mailbox with display name" ,
400+ typ : reflect .TypeFor [struct {
401+ Value string "json:\" value\" format:\" email\" "
402+ }](),
403+ input :
map [
string ]
any {
"value" :
"Alice <[email protected] >" },
404+ errs : []string {"expected string to be RFC 5322 email (addr-spec only, no display name)" },
405+ },
406+ {
407+ name : "expected idn-email bare addr-spec rejects mailbox with display name" ,
408+ typ : reflect .TypeFor [struct {
409+ Value string "json:\" value\" format:\" idn-email\" "
410+ }](),
411+ input :
map [
string ]
any {
"value" :
"Name <[email protected] >" },
412+ errs : []string {"expected string to be RFC 5322 email (addr-spec only, no display name)" },
413+ },
398414 {
399415 name : "hostname success" ,
400416 typ : reflect .TypeFor [struct {
@@ -477,6 +493,37 @@ var validateTests = []struct {
477493 input : map [string ]any {"value" : ":" },
478494 errs : []string {"expected string to be RFC 3986 uri: parse \" :\" : missing protocol scheme" },
479495 },
496+ {
497+ name : "expected uri absolute rejects empty string" ,
498+ typ : reflect .TypeFor [struct {
499+ Value string "json:\" value\" format:\" uri\" "
500+ }](),
501+ input : map [string ]any {"value" : "" },
502+ errs : []string {"expected string to be RFC 3986 absolute uri (non-empty scheme)" },
503+ },
504+ {
505+ name : "expected uri absolute rejects path-only reference" ,
506+ typ : reflect .TypeFor [struct {
507+ Value string "json:\" value\" format:\" uri\" "
508+ }](),
509+ input : map [string ]any {"value" : "/relative" },
510+ errs : []string {"expected string to be RFC 3986 absolute uri (non-empty scheme)" },
511+ },
512+ {
513+ name : "expected uri absolute rejects scheme-less token" ,
514+ typ : reflect .TypeFor [struct {
515+ Value string "json:\" value\" format:\" uri\" "
516+ }](),
517+ input : map [string ]any {"value" : "foo" },
518+ errs : []string {"expected string to be RFC 3986 absolute uri (non-empty scheme)" },
519+ },
520+ {
521+ name : "uri-reference allows relative path" ,
522+ typ : reflect .TypeFor [struct {
523+ Value string "json:\" value\" format:\" uri-reference\" "
524+ }](),
525+ input : map [string ]any {"value" : "/relative" },
526+ },
480527 {
481528 name : "uuid success" ,
482529 typ : reflect .TypeFor [struct {
0 commit comments