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

Ckhrysze/elixir cbor struct to array encoding #6888

Merged
merged 4 commits into from
Nov 13, 2023

Conversation

ckhrysze
Copy link
Member

@ckhrysze ckhrysze commented Nov 9, 2023

Current behavior

The only struct encoding option is as an object

Proposed changes

Add an additional option to allow a struct to be serialized as a list.

#6614

Checks

  • All commits in this Pull Request are signed and Verified by Github.
  • All commits in this Pull Request follow the Ockam commit message convention.
  • There are no Merge commits in this Pull Request. Ockam repo maintains a linear commit history. We merge Pull Requests by rebasing them onto the develop branch. Rebasing to the latest develop branch and force pushing to your Pull Request branch is okay.
  • I have read and accept the Ockam Community Code of Conduct.
  • I have read and accepted the Ockam Contributor License Agreement by adding my Git/Github details in a row at the end of the CONTRIBUTORS.csv file in a separate pull request to the build-trust/ockam repository. The easiest way to do this is to edit the CONTRIBUTORS.csv file in the github web UI and create a separate Pull Request, this will mark the commit as verified.

@ckhrysze ckhrysze requested a review from a team as a code owner November 9, 2023 21:10
@polvorin
Copy link
Member

This looks good, thanks for adding the tests 👍 .
Just a request, on the :struct case, we didn't require fields to be contiguously defined, that is a struct with fields numbers 1,2 and 4 is fine (no field # 3). Here, for the :struct_values case, we do expect them to be all defined (with a special case for letting the 0 to not be defined). I didn't had this in mind, but I think it's fine, that means unused fields (for example after an update where such a field is not used anymore) will still need to be defined as term() | nil. That actually has the benefit that we will be reminded we are wasting space there until we change the schema on all parties involved.

The request is, could you add a comment/doc about this on the :struct_values case please?. And maybe check that at compile time when using the Plugin too.

@ckhrysze ckhrysze force-pushed the ckhrysze/elixir_cbor_struct_to_array_encoding branch from aa8290d to e6d67ee Compare November 10, 2023 19:33
@ckhrysze ckhrysze force-pushed the ckhrysze/elixir_cbor_struct_to_array_encoding branch from d5eb069 to 1a7cd9a Compare November 13, 2023 16:34
@polvorin polvorin added this pull request to the merge queue Nov 13, 2023
Merged via the queue into develop with commit 30cba35 Nov 13, 2023
20 checks passed
@polvorin polvorin deleted the ckhrysze/elixir_cbor_struct_to_array_encoding branch November 13, 2023 16:49
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