Implement Inspect protocol for generated structs to redact PII fields#45
Open
claudio-dalicandro wants to merge 1 commit intomasterfrom
Open
Implement Inspect protocol for generated structs to redact PII fields#45claudio-dalicandro wants to merge 1 commit intomasterfrom
claudio-dalicandro wants to merge 1 commit intomasterfrom
Conversation
88394e1 to
b6c2895
Compare
…fields Generate a custom defimpl Inspect for record modules that have PII-marked fields. When inspected (e.g. in logs), PII field values are replaced with **REDACTED** while non-PII fields are displayed normally. Records without PII fields are unaffected — no Inspect impl is generated.
b6c2895 to
6c190f3
Compare
cpiemontese
approved these changes
Apr 29, 2026
Contributor
cpiemontese
left a comment
There was a problem hiding this comment.
If you update the CHANGELOG and run a suite-py bump I'll release after merge 😊
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When generated Avro structs end up in logs (via
Logger,IO.inspect/2, exception messages, etc.), PII-marked fields are displayed in plain text. This is a data privacy concern, IMHO.Solution
For every record schema that has fields marked with
"pii": true, the code generator now produces adefimpl Inspectthat replaces PII field values with**REDACTED**in the inspect output. Records without PII fields are not affected — no custom Inspect implementation is generated.Example
Given a schema with
full_nameandemailmarked as PII: