alecthomas / alecthomas/voluptuous

Exclusive + Required

Open
#115 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.9k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

I'd love to require exactly one of a few choices, e.g.

``` python
s = Schema({
Exclusive('project_id', 'project', require=True): Coerce(int),
Exclusive('project_name', 'project', require=True): unicode
})
```

(With `require=True` not existing now, but if something like it did, that would be great.)

It's likely this is possible, but I'm not sure how to do it yet. (Is it?)

I'd like `s({})` to fail, for examine, but a schema containing either one of the keys (as is now the case with Exclusive) to pass.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.