Use rescript-schema V9 - #428
Conversation
| ~shouldCopyCurrentEntity, | ||
| ) => { | ||
| let row = historyRow->S.serializeOrRaiseWith(self.schema) | ||
| let row = historyRow->S.reverseConvertToJsonOrThrow(self.schema) |
There was a problem hiding this comment.
What is reverseConvertToJsonOrThrow again?
There was a problem hiding this comment.
This is the same as serializeOrRaiseWith but with a different name. I've written about the change here https://dev.to/dzakh/rescript-schema-v9-zod-like-library-to-the-next-level-1dn6
There was a problem hiding this comment.
Ok cool, I'm still trying to wrap my head around what is the convert step and why is it reversed
There was a problem hiding this comment.
It's convert because there's no type validation - otherwise it'd be called parse
It's reversed since we're turning 'value to Js.Json.t instead of Js.Json.t to 'value
| let parseOrThrow = S.compile( | ||
| S.array(schema), | ||
| ~input=Value, | ||
| ~output=Json, | ||
| ~mode=Sync, | ||
| ~typeValidation=true, | ||
| ) |
There was a problem hiding this comment.
Going to need to some explanations on these new features
There was a problem hiding this comment.
| // This is not super expensive, but don't want to do it on every event | ||
| | None => { | ||
| transactionSchema->Utils.Schema.removeTypeValidationInPlace | ||
| let transactionSchema = transactionSchema->S.removeTypeValidation |
There was a problem hiding this comment.
Is this now an immutable version of the function?
JonoPrest
left a comment
There was a problem hiding this comment.
Looks cool Dmitry 👍🏼, I'm going to need to wrap my head around the new API but lets go for.
68e7968 to
7cd4458
Compare
No description provided.