Add custom JSONEncoder for model serialization - #19595
Conversation
e4e71cd to
6ec7641
Compare
There was a problem hiding this comment.
|
/azp run python - core - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@mccoyp _utils.py has been moved into utils folder. |
8a3ed97 to
ee0c590
Compare
There was a problem hiding this comment.
When the conversation starts regarding deserialization - we will want to make sure we support weird .NET timestamps (with extra decimal places). When that conversation happens - what we do to serialize round-tripped values will be important as well.
There was a problem hiding this comment.
Do we really need to import a private type from a private submodule?
There was a problem hiding this comment.
I think we should rename _FixedOffset to FixedOffset. But not sure if it is worth...
|
/azp run python - autorest - pr |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Does this still need int() around seconds?
There was a problem hiding this comment.
I wouldn't think so, since this AttributeError should only come up if seconds is an integer. seconds.is_integer() works when seconds is a float on 2.7. 3.6, and 3.9 when I test locally
There was a problem hiding this comment.
This is currently part of the public API - which I don't think it should be, at least to start with.
Can we make it private?
|
/azp run python - core - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
e1e9afe to
62e61ea
Compare
|
/azp run python - core - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - core - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This adds a custom JSONEncoder that can serialize
datetimeobjects (dates,times,datetimes, andtimedeltas) in UTC ISO 8601 format, as well asbytesandbytearrays in base64 strings.