Skip to content

Commit 074e9fb

Browse files
committed
chore: update documentation
1 parent bfb3236 commit 074e9fb

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

docs/@v2/commands/split.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,41 @@
33
## Introduction
44

55
The `split` command takes an API description file and creates a [multi-file structure](https://redocly.com/docs/resources/multi-file-definitions/) out of it by extracting referenced parts into standalone, separate files.
6-
Code samples, components, and paths are split from the root API description into separate files and folders.
7-
The structure of the unbundled directory corresponds to the structure created by our [openapi-starter](https://github.com/Redocly/openapi-starter) tool.
86
The advantage of this approach is making smaller files that are easier to manage and a structure that makes reviewing simpler.
97

10-
Use the [`bundle`](./bundle.md) command and supply the main file as the entrypoint to get your OpenAPI description in one file.
11-
Many OpenAPI tools prefer a single file, but `split` and `bundle` allow you to manage your files easily for development, and then prepare a single file for other tools to consume.
12-
13-
{% admonition type="warning" name="OpenAPI 3.x only" %}
14-
The `split` command supports OpenAPI 3.x descriptions only.
8+
{% admonition type="warning" name="Supported specifications" %}
9+
The `split` command supports OpenAPI 3.x, AsyncAPI 2.x, and AsyncAPI 3.x descriptions. OpenAPI 2.x (Swagger) is not supported.
1510
{% /admonition %}
1611

12+
The parts that get split depend on the type of API description:
13+
14+
**OpenAPI 3.x**
15+
16+
Components, paths, and webhooks are split from the root API description into separate files and folders.
17+
The structure of the unbundled directory corresponds to the structure created by the [openapi-starter](https://github.com/Redocly/openapi-starter) tool.
18+
19+
- `paths/` - each path item is written to a separate file
20+
- `webhooks/` - each webhook is written to a separate file (OpenAPI 3.1+)
21+
- `components/` - schemas, responses, parameters, examples, headers, requestBodies, links, callbacks, and securitySchemes are each split into subdirectories
22+
23+
**AsyncAPI 2.x**
24+
25+
Channels and components are split from the root API description into separate files and folders.
26+
27+
- `channels/` - each channel is written to a separate file
28+
- `components/` - schemas, messages, securitySchemes, parameters, correlationIds, messageTraits, operationTraits, serverBindings, channelBindings, operationBindings, and messageBindings are each split into subdirectories
29+
30+
**AsyncAPI 3.x**
31+
32+
Channels, operations, and components are split from the root API description into separate files and folders.
33+
34+
- `channels/` - each channel is written to a separate file
35+
- `operations/` - each operation is written to a separate file
36+
- `components/` - schemas, messages, securitySchemes, servers, serverVariables, parameters, replies, replyAddresses, correlationIds, messageTraits, operationTraits, tags, externalDocs, serverBindings, channelBindings, operationBindings, and messageBindings are each split into subdirectories
37+
38+
Use the [`bundle`](./bundle.md) command and supply the main file as the entrypoint to get your API description back in one file.
39+
Many API tools prefer a single file, but `split` and `bundle` allow you to manage your files easily for development, and then prepare a single file for other tools to consume.
40+
1741
## Usage
1842

1943
```bash
@@ -36,7 +60,7 @@ redocly split --version
3660

3761
## Examples
3862

39-
### View successful split message
63+
### Split an OpenAPI description
4064

4165
This `split` command "unbundles" the specified API description, as defined in `pet.yaml`, into the `openapi` output directory:
4266

@@ -52,3 +76,18 @@ Document: pet.yaml is successfully split
5276

5377
pet.yaml: split processed in 33ms
5478
</pre>
79+
80+
### Split an AsyncAPI description
81+
82+
The `split` command works the same way with AsyncAPI 2.x and AsyncAPI 3.x descriptions:
83+
84+
```bash
85+
redocly split asyncapi.yaml --outDir=asyncapi
86+
```
87+
88+
<pre>
89+
Document: asyncapi.yaml is successfully split
90+
and all related files are saved to the directory: asyncapi
91+
92+
asyncapi.yaml: split processed in 25ms
93+
</pre>

0 commit comments

Comments
 (0)