2

Implement the `duration` format validator · Issue #265 · Stranger6667/jsonschema...

 3 years ago
source link: https://github.com/Stranger6667/jsonschema-rs/issues/265
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

ZFLloyd commented yesterday

edited

I have taken a look to see if I could implement this but this might end-up being more difficult than expected.

The json-schema spec duration format is based on ISO8601:

From what I can see, jsonschema-rs relies on the chrono for any time related format validation, but it is currently missing a way to parse and validate ISO8601 Durations.
There was some work on this at some point but it seems it has not moved forward in a while (PR Discussion on the implementation in chrono here)

I've tried to look for an already battle-tested Rust parser for ISO8601 Durations, but I did not manage to find one thus far. So implementing the duration format would also entail implementing a proper parser which could prove tricky since I expect jsonschema-rs should be able to deal with untrusted input.

Since I spent some time researching this I wanted to share it here, which can hopefully clarify the issue a little.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK