You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/terms/how-to/test-declaration.md
+11-20Lines changed: 11 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,54 +5,45 @@ weight: 4
5
5
6
6
# Test your declarations
7
7
8
-
When creating or modifying service declarations, it's important to verify they work as expected. Let's see how to test your declarations in different ways.
8
+
When creating or modifying service declarations, it’s important to verify they work as expected before starting to track in production. The Open Terms Archive engine provides automated testing tools to that end.
9
9
10
-
## Full testing
11
-
12
-
To test your declarations by actually fetching the documents and validating the entire process:
10
+
The basic usage to test all declarations in a collection is:
13
11
14
12
```sh
15
13
npx ota validate declarations
16
14
```
17
15
18
-
It is also possible to test a single service declaration:
19
-
20
-
```sh
21
-
npx ota validate declarations --services "<service-name>"
22
-
```
16
+
## Testing specific services
23
17
24
-
Even a single terms of a service can be tested:
18
+
When iterating over a specific declaration, or to narrow down testing in larger collections, the `--services` and `--terms` options enable testing a single service declaration, or even single terms:
25
19
26
20
```sh
21
+
npx ota validate declarations --services "<service-name>"
27
22
npx ota validate declarations --services "<service-name>" --terms "<terms-type>"
28
23
```
29
24
30
25
## Schema validation only
31
26
32
-
For quicker validation that only checks the declaration structure without fetching any documents:
27
+
During initial development, it is useful to check that the JSON structure is correct before even testing the actual document fetching. The `--schema-only` option enables faster validation by only checking the declaration structure without fetching any documents:
33
28
34
29
```sh
35
30
npx ota validate declarations --schema-only
36
31
```
37
32
38
-
This is useful during initial development to ensure your JSON structure is correct before testing the actual document fetching.
33
+
The same options for targeting specific services and terms are available.
39
34
40
-
Same options as for the full test are available.
35
+
## Formatting
41
36
42
-
## Linting declarations
43
-
44
-
To ensure consistency across all declarations, you should also run the linter:
37
+
To ensure formatting consistency across all declarations, a linter is provided:
45
38
46
39
```sh
47
40
npx ota lint
48
41
```
49
42
50
-
Same options as for the full test are available.
51
-
52
-
To automatically fix linting errors:
43
+
To automatically apply the default Open Terms Archive formatting options:
53
44
54
45
```sh
55
46
npx ota lint --fix
56
47
```
57
48
58
-
This will format your declaration files according to the project's standards.
49
+
The same options for targeting specific services and terms are available.
0 commit comments