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

fix: convert listValues to lists in nested structs #102

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

fernandezcuesta
Copy link
Contributor

@fernandezcuesta fernandezcuesta commented Oct 17, 2024

Description of your changes

When converting a struct to dict, it is expected for all the fields to be python-bultins. This includes that the resulting nested dict should not contain ListValues but lists.

I have:

Read and followed Crossplane's contribution process.

  • Added or updated unit tests for my change.

@fernandezcuesta fernandezcuesta marked this pull request as draft October 17, 2024 23:39
@fernandezcuesta fernandezcuesta force-pushed the main branch 2 times, most recently from 7474fc8 to 1d2dcb3 Compare October 17, 2024 23:43
@fernandezcuesta fernandezcuesta marked this pull request as ready for review October 17, 2024 23:44
@fernandezcuesta fernandezcuesta marked this pull request as draft October 17, 2024 23:54
@fernandezcuesta fernandezcuesta marked this pull request as ready for review October 18, 2024 00:37
@fernandezcuesta fernandezcuesta changed the title fix: convert listValues to lists fix: convert listValues to lists in nested structs Oct 18, 2024
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
k: (struct_to_dict(v) if isinstance(v, structpb.Struct) else v)
for k, v in s.items()
}
return json_format.MessageToDict(s, preserving_proto_field_name=True)
Copy link
Member

Choose a reason for hiding this comment

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

Nice. Can you update dict_to_struct as well per #108?

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!

Copy link
Contributor Author

@fernandezcuesta fernandezcuesta Nov 25, 2024

Choose a reason for hiding this comment

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

but CI is failing :rage4:

protocolbuffers/protobuf#18096

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
@fernandezcuesta fernandezcuesta force-pushed the main branch 2 times, most recently from 0250289 to 17d5ddb Compare November 26, 2024 19:03
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants