Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate multiple alternative schemas #48

Closed
ulope opened this issue Mar 8, 2019 · 3 comments
Closed

Validate multiple alternative schemas #48

ulope opened this issue Mar 8, 2019 · 3 comments

Comments

@ulope
Copy link

ulope commented Mar 8, 2019

I'm trying to build a validator for a configuration file format that has multiple mutually incompatible versions (similar to docker-compose files for example).

Example of how I had hoped to express this:

# The following line does *not* work
any(include('v1_config'), include('v2_config'))
---
v1_config:
  version: int(min=1, max=1, required=False)
  settings:
    v1_setting_a: str()
    v1_setting_b: str(required=False)
---
v2_config:
  version: int(min=2, max=2)
  settings:
    v2_setting_c: str()
    v2_setting_d: int()

Is there any way to express what I'm trying to do here, or is that simply not supported (yet)?

@blopker
Copy link
Contributor

blopker commented Mar 9, 2019

There's actually a PR out for this: #38
It's just quite large and complicated so I haven't been comfortable merging it. If you try it and it works for you please let me know.

@drmull
Copy link
Contributor

drmull commented Aug 4, 2019

PR #60 will solve this issue

@mildebrandt
Copy link

This is available in version 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants