23andMe / Yamale

A schema and validator for YAML.
MIT License
666 stars 88 forks source link

Subset not working with includes #230

Open sbliven opened 10 months ago

sbliven commented 10 months ago

The subset validator accepts both single items and lists when used with primitives. However it does not validate single objects when included.

schema.yaml

primative_list: subset(str())
primative_single: subset(str())
complex_list: subset(include('person'))
complex_single: subset(include('person'))
---
person:
  first: str()
  last: str()

test.yaml

primative_list:
- foo
- bar
primative_single: foo
complex_list:
- first: joe
  last: dread
- first: sam
  last: scott

# Should validate but doesn't
complex_single:
  first: fred
  last: jones

Errors

complex_single.last: Required field missing
complex_single.first: Required field missing

This seems potentially related to #133 and #217, which also involve errors when combining validators.

fclante commented 1 month ago

Hey This is a big thing. Please prioritize this.