Repository navigation
load ufoLib2's JSON wrapper for lib dates - #429
Merged
Merged
Conversation
ufoLib2 now writes plist dates in libs as {"type":
"com.github.fonttools.ufoLib2.lib.plist.date", "date": <UTC string>}, using
the same string as a plist <date>. Turn it back into a plist::Value::Date,
like the data wrapper.
Collaborator
Author
|
FWIW, I made a JSON schema for ufoLib2's JSON format: fonttools/ufoLib2#466. It includes the new date wrapper, and could be used to validate the test fixtures here (they do validate). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ufoLib2 used to write plist dates in libs as bare ISO strings (and only with orjson; the stdlib json just raised TypeError), so the JSON loader got a string where
Font::loadgets a date.fonttools/ufoLib2#463 (just merged) changed that to a wrapper like the one for binary data,
{"type": "com.github.fonttools.ufoLib2.lib.plist.date", "date": "2020-01-02T03:04:05Z"}, where the string is the same as in a plist<date>.This PR turns the wrapper back into a
plist::Value::Date, with the same rules as the data wrapper: only an object with exactly thetypeanddatekeys counts as one (anything else stays a dictionary), and an invalid date is an error.Bare strings written by older ufoLib2 versions still load as strings.