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

refactor: Use default and Option in a more principled way #2078

Merged
merged 1 commit into from
Sep 22, 2023
Merged

refactor: Use default and Option in a more principled way #2078

merged 1 commit into from
Sep 22, 2023

Conversation

chubei
Copy link
Contributor

@chubei chubei commented Sep 22, 2023

This PR does 3 things:

  • Remove the use of #[serde(default = ...)].

This annotation makes the Default implementation of a struct different from a deserialized struct from no configuration, and can lead to subtle bugs (happened several times).

  • Remove unnecessary Option over enums. This was the limitation of prost and resulted in code bloat.

  • Add #[serde(deny_unknown_fields)]

@chubei chubei requested a review from v3g42 September 22, 2023 16:58
@chubei chubei marked this pull request as ready for review September 22, 2023 16:58
Also add `#[serde(deny_unknown_fields)]`
@v3g42
Copy link
Contributor

v3g42 commented Sep 22, 2023

This is awesome. Thanks @chubei

@chubei chubei added this pull request to the merge queue Sep 22, 2023
Merged via the queue into getdozer:main with commit e9c5b98 Sep 22, 2023
5 checks passed
@chubei chubei deleted the refactor/config branch September 22, 2023 17:27
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