alecthomas / alecthomas/voluptuous
Exclusive + Required
Offen
- Vorherrschende Sprache
- Python
- Sterne
- 1.9k
- Forks
- 237
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.