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

Support nested conditional fields #25

Closed
shahryarjb opened this issue Jan 15, 2024 · 0 comments
Closed

Support nested conditional fields #25

shahryarjb opened this issue Jan 15, 2024 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@shahryarjb
Copy link
Member

shahryarjb commented Jan 15, 2024

You may have reached this issue by searching. I spent three weeks full time trying to implement this possibility. But unfortunately I did not succeed. If you have an idea to implement this possibility in this macro, please cooperate.

  guardedstruct do
    conditional_field(:actor, any()) do
      field(:actor, struct(), struct: Actor, derive: "validate(map, not_empty)")

      conditional_field(:actor, any(),
        structs: true,
        derive: "validate(list, not_empty, not_flatten_empty_item)"
      ) do
        field(:actor, struct(), struct: Actor, derive: "validate(map, not_empty)")

        field(:actor, String.t(), derive: "sanitize(tag=strip_tags) validate(url, max_len=160)")
      end

      field(:actor, String.t(), derive: "sanitize(tag=strip_tags) validate(url, max_len=160)")
    end
  end

Branch link:
https://github.com/mishka-group/mishka_developer_tools/tree/nested_condition

@shahryarjb shahryarjb added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels Jan 15, 2024
@shahryarjb shahryarjb self-assigned this Jan 15, 2024
@shahryarjb shahryarjb closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant