Skip to content

Commit

Permalink
Update rfc422 regex as per spec: 'case insensitive on input' (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-dau authored Dec 18, 2021
1 parent f13ef7f commit 4ce78d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openapi3/schema_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

const (
// FormatOfStringForUUIDOfRFC4122 is an optional predefined format for UUID v1-v5 as specified by RFC4122
FormatOfStringForUUIDOfRFC4122 = `^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`
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}$`
)

//FormatCallback custom check on exotic formats
Expand Down
13 changes: 13 additions & 0 deletions openapi3/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,26 @@ var schemaExamples = []schemaExample{
"dd7d8481-81a3-407f-95f0-a2f1cb382a4b",
"dcba3901-2fba-48c1-9db2-00422055804e",
"ace8e3be-c254-4c10-8859-1401d9a9d52a",
"DD7D8481-81A3-407F-95F0-A2F1CB382A4B",
"DCBA3901-2FBA-48C1-9DB2-00422055804E",
"ACE8E3BE-C254-4C10-8859-1401D9A9D52A",
"dd7D8481-81A3-407f-95F0-A2F1CB382A4B",
"DCBA3901-2FBA-48C1-9db2-00422055804e",
"ACE8E3BE-c254-4C10-8859-1401D9A9D52A",
},
AllInvalid: []interface{}{
nil,
"g39840b1-d0ef-446d-e555-48fcca50a90a",
"4cf3i040-ea14-4daa-b0b5-ea9329473519",
"aaf85740-7e27-4b4f-b4554-a03a43b1f5e3",
"56f5bff4-z4b6-48e6-a10d-b6cf66a83b04",
"G39840B1-D0EF-446D-E555-48FCCA50A90A",
"4CF3I040-EA14-4DAA-B0B5-EA9329473519",
"AAF85740-7E27-4B4F-B4554-A03A43B1F5E3",
"56F5BFF4-Z4B6-48E6-A10D-B6CF66A83B04",
"4CF3I040-EA14-4Daa-B0B5-EA9329473519",
"AAf85740-7E27-4B4F-B4554-A03A43b1F5E3",
"56F5Bff4-Z4B6-48E6-a10D-B6CF66A83B04",
},
},

Expand Down

0 comments on commit 4ce78d8

Please sign in to comment.