Skip to content

Commit 807eb61

Browse files
committed
docs: add example to validate doc
1 parent d18e320 commit 807eb61

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

docs/references/validate-spec.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Validate specification document supports `version: default:validate:0.7.2` versi
1010
<summary>All supported nodes in Validate specification document</summary>
1111

1212
```yml
13-
---
1413
version: default:validate:0.7.2
1514

1615
variables:
@@ -43,12 +42,36 @@ Validate specification document supports `version: default:validate:0.7.2` versi
4342
4443
## `version` (<small>*`required`*</small>)
4544

46-
This is a top-level block that defines the document version. Read details of [_version reference_](/docs/references/version) here.
45+
This is a top-level block that defines the spec. document version. Read details of [_version reference_](/docs/references/version) here.
46+
47+
```yml {1}
48+
version: default:validate:0.7.2
49+
50+
data:
51+
...
52+
53+
asserts:
54+
...
55+
...
56+
```
4757

4858
## `variables`
4959

5060
`variables` is a top-level block that defines local variables. These variables are not accessible outside of this file scope.
5161

62+
```yml {3-4}
63+
version: default:validate:0.7.2
64+
65+
variables:
66+
Name: "Variable Value"
67+
68+
data:
69+
code: 200
70+
71+
asserts:
72+
...
73+
```
74+
5275
Read details of [*variables*](/docs/references/variables) here.
5376

5477
## `data`
@@ -57,14 +80,19 @@ Read details of [*variables*](/docs/references/variables) here.
5780

5881
`data` only supports YAML maps, where keys holds strings and values contains YAML collection (dictionary / hashmap) or scaler values.
5982

60-
```yml
83+
```yml {3-4}
84+
version: default:validate:0.7.2
85+
6186
data:
6287
code: 200
88+
89+
asserts:
90+
...
6391
```
6492

6593
## `asserts` (<small>*`required`*</small>)
6694

67-
This is a top-level block to defines list of assertions. This assertions can target both data and variables.
95+
This is a top-level block to defines list of assertions. These assertions can target both data and variables.
6896

6997
Data type for `asserts` node is list of assert item.
7098

@@ -73,12 +101,22 @@ Data type for `asserts` node is list of assert item.
73101
Assert items define assertion for one specific case. It looks like following:
74102

75103
```yml
104+
version: default:validate:0.7.2
105+
106+
data:
107+
code: 200
108+
109+
variables:
110+
Name: "Variable Value"
111+
76112
asserts:
77113
- type: Equal
78114
actual: <% code %>
79115
expected: 200
80116
msg_pass: 'Response was successful'
81117
msg_fail: 'Response was unsuccessful'
118+
119+
- # [assertItem]
82120
```
83121

84122
Explanation of possible nodes:

0 commit comments

Comments
 (0)