From 9230cb7fceabdd54dca04ba9f5cc3a9201491a4a Mon Sep 17 00:00:00 2001 From: Alex Gustafsson Date: Tue, 24 Jan 2023 14:01:56 +0100 Subject: [PATCH] Add support for UUID v6-8 --- .github/docs/openapi3.txt | 2 +- openapi3/schema_formats.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt index 28819d73a..30b55d454 100644 --- a/.github/docs/openapi3.txt +++ b/.github/docs/openapi3.txt @@ -1,6 +1,6 @@ const ParameterInPath = "path" ... const TypeArray = "array" ... -const FormatOfStringForUUIDOfRFC4122 = `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$` ... +const FormatOfStringForUUIDOfRFC4122 = `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$` ... const SerializationSimple = "simple" ... var SchemaErrorDetailsDisabled = false ... var CircularReferenceCounter = 3 diff --git a/openapi3/schema_formats.go b/openapi3/schema_formats.go index ecbc0ebfa..1771d2709 100644 --- a/openapi3/schema_formats.go +++ b/openapi3/schema_formats.go @@ -8,8 +8,8 @@ import ( ) const ( - // FormatOfStringForUUIDOfRFC4122 is an optional predefined format for UUID v1-v5 as specified by RFC4122 - FormatOfStringForUUIDOfRFC4122 = `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$` + // FormatOfStringForUUIDOfRFC4122 is an optional predefined format for UUID v1-v8 as specified by RFC4122 + FormatOfStringForUUIDOfRFC4122 = `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$` // FormatOfStringForEmail pattern catches only some suspiciously wrong-looking email addresses. // Use DefineStringFormat(...) if you need something stricter.