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

Correctly handle nested results on transformations #15

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

zoedsoupe
Copy link
Owner

Description
:transform directive was not handling correctly the return when a nested schema was being passed as a type, that occurs because when there's a nested data value and type, the validate_field/3 will return {:ok, <nested>} and not :ok.

given that, the :transform clause was matching only the :ok return and so on ignoring the nested data returned, so the mapper function wasn't being applied.

that didn't occur with :map type directive since the validate_field/3 clause for this type will only return :ok, accepting any map structure you're passing as value.

Related Issues
closes #12

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Additional Context
N/A

@zoedsoupe zoedsoupe merged commit 596d849 into main Nov 26, 2024
4 checks passed
zoedsoupe added a commit that referenced this pull request Nov 26, 2024
@zoedsoupe zoedsoupe deleted the fix/transform-nested branch November 26, 2024 16:41
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.

[BUG] Transforms don't run on nested schemas
1 participant