Repository: getkin/kin-openapi (Go)

Issue:
date-time regex allows timezone offset to be missing
I'm using this library in tandem with oapi codegen. I am validating a request with `?start_time\=2024-10-22T00:00:00-04:00` as a query param. The validation works fine but I was experimenting and removed the timezone offset and sent `?start_time\=2024-10-22T00:00:00` and that seems to make it past the validation from kin openapi and doesn't make it past the codegen generated validation for date-time.

In their library they do 
```
// Time is a special case of a struct that we handle
			parsedTime, err := time.Parse(time.RFC3339Nano, src)
			if err != nil {
				parsedTime, err = time.Parse(types.DateFormat, src)
				if err != nil {
					return fmt.Errorf("error parsing '%s' as RFC3339 or 2006-01-02 time: %s", src, err)
				}
			}
```
time.Parse, so if I'm understanding this right, I think the regex needs to be strengthened to match that validation


Discussion:

Patch:
diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt
index 7d0fa449..7458a1b1 100644
--- a/.github/docs/openapi3.txt
+++ b/.github/docs/openapi3.txt
@@ -38,7 +38,7 @@ const (
 	FormatOfStringDate = `^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|[12][0-9]|3[01])$`
 
 	// FormatOfStringDateTime is a RFC3339 date-time format regexp, for example "2017-07-21T17:32:28Z".
-	FormatOfStringDateTime = `^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)[0-9]{2}:[0-9]{2})?$`
+	FormatOfStringDateTime = `^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)[0-9]{2}:[0-9]{2})$`
 )
 const (
 	SerializationSimple         = "simple"
diff --git a/openapi3/schema_formats.go b/openapi3/schema_formats.go
index 489105b4..da954dc5 100644
--- a/openapi3/schema_formats.go
+++ b/openapi3/schema_formats.go
@@ -44,7 +44,7 @@ const (
 	FormatOfStringDate = `^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|[12][0-9]|3[01])$`
 
 	// FormatOfStringDateTime is a RFC3339 date-time format regexp, for example "2017-07-21T17:32:28Z".
-	FormatOfStringDateTime = `^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)[0-9]{2}:[0-9]{2})?$`
+	FormatOfStringDateTime = `^[0-9]{4}-(0[1-9]|10|11|12)-(0[1-9]|[12][0-9]|3[01])T([0-1][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)[0-9]{2}:[0-9]{2})$`
 )
 
 func init() {


Test patch:
diff --git a/openapi3/schema_test.go b/openapi3/schema_test.go
index a56148e5..ef35dc2f 100644
--- a/openapi3/schema_test.go
+++ b/openapi3/schema_test.go
@@ -489,7 +489,6 @@ var schemaExamples = []schemaExample{
 			"format": "date-time",
 		},
 		AllValid: []any{
-			"2017-12-31T11:59:59",
 			"2017-12-31T11:59:59Z",
 			"2017-12-31T11:59:59-11:30",
 			"2017-12-31T11:59:59+11:30",
@@ -503,6 +502,7 @@ var schemaExamples = []schemaExample{
 			"2017-12-31T11:59:59\n",
 			"2017-12-31T11:59:59.+11:30",
 			"2017-12-31T11:59:59.Z",
+			"2017-12-31T11:59:59",
 		},
 	},
 
diff --git a/openapi3filter/validation_test.go b/openapi3filter/validation_test.go
index 7f78b117..865ffa25 100644
--- a/openapi3filter/validation_test.go
+++ b/openapi3filter/validation_test.go
@@ -248,14 +248,14 @@ func TestFilter(t *testing.T) {
 	// Test query parameter openapi3filter
 	req = ExampleRequest{
 		Method: "POST",
-		URL:    "http://example.com/api/prefix/v/suffix?queryArgAnyOf=ae&queryArgOneOf=ac&queryArgAllOf=2017-12-31T11:59:59",
+		URL:    "http://example.com/api/prefix/v/suffix?queryArgAnyOf=ae&queryArgOneOf=ac&queryArgAllOf=2017-12-31T11:59:59Z",
 	}
 	err = expect(req, resp)
 	require.NoError(t, err)
 
 	req = ExampleRequest{
 		Method: "POST",
-		URL:    "http://example.com/api/prefix/v/suffix?queryArgAnyOf=2017-12-31T11:59:59",
+		URL:    "http://example.com/api/prefix/v/suffix?queryArgAnyOf=2017-12-31T11:59:59Z",
 	}
 	err = expect(req, resp)
 	require.NoError(t, err)
@@ -269,7 +269,7 @@ func TestFilter(t *testing.T) {
 
 	req = ExampleRequest{
 		Method: "POST",
-		URL:    "http://example.com/api/prefix/v/suffix?queryArgOneOf=2017-12-31T11:59:59",
+		URL:    "http://example.com/api/prefix/v/suffix?queryArgOneOf=2017-12-31T11:59:59Z",
 	}
 	err = expect(req, resp)
 	require.IsType(t, &RequestError{}, err)