Merge pull request #65 from brandur/uuid-format

Add support for "uuid" format
diff --git a/format_checkers.go b/format_checkers.go
index a6dff32..8be4210 100644
--- a/format_checkers.go
+++ b/format_checkers.go
@@ -56,6 +56,9 @@
 
 	// HostnameFormatChecker validates a hostname is in the correct format
 	HostnameFormatChecker struct{}
+
+	// UUIDFormatChecker validates a UUID is in the correct format
+	UUIDFormatChecker struct{}
 )
 
 var (
@@ -69,6 +72,7 @@
 			"ipv4":      IPV4FormatChecker{},
 			"ipv6":      IPV6FormatChecker{},
 			"uri":       URIFormatChecker{},
+			"uuid":      UUIDFormatChecker{},
 		},
 	}
 
@@ -77,6 +81,8 @@
 
 	// Regex credit: https://www.socketloop.com/tutorials/golang-validate-hostname
 	rxHostname = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`)
+
+	rxUUID = regexp.MustCompile("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$")
 )
 
 // Add adds a FormatChecker to the FormatCheckerChain
@@ -165,3 +171,7 @@
 func (f HostnameFormatChecker) IsFormat(input string) bool {
 	return rxHostname.MatchString(input)
 }
+
+func (f UUIDFormatChecker) IsFormat(input string) bool {
+	return rxUUID.MatchString(input)
+}
diff --git a/format_checkers_test.go b/format_checkers_test.go
new file mode 100644
index 0000000..04db0e7
--- /dev/null
+++ b/format_checkers_test.go
@@ -0,0 +1,16 @@
+package gojsonschema
+
+import (
+	"github.com/stretchr/testify/assert"
+	"testing"
+)
+
+func TestUUIDFormatCheckerIsFormat(t *testing.T) {
+	checker := UUIDFormatChecker{}
+
+	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"))
+}