-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix: serialize array output and logs #3040
Conversation
Refactor the `recursive_serialize_or_str` function in the `schema.py` file to improve its readability and maintainability. The function now uses a try-except block to handle exceptions and returns a string representation of the object if an exception occurs. This ensures that the function always returns a string, preventing any unexpected errors. Additionally, the function now includes additional checks for different object types, such as dictionaries, lists, and instances of `BaseModel`. These checks ensure that the function correctly serializes complex objects and avoids any potential issues. Overall, this refactoring improves the code quality and reliability of the `recursive_serialize_or_str` function.
…n ARRAY artifact type to ensure consistent data handling
…ogs function to handle LogType.ARRAY case
Pull Request Validation ReportThis comment is automatically generated by Conventional PR Whitelist Report
Result Pull request does not satisfy any enabled whitelist criteria. Pull request will be validated. Validation Report
Result Pull request satisfies all enabled pull request rules. Last Modified at 29 Jul 24 19:48 UTC |
This pull request is automatically being deployed by Amplify Hosting (learn more). |
* refactor: improve recursive serialization function Refactor the `recursive_serialize_or_str` function in the `schema.py` file to improve its readability and maintainability. The function now uses a try-except block to handle exceptions and returns a string representation of the object if an exception occurs. This ensures that the function always returns a string, preventing any unexpected errors. Additionally, the function now includes additional checks for different object types, such as dictionaries, lists, and instances of `BaseModel`. These checks ensure that the function correctly serializes complex objects and avoids any potential issues. Overall, this refactoring improves the code quality and reliability of the `recursive_serialize_or_str` function. * feat(artifact.py): add support for recursive serialization of items in ARRAY artifact type to ensure consistent data handling * feat(schema.py): add support for serializing arrays in build_output_logs function to handle LogType.ARRAY case (cherry picked from commit 4e9367b)
I have refactored the
recursive_serialize_or_str
function in theschema.py
file to improve its readability and maintainability. The function now uses a try-except block to handle exceptions and returns a string representation of the object if an exception occurs. Additionally, I have added support for serializing arrays in thebuild_output_logs
function to handle theLogType.ARRAY
case. This ensures consistent data handling and improves the code quality and reliability of the serialization process.