[ISSUE 17] implement drop_pii for arrays and maps#46
Open
oxg558 wants to merge 17 commits into
Open
Conversation
ecb1955 to
3813299
Compare
3813299 to
7edb635
Compare
4987730 to
5d2454f
Compare
and revert previous changes to the inspect_pii test file
eaab6fd to
2015180
Compare
434a08f to
abc9549
Compare
abc9549 to
129bb9f
Compare
for people like me who struggle a bit reading the macro code
129bb9f to
ae62d8a
Compare
hpatoio
previously approved these changes
Jun 5, 2026
cpiemontese
previously approved these changes
Jun 5, 2026
oxg558
commented
Jun 5, 2026
|
|
||
| unquote_splicing(value_clauses) | ||
|
|
||
| def unquote(values_fn)(value), do: value |
Contributor
Author
There was a problem hiding this comment.
There's an issue here for maps of maps: the value_clauses can also contain a helper function for an inner type which would mean the final unquote would leave the function clauses out of order, e.g.:
def drop_pii_raw_payloads(value) when is_map(value) do
Enum.reduce(value, %{}, fn {k, v}, acc ->
Elixir.Map.put(acc, k, drop_pii_raw_payloads_values(v))
end)
end
def drop_pii_raw_payloads_values(value) when is_map(value) do
Enum.reduce(value, %{}, fn {k, v}, acc ->
Elixir.Map.put(acc, k, drop_pii_raw_payloads_values_values(v))
end)
end
def drop_pii_raw_payloads_values_values(%RawPayload{} = value) do
RawPayload.drop_pii(value)
end
def drop_pii_raw_payloads_values_values(value) do
value
end
def drop_pii_raw_payloads_values(value) do # <----- out of order
value
endThis generates a compile warning
57f0be6 to
8ed9908
Compare
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.
Fixes #17 by implementing
drop_piifor arrays and maps that have record values.Also adds a topological sort to the
generate_codefunction. This makes it easier to generate more complex schemas at runtime in tests like those written here fordrop_pii.