Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/docs/openapi3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion openapi3/schema_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion openapi3/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
},
},

Expand Down
6 changes: 3 additions & 3 deletions openapi3filter/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Loading