-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
T25mTime Estimate 25 MinutesTime Estimate 25 Minuteschorea tedious but necessary task often paying technical debta tedious but necessary task often paying technical debtdiscussShare your constructive thoughts on how to make progress with this issueShare your constructive thoughts on how to make progress with this issueenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededpriority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedSecond highest priority, should be worked on as soon as the Priority-1 issues are finishedtechnicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
Description
At present we have a strip_struct_metadata/1 function is hidden in:
https://github.com/dwyl/auth_plug/blob/da40aca75d5ecc0fc016023f4a61eb6f4b7cfb6f/lib/auth_plug_helpers.ex#L18C1-L33C6
@doc """
`strip_struct_metadata/1` removes the Ecto Struct metadata from a struct.
This is essential before attempting to create a JWT as `Jason.encode/2`
chokes on any invalid data. See: github.com/dwyl/auth_plug/issues/16
"""
def strip_struct_metadata(struct) do
struct
|> Map.delete(:__meta__)
|> Map.delete(:__struct__)
# association
|> Map.delete(:statuses)
# association
|> Map.delete(:login_logs)
# binary
|> Map.delete(:email_hash)
endWe can easily make this function generic and reusable by accepting a second argument field_list.
Todo
- Create the tests (borrow from
auth_plugand extend withfield_list) - " function definition
- " PR
- Publish new version of package to
hex.pm
Metadata
Metadata
Assignees
Labels
T25mTime Estimate 25 MinutesTime Estimate 25 Minuteschorea tedious but necessary task often paying technical debta tedious but necessary task often paying technical debtdiscussShare your constructive thoughts on how to make progress with this issueShare your constructive thoughts on how to make progress with this issueenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededpriority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedSecond highest priority, should be worked on as soon as the Priority-1 issues are finishedtechnicalA technical issue that requires understanding of the code, infrastructure or dependenciesA technical issue that requires understanding of the code, infrastructure or dependencies
Type
Projects
Status
No status
Status
More ToDo ThanCanEver Be Done