Skip to content

Feature request: either_of filter #147

Description

@MOZGIII

I need an either_of filter. It should accept a hash of values where exactly one key of the listed if filled:

either_of do
  hash :a do
    string :f1
  end
  hash :b do
    string :f2
    string :f3
  end
  hash :c do
    string :f4
    string :f5
  end
end

Valid:

  • {"a": { "f1": "qwe" }}
  • {"b": { "f2": "qwe", "f3": "wqe" }}
  • {"c": { "f4": "asd", "f5": "asd }}

Error:

  • {}
  • {"a": { "f1": "qwe" }, "b": { "f2": "qwe", "f3": "wqe" }}
  • { "d": {} }
  • { "a": { "f1": "qwe" }, "d": "qwe" }

What do you think?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions