Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support Spans and DateTimes in JSON Pointer injection #541

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

cstepanian
Copy link
Contributor

@cstepanian cstepanian commented Oct 28, 2024

Resolves #524

This PR adds initial support for reading type-annotated data from JSON objects returned by a Plugin.

Two new data types are supported: jiff::Zoned and jiff::Span.

This implementation expects the JSON to follow a particular format: the data will consist of a JSON object with two required fields, format and data. format must contain a string that references a known format; this PR adds support for "date-time" and "duration". These names are adopted to match JSON Schema's naming. data must contain the data; for both of these added data types, they are represented as JSON strings.

References

@cstepanian cstepanian force-pushed the cstepanian/json_schema branch 2 times, most recently from 42e5348 to 76ecadc Compare October 28, 2024 23:09
@cstepanian cstepanian marked this pull request as ready for review October 28, 2024 23:09
@cstepanian cstepanian changed the title DRAFT: feat: Support Spans and DateTimes in JSON Pointer injection feat: Support Spans and DateTimes in JSON Pointer injection Oct 28, 2024
@cstepanian cstepanian requested review from j-lanson and a team October 28, 2024 23:15
j-lanson
j-lanson previously approved these changes Oct 29, 2024
Copy link
Collaborator

@j-lanson j-lanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks Cal!

This commit enables JSON Pointers to read `jiff:Zoned` and `jiff::Span`
from JSON objects marked as `date-time` and `duration`, respectively.

The implementation expects an object with fields `format` and `data`.
Currently, `format` must contain either "date-time" or "duration".
`data` must include the data to be specially parsed.
@j-lanson j-lanson merged commit aa6ad35 into main Oct 29, 2024
9 checks passed
@cstepanian cstepanian deleted the cstepanian/json_schema branch October 29, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add support for Spans/Datetimes in JSON pointer injection
2 participants