Open lanodan opened 3 months ago
@lanodan please create a PR with a test to reproduce this.
The code uses DateTime.from_iso8601
https://github.com/open-api-spex/open_api_spex/blob/78cf5fd1011d0414a6235fce9978f407d8c63d85/lib/open_api_spex/cast/string.ex#L29 to cast string to DateTime which in doesn't accept the format without an offset:
iex(16)> DateTime.from_iso8601("2024-03-24T14:01:35")
{:error, :missing_offset}
OpenApiSpex.Cast.String.cast(%{value: "2024-03-24T14:01:35", schema: %{format: :"date-time"}, path: [], errors: []})
{:error,
[
%OpenApiSpex.Cast.Error{
reason: :invalid_format,
value: "2024-03-24T14:01:35",
format: :"date-time",
type: nil,
name: nil,
path: [],
length: 0,
meta: %{}
}
]}
For example
2024-03-24T14:01:35
is accepted, yet RFC3339 § 5.6 pointed at by OpenAPI requires a time-offset (either "Z" or/[-+]\d{2}:\d{2}/
).