summaryrefslogtreecommitdiff
path: root/tests/files/fail/test_anchor.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/files/fail/test_anchor.yaml')
-rw-r--r--tests/files/fail/test_anchor.yaml95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/files/fail/test_anchor.yaml b/tests/files/fail/test_anchor.yaml
new file mode 100644
index 0000000..dca97f5
--- /dev/null
+++ b/tests/files/fail/test_anchor.yaml
@@ -0,0 +1,95 @@
+---
+name: fail-anchor-1
+desc: schema with anchor
+schema:
+ type: seq
+ required: true
+ sequence:
+ - type: map
+ required: true
+ mapping:
+ first-name: &name
+ type: str
+ required: true
+ family-name: *name
+data:
+ - first-name: foo
+ last-name: Foo
+ - first-name: bar
+ family-name: 100
+errors:
+ - "Cannot find required key 'family-name'. Path: '/0'"
+ - "Key 'last-name' was not defined. Path: '/0'"
+ - "Value '100' is not of type 'str'. Path: '/1/family-name'"
+ ## Kwalify errors
+ # :required_nokey : 1:3:[/0] key 'family-name:' is required.
+ # :key_undefined : 2:3:[/0/last-name] key 'last-name:' is undefined.
+ # :type_unmatch : 4:3:[/1/family-name] '100': not a string.
+---
+name: fail-anchor-2
+desc: schema with anchor 2
+schema:
+ type: map
+ required: true
+ mapping:
+ title: &name
+ type: str
+ required: true
+ address-book:
+ type: seq
+ required: true
+ sequence:
+ - type: map
+ mapping:
+ name: *name
+ email:
+ type: str
+ required: true
+data:
+ title: my friends
+ address-book:
+ - name: 100
+ email: foo@mail.com
+ - first-name: bar
+ email: bar@mail.com
+errors:
+ - "Cannot find required key 'name'. Path: '/address-book/1'"
+ - "Key 'first-name' was not defined. Path: '/address-book/1'"
+ - "Value '100' is not of type 'str'. Path: '/address-book/0/name'"
+ ## Kwalify errors
+ # :type_unmatch : 3:5:[/address-book/0/name] '100': not a string.
+ # :required_nokey : 5:5:[/address-book/1] key 'name:' is required.
+ # :key_undefined : 5:5:[/address-book/1/first-name] key 'first-name:' is undefined.
+# TODO: THIS TEST IS BROKEN BECUASE IT CAUSE INFINITE RECURSION IN PYTHON
+# ---
+# name: fail-anchor-3
+# desc: document with anchor
+# schema:
+# type: seq
+# sequence:
+# - &employee
+# type: map
+# mapping:
+# name:
+# type: str
+# post:
+# type: str
+# enum:
+# - exective
+# - manager
+# - clerk
+# supervisor: *employee
+# data:
+# - &foo
+# name: 100
+# post: exective
+# supervisor: *foo
+# - &bar
+# name: foo
+# post: worker
+# supervisor: *foo
+# errors:
+# - ''
+# ## Kwalify errors
+# # :type_unmatch : 2:3:[/0/name] '100': not a string.
+# # :enum_notexist : 7:3:[/1/post] 'worker': invalid post value.