-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date handling #1504
base: main
Are you sure you want to change the base?
date handling #1504
Conversation
eandre
commented
Oct 18, 2024
- runtimes/{core,js}: refactor schema encode/decode
- Add date support
Introduce a pair of types, `PValue` and `PValues`. The types allow us to introduce dedicated semantic types that go beyond plain JSON types. As a result, since the wire protocol is still JSON, decoding JSON into these types requires an API schema (so that we know e.g. whether a string is "just a string" or should be a datetime. This commit introduces the concept and refactors the runtimes to use it. The next commit adds support for dates.
All committers have signed the CLA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
@@ -24,7 +24,7 @@ pub type MessageId = String; | |||
|
|||
pub struct MessageData { | |||
pub attrs: HashMap<String, String>, | |||
pub body: Option<serde_json::Value>, | |||
// pub body: Option<serde_json::Value>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this? or is it going to be re-added at some point?
} | ||
|
||
impl FromNapiValue for PVals { | ||
unsafe fn from_napi_value(env: sys::napi_env, napi_val: sys::napi_value) -> Result<Self> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code panics if the value is undefined
. I had similar problems when parsing the error details, and had to parse it to JsUnknown first and then match on the type to check that it was an JsObject before coercing into that.