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: serde on enums #663

Merged
merged 6 commits into from
Nov 18, 2024
Merged

Fix: serde on enums #663

merged 6 commits into from
Nov 18, 2024

Conversation

zcabter
Copy link
Collaborator

@zcabter zcabter commented Nov 14, 2024

Context

This PR fixes the awkward external tagging that serde uses for Json serialisation with the following changes:

  1. Cryptos enums are marked with #[serde(untagged)]
  2. Non-cryptos enums are marked as #[serde(tag = "_type")]

These changes ensures that we get generated code that makes sense in Typescript from #644

Manually testing the PR

Code should build, tests should pass
make

@zcabter zcabter force-pushed the ryan@fix-serde-on-enums branch from 3b65cc7 to 94b3709 Compare November 14, 2024 16:09
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 89.65517% with 24 lines in your changes missing coverage. Please review.

Project coverage is 45.21%. Comparing base (7bed1ce) to head (716333c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
crates/jstz_node/src/api_doc.rs 93.33% 11 Missing ⚠️
crates/jstz_cli/src/run.rs 0.00% 4 Missing ⚠️
crates/jstz_cli/src/deploy.rs 0.00% 3 Missing ⚠️
crates/jstz_proto/src/receipt.rs 72.72% 1 Missing and 2 partials ⚠️
crates/jstz_crypto/src/public_key_hash.rs 0.00% 2 Missing ⚠️
crates/jstz_node/src/lib.rs 80.00% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
crates/jstz_crypto/src/hash.rs 41.32% <100.00%> (+0.19%) ⬆️
crates/jstz_crypto/src/public_key.rs 44.79% <ø> (+1.04%) ⬆️
crates/jstz_crypto/src/secret_key.rs 32.25% <100.00%> (-1.43%) ⬇️
crates/jstz_crypto/src/signature.rs 43.97% <ø> (+0.40%) ⬆️
crates/jstz_proto/src/api/smart_function.rs 79.24% <100.00%> (ø)
crates/jstz_proto/src/context/account.rs 65.48% <100.00%> (ø)
crates/jstz_proto/src/executor/deposit.rs 100.00% <100.00%> (ø)
crates/jstz_proto/src/executor/fa_deposit.rs 95.35% <100.00%> (+0.04%) ⬆️
crates/jstz_proto/src/executor/fa_withdraw.rs 94.57% <ø> (ø)
crates/jstz_proto/src/executor/smart_function.rs 85.71% <100.00%> (-0.05%) ⬇️
... and 7 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bed1ce...716333c. Read the comment docs.

@zcabter zcabter force-pushed the ryan@fix-serde-on-enums branch 4 times, most recently from 602c9f9 to dacb60f Compare November 15, 2024 18:15
@zcabter zcabter assigned huancheng-trili and unassigned zcabter Nov 15, 2024
@zcabter zcabter force-pushed the ryan@fix-serde-on-enums branch from ed18ad5 to 716333c Compare November 18, 2024 10:57
@zcabter zcabter merged commit 92e6a62 into main Nov 18, 2024
5 checks passed
@zcabter zcabter deleted the ryan@fix-serde-on-enums branch November 18, 2024 11:17
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