Skip to content

Conversation

@mpreu
Copy link
Contributor

@mpreu mpreu commented Oct 6, 2025

OpenAPI specifies the format date-time as RFC3339 compliant. In a RFC3339 date-time the time-offset is a required component.

The current RFC3339 validation regex defines the time-offset as an optional component. This leads to errors where a timestamp is considered valid by the library but the value still cannot be parsed into a time.Time.

This change makes the time-offset a required component. Relevant tests are changed accordingly.

Links:

Fixes: #1031

OpenAPI specifies the format `date-time` as RFC3339 compliant. In
a RFC3339 `date-time` the `time-offset` is a required component.

The current RFC3339 validation regex defines the `time-offset` as an
optional component. This leads to errors where a timestamp is considered
valid by the library but the value still cannot be parsed into a `time.Time`.

This change makes the `time-offset` a required component. Relevant tests are
changed accordingly.

Links:
- https://datatracker.ietf.org/doc/html/rfc3339#section-5.6

Fixes: getkin#1031
@fenollp fenollp changed the title Fix RFC3339 validation openapi3: fix for RFC3339 validation: time-offset is a required component Oct 20, 2025
@fenollp fenollp merged commit 45db2ad into getkin:master Oct 20, 2025
5 checks passed
@mpreu mpreu deleted the bugfix/rfc3339 branch October 23, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date-time regex allows timezone offset to be missing

2 participants