Menu

#18 merging YAML mappings fails with "unique" constraint

open
kwalify (10)
5
2011-11-03
2011-11-03
R. Kraay
No

Using kwalify 0.7.2 it appears that the validation of the unique constraint is happening before the merging of the yaml mappings.

$ kwalify -lf bug_schema.yaml bug.yaml
bug.yaml#0: INVALID
- (line 4) [/bug/1/name] 'test-1': is already used at '/bug/0/name'.

$ cat bug_schema.yaml
type: map
mapping:
"bug":
type: seq
sequence:
- type: map
mapping:
"name":
type: str
required: yes
unique: yes
pattern: /^\S+$/

$ cat bug.yaml
bug:
- &test
name: test-1
- <<: *test
name: test-2

Thanks for looking into this -- and thank you for creating such a useful utility.

Discussion

  • R. Kraay

    R. Kraay - 2011-11-03

    bug_schema.yaml

     
  • R. Kraay

    R. Kraay - 2011-11-03

    bug.yaml

     

Log in to post a comment.

MongoDB Logo MongoDB