-
Notifications
You must be signed in to change notification settings - Fork 8
fix serialization of pendulum.DateTime objects in JsonSerializationWriter #369
fix serialization of pendulum.DateTime objects in JsonSerializationWriter #369
Conversation
5438a74 to
3278fe8
Compare
@microsoft-github-policy-service agree |
|
@baywet, @andrueastman Can you please take a look? |
baywet
left a comment
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.
Thanks for the contribution!
Can you please also bump the patch version in the version file and add a changelog entry? (today's date, changed) to ensure a swift release.
Also, sorry about the delay in reviewing, I missed this one in my many, many notifications...
|
Additionally, the code needs to be formatted (see the build logs) |
…/pendulum-datetime-serialization
baywet
left a comment
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.
Thank you for making the changes!
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
|
@eran-av it seems some unit tests are not passing, can you have a look into it please? |
|
Fixed it, |
yeah this is a bit confusing: pylint + yapf |
Sync sources for changes in microsoft/kiota-serialization-json-python#369



Environment
Describe the bug
The
write_any_valuemethod inJsonSerializationWriterfails to properly handlependulum.DateTimeobjects. This is due to insufficient type checking, which causespendulum.DateTimeobjects to be treated as non-primitive types instead of as datetime objects. Specifically, the issue stems from not usingisinstance()to check for datetime types, which preventspendulum.DateTimefrom being recognized as a subclass of the primitivedatetime.datetime.To Reproduce
JsonSerializationWriterinstancependulum.DateTimefield (specifically as anadditional_datadict)pendulum.DateTimeobject is not serialized correctlyExpected behavior
pendulum.DateTimeobjects should be treated as datetime objects and serialized correctly, just likedatetime.datetimeobjects. The serialization process should recognizependulum.DateTimeas a subclass ofdatetime.datetimeand handle it accordingly.Code to reproduce