Say I have a YAML use case which demands the following structure, which does not allow for sequences:
test-element: 1
element-with-pattern-1: 0x-test1
element-with-pattern-2: 4x-test2
element-diff-pattern-1: 971
element-diff-pattern-2: 382
element-diff-pattern-3: 882
element-with-pattern and element-diff-pattern may appear in unknown quantities, but otherwise must follow the specified structure, with a standard name and validated data types within.
I know the exact name and data format of the first value, and can write a Kwalify statement for it, but for the other 5 values, I do not know exactly how many values there may be, and defining a default schema does not work because the first set has a string with a specific format while the second stirng has a numeric type.
Ideally something like below could be used:
"element-with-pattern-([0-9])+":
type: string
required: yes
pattern: /[0-9]x-test[0-9]/
This is a very common use case experienced by many users, as shown in the below issues:
https://github.com/Grokzen/pykwalify/issues/83
https://stackoverflow.com/questions/19474283/kwalify-yaml-validation-use-regexes-in-key-names