Skip to content

Feature request: either_of filter #147

@MOZGIII

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?

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