Skip to content

Avoid injecting nil in generated modules#47

Open
lpeppe wants to merge 1 commit into
masterfrom
fix-pii-redacting
Open

Avoid injecting nil in generated modules#47
lpeppe wants to merge 1 commit into
masterfrom
fix-pii-redacting

Conversation

@lpeppe
Copy link
Copy Markdown
Contributor

@lpeppe lpeppe commented May 22, 2026

After #45, records generated from schemas without any pii fields ended up with a stray nil in the module body.

The issue was in the Inspect code generation path: in the empty case, inspect_impl/1 returned an empty quoted block, and unquoting that produces nil, which then got injected into the generated module. This change fixes it by returning an empty list instead and using unquote_splicing, so nothing gets emitted when there is no Inspect impl to generate.

When pii fields are present, the custom Inspect implementation is still generated as before.

@lpeppe lpeppe requested a review from a team as a code owner May 22, 2026 15:03
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