Grokzen / Grokzen/pykwalify

Implement any.of

Open
#112 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
297
Forks
84
PR merge metrics
No merged PRs in 30d

Description

Rx knows [`any.of`](http://rx.codesimply.com/coretype/any.html) for subschemas, and [feature request #10 on the Kwalify sourceforge](https://sourceforge.net/p/kwalify/feature-requests/10/) suggests an implementation.

This would be a great feature to have for cases where, e.g., a data set will have a *type*, and this type only allows for a certain subset of keys to be used.

````yaml
type: vehicle-factory
products:
- type: car
doors: 4
wheels: 4
- type: vanette
doors: 5
wheels: 4
- type: motorcycle
handle: steel
wheels: 2
````

In this (arguably not very clever) example, `car`s can have `doors`, so can `vanette`s. `motorcycles` cannot have `doors`, but can have `handle`s made from a specific material. Both the other vehicle types cannot have `handle`s, but all vehicles can have `wheels`, etc.

This feature would allow for much stricter schemas to be implemented and validated, and I think would be of great use to many users.

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.