diff --git a/format_checkers.go b/format_checkers.go index c69c4fa..1e77046 100644 --- a/format_checkers.go +++ b/format_checkers.go @@ -135,7 +135,7 @@ var ( // Use a regex to make sure curly brackets are balanced properly after validating it as a AURI rxURITemplate = regexp.MustCompile("^([^{]*({[^}]*})?)*$") - rxUUID = regexp.MustCompile("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$") + rxUUID = regexp.MustCompile("^(?i)[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$") rxJSONPointer = regexp.MustCompile("^(?:/(?:[^~/]|~0|~1)*)*$") diff --git a/format_checkers_test.go b/format_checkers_test.go index 65b00ba..6742178 100644 --- a/format_checkers_test.go +++ b/format_checkers_test.go @@ -2,8 +2,9 @@ package gojsonschema import ( "encoding/json" - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestUUIDFormatCheckerIsFormat(t *testing.T) { @@ -11,6 +12,8 @@ func TestUUIDFormatCheckerIsFormat(t *testing.T) { assert.True(t, checker.IsFormat("01234567-89ab-cdef-0123-456789abcdef")) assert.True(t, checker.IsFormat("f1234567-89ab-cdef-0123-456789abcdef")) + assert.True(t, checker.IsFormat("01234567-89AB-CDEF-0123-456789ABCDEF")) + assert.True(t, checker.IsFormat("F1234567-89AB-CDEF-0123-456789ABCDEF")) assert.False(t, checker.IsFormat("not-a-uuid")) assert.False(t, checker.IsFormat("g1234567-89ab-cdef-0123-456789abcdef"))