Skip to content

Conversation

mpreu
Copy link

@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
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
1 participant