Skip to content

Commit 8f4a1d6

Browse files
authored
docs: respect and generate-arazzo commands (#1931)
1 parent db93848 commit 8f4a1d6

File tree

3 files changed

+93
-47
lines changed

3 files changed

+93
-47
lines changed

.mlc.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Ignore these links, we can't check them from this subproject
2-
ignore-links=["../../*", "/docs/*",
2+
ignore-links=["../../*", "/docs/*", "/learn/*",
33
# skip this, it redirects to user login
44
"https://github.com/Redocly/redocly-cli/issues/*"
55
]

docs/commands/generate-arazzo.md

Lines changed: 82 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,25 @@
22
slug:
33
- /docs/cli/commands/generate-arazzo
44
- /docs/respect/commands/generate-arazzo
5-
rbac:
6-
authenticated: read
75
---
86

97
# `generate-arazzo`
108

119
Auto-generate an Arazzo description based on an OpenAPI description file.
1210

13-
If `examples` are provided in the OpenAPI description, they are used as input data for test requests.
14-
If `schema` is provided, the config generates fake data based on the description schema.
15-
By default, data for requests comes from the description at runtime.
16-
To materialize tests with the data, use the `--extended` option.
17-
18-
The `--extended` option also demonstrates how Respect gets data from an OpenAPI description.
19-
2011
{% admonition type="warning" %}
2112

2213
Given the nature of OpenAPI, the generated Arazzo description is not a complete test file and may not function. Dependencies between endpoints are not resolved.
2314

2415
It acts as a starting point for a test file and needs to be extended to be functional.
2516
{% /admonition %}
2617

18+
The first HTTP response is used as the success criteria for each step.
19+
2720
## Usage
2821

2922
```sh
30-
npx @redocly/cli generate-arazzo <your-OAS-description-file> [-o | --output-file] [--extended]
23+
npx @redocly/cli generate-arazzo <your-OAS-description-file> [-o | --output-file]
3124
```
3225

3326
## Options
@@ -42,23 +35,88 @@ npx @redocly/cli generate-arazzo <your-OAS-description-file> [-o | --output-file
4235

4336
- -o, --output-file
4437
- string
45-
- Path to the OAS description file. If the file name is not provided, the default name is used - `auto-generate.yaml`. Example: `npx @redocly/cli generate-arazzo OAS-file.yaml -o=example.yaml`
38+
- Path to the OAS description file. If the file name is not provided, the default name is used - `auto-generate.arazzo.yaml`. Example: `npx @redocly/cli generate-arazzo OAS-file.yaml -o=example.arazzo.yaml`
4639

47-
---
48-
49-
- --extended
50-
- boolean
51-
- By default, data for requests comes from the description at runtime. This option generates a test config file with data populated from the description. Example: `npx @redocly/cli generate-arazzo OAS-file.yaml -o=example.yaml --extended`.
40+
{% /table %}
5241

53-
---
42+
## Examples
5443

55-
- --with-expectations
56-
- boolean
57-
- By default, data for requests comes from the description at runtime. This option generates a test config file with data populated from the description with additional expectations. Example: `npx @redocly/cli generate-arazzo OAS-file.yaml -o=example.yaml --with-expectations`.
44+
Run the command: `npx @redocly/cli generate-arazzo 'https://warp-single-sidebar.redocly.app/_spec/apis/index.yaml'`
45+
46+
The command generates a `auto-generate.arazzo.yaml` file in the current directory.
47+
48+
The contents of the generated file are:
49+
50+
```yaml {% title="auto-generate.arazzo.yaml" %}
51+
arazzo: 1.0.1
52+
info:
53+
title: Warp API
54+
version: 1.0.0
55+
sourceDescriptions:
56+
- name: index
57+
type: openapi
58+
url: https://warp-single-sidebar.redocly.app/_spec/apis/index.yaml
59+
workflows:
60+
- workflowId: post-timelines-workflow
61+
steps:
62+
- stepId: post-timelines-step
63+
operationId: $sourceDescriptions.warp.createTimeline
64+
successCriteria:
65+
- condition: $statusCode == 201
66+
- workflowId: get-timelines-workflow
67+
steps:
68+
- stepId: get-timelines-step
69+
operationId: $sourceDescriptions.warp.listTimelines
70+
successCriteria:
71+
- condition: $statusCode == 200
72+
- workflowId: delete-timeline-{timeline_id}-workflow
73+
steps:
74+
- stepId: delete-timeline-{timeline_id}-step
75+
operationId: $sourceDescriptions.warp.deleteTimeline
76+
successCriteria:
77+
- condition: $statusCode == 204
78+
- workflowId: post-travels-workflow
79+
steps:
80+
- stepId: post-travels-step
81+
operationId: $sourceDescriptions.warp.timeTravel
82+
successCriteria:
83+
- condition: $statusCode == 200
84+
- workflowId: post-items-workflow
85+
steps:
86+
- stepId: post-items-step
87+
operationId: $sourceDescriptions.warp.registerItem
88+
successCriteria:
89+
- condition: $statusCode == 200
90+
- workflowId: post-events-workflow
91+
steps:
92+
- stepId: post-events-step
93+
operationId: $sourceDescriptions.warp.manipulateEvent
94+
successCriteria:
95+
- condition: $statusCode == 200
96+
- workflowId: post-anchors-workflow
97+
steps:
98+
- stepId: post-anchors-step
99+
operationId: $sourceDescriptions.warp.setAnchor
100+
successCriteria:
101+
- condition: $statusCode == 201
102+
- workflowId: post-paradox-checks-workflow
103+
steps:
104+
- stepId: post-paradox-checks-step
105+
operationId: $sourceDescriptions.warp.checkParadox
106+
successCriteria:
107+
- condition: $statusCode == 200
108+
- workflowId: get-monitor-timeline-workflow
109+
steps:
110+
- stepId: get-monitor-timeline-step
111+
operationId: $sourceDescriptions.warp.monitorTimeline
112+
successCriteria:
113+
- condition: $statusCode == 200
114+
```
58115
59-
{% /table %}
116+
The generated file is not a complete test file and needs to be extended to be functional.
60117
61-
<!-- TODO
62-
## Examples
118+
## Resources
63119
64-
## Resources -->
120+
- [Learn more about Arazzo](/learn/arazzo/what-is-arazzo).
121+
- [Lint command](./lint.md) to lint your Arazzo description.
122+
- [Respect command](./respect.md) to execute your Arazzo description.

docs/commands/respect.md

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22
slug:
33
- /docs/cli/commands/respect
44
- /docs/respect/commands/respect
5-
rbac:
6-
authenticated: read
75
---
86

97
# `respect`
108

119
Use this command to execute API tests described in an Arazzo description.
12-
In addition to the Arazzo specification, Respect supports specification extensions for API testing: `x-operation` and `x-serverUrl`.
1310

1411
## Usage
1512

1613
```sh
17-
npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-w | --workflow] [-s | --skip] [-v | --verbose] [-i | --input]
14+
npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-w | --workflow] [-s | --skip] [-v | --verbose] [-i | --input] [-S | --server] [-H | --har-output] [-J | --json-output]
1815
```
1916

2017
## Options
@@ -30,7 +27,7 @@ npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-
3027
- -w, --workflow
3128
- [string]
3229
- Workflow names from the test file to run.
33-
For example, the following command runs "first-flow" and "second-flow" workflows from the `test-file.yaml` Arazzo description: `npx @redocly/cli respect test-file.yaml --workflow first-flow second-flow`
30+
For example, the following command runs "first-flow" and "second-flow" workflows from the `test-file.yaml` Arazzo description: `npx @redocly/cli respect test-file.yaml --workflow first-flow second-flow`.
3431
{% admonition type="warning" %}
3532
The `--workflow` option can't be used with `--skip`.
3633
{% /admonition %}
@@ -40,7 +37,7 @@ npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-
4037
- -s, --skip
4138
- [string]
4239
- Workflow names from the test file to skip.
43-
For example, the following command skips the "first-flow" workflow from the `test-file.yaml` Arazzo description: `npx @redocly/cli respect test-file.yaml --skip first-flow`
40+
For example, the following command skips the "first-flow" workflow from the `test-file.yaml` Arazzo description: `npx @redocly/cli respect test-file.yaml --skip first-flow`.
4441
{% admonition type="warning" name="Warning" %}
4542
The `--skip` option can't be used with `--workflow`.
4643
{% /admonition %}
@@ -50,20 +47,20 @@ npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-
5047
- -v, --verbose
5148
- boolean
5249
- Runs the command in verbose mode to help with troubleshooting issues.
53-
For example, the following command runs all workflows from the `test-file.yaml` Arazzo description in verbose mode: `npx @redocly/cli respect test-file.yaml --verbose`
50+
For example, the following command runs all workflows from the `test-file.yaml` Arazzo description in verbose mode: `npx @redocly/cli respect test-file.yaml --verbose`.
5451

5552
---
5653

5754
- --har-output
5855
- string
5956
- Path for the `har` file for saving logs.
60-
For example, the following command runs all workflows from the `test-file.yaml` Arazzo description and saves the logs to the `logs.har` file: `npx @redocly/cli respect test-file.yaml --har-output='logs.har'`
57+
For example, the following command runs all workflows from the `test-file.yaml` Arazzo description and saves the logs to the `logs.har` file: `npx @redocly/cli respect test-file.yaml --har-output='logs.har'`.
6158

6259
---
6360

6461
- --json-output
6562
- string
66-
- Path for the JSON file for saving logs. For example, the following command runs all workflows from the `test-file.yaml` Arazzo description and saves the logs to the `logs.json` file:`npx @redocly/cli respect test-file.yaml --json-output='logs.json'`
63+
- Path for the JSON file for saving logs. For example, the following command runs all workflows from the `test-file.yaml` Arazzo description and saves the logs to the `logs.json` file:`npx @redocly/cli respect test-file.yaml --json-output='logs.json'`.
6764

6865
---
6966

@@ -81,19 +78,10 @@ npx @redocly/cli respect <your-test-file | multiple files | files bash query> [-
8178
- --server
8279
- string
8380
- Server overrides for the `sourceDescriptions` object.
84-
For example, the following command runs all workflows from the `test-file.yaml` Arazzo description and instead of using the server listed in the API description, uses the server at `https://test.com`: `npx @redocly/cli respect test-file.yaml --server test=https://test.com`
81+
For example, the following command runs all workflows from the `test-file.yaml` Arazzo description and instead of using the server listed in the API description, uses the server at `https://test.com`: `npx @redocly/cli respect test-file.yaml --server test=https://test.com`.
8582

8683
You can also pass the server overrides as an environment variable, as in the following example:
87-
`REDOCLY_CLI_RESPECT_SERVER="test=https://test.com"`
88-
89-
---
90-
91-
- --residency
92-
- string
93-
- If not logged in already, use the residency location of the Reunite application.
94-
Default: `us`.
95-
You can also pass the residency as an environment variable, as in the following example:
96-
`REDOCLY_CLI_RESPECT_RESIDENCY='eu'`
84+
`REDOCLY_CLI_RESPECT_SERVER="test=https://test.com"`.
9785

9886
{% /table %}
9987

@@ -158,7 +146,7 @@ Running workflow warp.arazzo.yaml / missionLostInvention
158146

159147
## Resources
160148

161-
<!-- - Learn more about using mTLS with Respect in [Use mTLS](/docs/respect/guides/mtls-cli).
149+
- Learn more about using mTLS with Respect in [Use mTLS](/docs/respect/guides/mtls-cli).
162150
- Follow steps to test API sequences in [Test a sequence of API calls](/docs/respect/guides/test-api-sequences).
163151
- Learn what Respect is and how you can use it to test API in the [Respect](/docs/respect) concept document.
164-
- [Learn Arazzo](/learn/arazzo/what-is-arazzo). -->
152+
- [Learn Arazzo](/learn/arazzo/what-is-arazzo).

0 commit comments

Comments
 (0)