Josher8a
Aarktype
•Created by Möhre on 9/12/2024 in #questions
Is there a way to parse Dates and date iso strings without losing toJsonSchema capabilities.
22 replies
Aarktype
•Created by Möhre on 9/12/2024 in #questions
Is there a way to parse Dates and date iso strings without losing toJsonSchema capabilities.
Hi David! I'm mashing v2, awesome btw! I encountered that same issue, but I believe a more straightforward approach for being spec compatible is to expose the
format
meta tag to strings and use .narrow
in userland. https://json-schema.org/understanding-json-schema/reference/type#built-in-formats
For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. format allows the schema author to indicate that the string value should be interpreted as a date. By default, format is just an annotation and does not affect validation.
22 replies