Which mechanism in OAS 3.0 enforces regional time zone constraints for date-time formats?
0 reputation · 20 Jun 2021, 07:48 UTC
The OpenAPI Specification (OAS) 3.0 utilizes the string type with a format: date-time modifier to represent timestamps. According to the specification, this format adheres to RFC 3339, which allows for the inclusion of a time zone offset.
While RFC 3339 supports offsets, the specification does not define a native way to mandate a specific regional time zone (e.g., UTC-5) for all incoming requests or outgoing responses. This leaves the enforcement of regional time zone consistency to the implementation layer of the API rather than the contract definition.
When designing a contract for a globally distributed system, it is unclear how to communicate a strict time zone requirement to clients without relying on non-standard extensions. Does OAS 3.0 provide a standard attribute to restrict the allowed offsets for a date-time field, or is the use of custom x- extensions the only documented approach for this requirement?