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

Reject unknown fields in configuration files #3295

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

divergentdave
Copy link
Contributor

This changes all config-related deserialization routines to throw an error upon seeing unexpected fields, rather than ignoring them. This should be mentioned in the next release notes.

@divergentdave divergentdave requested a review from a team as a code owner July 10, 2024 18:04
Copy link
Member

@branlwyd branlwyd left a comment

Choose a reason for hiding this comment

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

I'd like it if we could apply this to every serde-serialized structure by default, but I can't find a way to do this.

@divergentdave
Copy link
Contributor Author

That would be possible if we rolled up our sleeves to write some proc macros, and then used our derive instead of serde's derive everywhere, but I don't know if that would be worth it.

Moreover, I am intentionally holding off on changing deserialization done on aggregator API requests for now. We may want to make that parsing strict as well at some point, but it will take a whole different set of testing, and affect a different set of API consumers.

@branlwyd
Copy link
Member

I definitely don't think writing proc macros ourselves is the right path. If we really wanted to address this, I'd try to upstream a feature into serde before doing that -- but I don't think that is worth it, either. :)

@divergentdave divergentdave merged commit 12627b2 into main Jul 12, 2024
9 checks passed
@divergentdave divergentdave deleted the david/strict-config-parsing branch July 12, 2024 16:28
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.

None yet

4 participants