Closed dutzXCIV closed 3 years ago
Hi, thanks for your interest in Yamale!
I don't think this is something that the current set of Yamale validators can enforce. If you control the format of the yaml, I'd be happy to suggest alternative structures that would be better suited towards validation. For example:
objects:
default_params:
param0: "my name"
param1: 123
param2: "red"
my_objects:
- object0:
param0: "their name"
param1: 234
- object1:
param1: 987
param2: "blue"
- object2:
param0: "dog's name"
Otherwise, take a look at writing a custom validator: https://github.com/23andMe/Yamale#custom-validators
Let me know if you have any questions.
Closing due to inactivity.
Hello everyone,
first of all thank you very much for this useful package. I came across something that might be already implemented but I couldn't figure it out using the existing documentation. I have a yaml file which looks somewhat like that:
As you can see I have a list of "elements", the first one is fully defined and the second one only contains param1. The schema should check if all "params" are present in the first element of the list (element0) and for every other element that comes after it, all these params should be optional. I created a simple schema where I wrote something like this:
Just making all params optional is out of question, they should be defined at least once. So is it possible to define rules for a single element in the list and apply "other rules" to every other element?
Thank you very much in advance!