Skip to content
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

[sub]fix(backend/image_transfert/encoder): update pydantic method #763

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/image_transfer/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def create_zip_from_docker_images(
dest = payload_descriptor.manifests_paths[manifest.docker_image_name]
zip_file.writestr(dest, manifest.content)

zip_file.writestr("payload_descriptor.json", payload_descriptor.json(indent=4))
zip_file.writestr("payload_descriptor.json", payload_descriptor.model_dump_json(indent=4))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to change also PayloadDescriptor.parse_raw into PayloadDescriptor.model_validate_json in decoder.py

Copy link
Contributor Author

@thbcmlowk thbcmlowk Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! You mean here and like this, right?

-    return PayloadDescriptor.parse_raw(zip_file.read("payload_descriptor.json").decode())
+    return PayloadDescriptor.model_validate_json(zip_file.read("payload_descriptor.json").decode())

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep ! (I did it for the PR refactor image transfer that's why ^^")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also made the pydantic upgrade, but still 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!



def make_payload(
Expand Down
Loading