Adds Encode and Decode logic for "arbitrary" objects for Durable Python #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a kind of "follow-up" to: #53
The Durable Functions Python group is looking to support custom objects as inputs and outputs for their Orchestrations and Activity Functions. To do this, we establish a kind of "contract" with the user that their custom classes will provide static
to_json
andfrom_json
methods that we can use to serialize and deserialize their object instances. These functions get called asjson.dumps
andjson.loads
'callbacks` at various points and throughout the library and the durable-python code itself.So this PR does three things:
decode
andencode
methodsI worry that the last point may be controversial, because we are exposing a framework-internal function and users doing
import azure.functions
would be able to see them. Now, the fact that they are prefixed by two underscores should signal that they are not for public usage. Another idea I had was to bundle the two serialization functions under a__serialization__
module, and export that instead. Please let me know what you think, and than you 😸