Conversation
|
👍 |
gpluscb
left a comment
There was a problem hiding this comment.
There is an issue with this that needs consideration: the default serialization format of time's types is not rfc3339 (see time-rs/time#672). Without external solutions like the serde_with crate, only OffsetDateTime supports an rfc3339 format by using #[serde(with = time::serde::rfc3339)]. Therefore by default there would be a discrepancy between the generated schema and the serialized data.
For OffsetDateTime the required serde attribute could be documented, for other types such as Time, PrimitiveDateTime, and Date the correct approach is not so clear.
Also if a solution is found that includes Time, PrimitiveDateTime and Date, then UtcDateTime should be added as well.
|
I am interested in this (or #257) and would like to see it implemented. What can I do to help move this forward? |
|
@GREsau what is needed to drive this to completion? |
This pull request adds support for the
timecrate version 0.3 (as the optionaltime03feature) to Schemars, allowing types fromtime(such asDate,Time,PrimitiveDateTime, andOffsetDateTime) to implementJsonSchema. It also includes tests and documentation updates for this new feature.Support for the
time03feature:time03as an optional dependency inschemars/Cargo.toml, with and without theserdefeature for normal and testing builds. [1] [2]README.mdto mention the newtime03feature flag.Implementation for
time03types:time03.rsimplementingJsonSchemaforDate,Time,PrimitiveDateTime, andOffsetDateTime, mapping them to appropriate JSON Schema string formats.time03feature flag inmod.rs.Testing:
time03types intime.rs, including snapshot testing and roundtrip checks.