Möhre
Möhre
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.
I guess the most problems regarding this stem from dates anyways. Maybe just handling them a bit differently would solve like 95% of problems people run into. Again thanks for your input! I will think about this a bit more and create an issue the next days.
19 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.
I totally see that. Maybe the lax mode only works on optional types but again this is highly confusing imo
19 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.
Yeah I see that. Maybe it should just be an optional parameter for the .toJsonSchema({lax:true}). Which is false by default and has some warnings in the docs 🤷‍♂️ Would have to think about this a bit more too
19 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.
This is another case where a loose or lax mode could be helpful for converting to json schema i.e. when multiple types are given only use the valid ones.
19 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.
Merge should work, have not thought about that yet, good idea
19 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.
It is sadly not really possible for me to convert it first and than adding date. Is it possible to target the extract in a nested obj and not loose other definitions i.e.
const foo = type({date:"string.date.iso.parse | Date", bar:"number"});

//to
// {date:"string.date.iso.parse", bar:"number"}
// ?
const foo = type({date:"string.date.iso.parse | Date", bar:"number"});

//to
// {date:"string.date.iso.parse", bar:"number"}
// ?
or in generally edit a nested obj? That would kinda solve my problem I think.
// somthing like
foo.date = "string.date.iso.parse"
// somthing like
foo.date = "string.date.iso.parse"
19 replies
Aarktype
Created by Möhre on 9/11/2024 in #questions
ToJsonSchema fails with narrow
Allright!
36 replies
Aarktype
Created by Möhre on 9/11/2024 in #questions
ToJsonSchema fails with narrow
I see, thanks for the clarification. A kinda loose or lax mode for that would be very helpful!
36 replies
Aarktype
Created by Möhre on 9/11/2024 in #questions
ToJsonSchema fails with narrow
I know atleast for the url there is a type, was just an example. Would pipe work for that?
36 replies
Aarktype
Created by Möhre on 9/11/2024 in #questions
ToJsonSchema fails with narrow
I guess but i thought the in property takes the input types which would be string
36 replies
Aarktype
Created by Möhre on 9/11/2024 in #questions
ToJsonSchema fails with narrow
Uncaught ParseError: Predicate $ark.fn19 is not convertible to JSON Schema
36 replies