framework
framework copied to clipboard
Requiring oneOf or anyOf two fields/columns
Overview
I'd like to require that a tabular data file include one of two fields, each with its own name, description, and pattern constraint. I'm currently using v3.31.0; I would gladly update the version but don't see a way to do this, for example with a oneOf or anyOf constraint in place of required. Is this possible?
Hi @kgeographer,
It's currently not possible. I think the best solution will be using Python to check this:
resource = Resource.describe('table.csv')
assert resource.schema.has_field('name1') or resource.schema.has_field('name2')
# TODO: other logic
I'll mark this issue as a feature request as well