I am experimenting with the merging maps feature of Kwalify gem from the documentation
When I load the YAML in my ruby script, I don't see the values getting merged.
parser = Kwalify::Yaml::Parser.new(@validator)
document = parser.parse_file(File.join(__dir__, "test_files", "values.yml"))
I think there is something wrong with my understanding. It would be really helpful if I can get any much better example for understanding maps merging feature of YAML along with code to retrieve merged values of YAML.
YAML schema
type: map
mapping:
"group":
type: map
mapping:
"name": &name
type: str
required: yes
"email": &email
type: str
pattern: /@/
required: no
"user":
type: map
mapping:
"name":
<<: *name # merge
length: { max: 16 } # add
"email":
<<: *email # merge
required: yes # override
YAML input
group:
name: foo
email: foo@mail.com
user:
name: bar
email: bar@mail.com