Skip to content

Commit

Permalink
chore: rename 'entrypoints' into 'apis' (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatomyr authored Aug 9, 2022
1 parent 0b7aec9 commit b325e6f
Show file tree
Hide file tree
Showing 28 changed files with 278 additions and 329 deletions.
4 changes: 2 additions & 2 deletions __tests__/lint-config/invlid-lint-config-saverity/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

exports[`E2E lint-config test with option: { dirName: 'invlid-lint-config-saverity', option: 'something' } 1`] = `
index.ts lint [entrypoints...]
index.ts lint [apis...]
Lint definition.
Positionals:
entrypoints [array] [default: []]
apis [array] [default: []]
Options:
--version Show version number. [boolean]
Expand Down
4 changes: 2 additions & 2 deletions __tests__/split/missing-outDir/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

exports[`E2E split without option: outDir 1`] = `
index.ts split [entrypoint]
index.ts split [api]
Split definition into a multi-file structure.
Positionals:
entrypoint API definition file that you want to split [string] [required]
api API definition file that you want to split [string] [required]
Options:
--version Show version number. [boolean]
Expand Down
12 changes: 6 additions & 6 deletions docs/commands/bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ To learn more about preprocessors, rules, and decorators, refer to the [custom r
## Usage

```bash
redocly bundle <entrypoints>...
redocly bundle <entrypoints> [--max-problems=<n>]
redocly bundle <entrypoints> [--lint] [--config=<path>]
redocly bundle <entrypoints>... -o <outputName> --ext <ext>
redocly bundle <apis>...
redocly bundle <apis> [--max-problems=<n>]
redocly bundle <apis> [--lint] [--config=<path>]
redocly bundle <apis>... -o <outputName> --ext <ext>
redocly bundle --version
```

## Options

Option | Type | Description
-- | -- | --
entrypoints | [string] | List of API root definition filenames or names assigned in the `apis` section of your Redocly configuration file. Default values are all names defined in the `apis` section within your configuration file.
apis | [string] | List of API root definition filenames or names assigned in the `apis` section of your Redocly configuration file. Default values are all names defined in the `apis` section within your configuration file.
--config | string | Specify path to the [config file](#custom-configuration-file).
--dereferenced, -d | boolean | Generate fully dereferenced bundle.
--ext | string | Specify bundled file extension. Possible values are `json`, `yaml`, or `yml`. Default value is `yaml`.
Expand Down Expand Up @@ -58,7 +58,7 @@ redocly bundle openapi/openapi.yaml --output dist/openapi.json

### Bundle multiple API definitions

This command creates one bundled file for each of the specified entrypoints in the `dist/` folder. Bundled files are in JSON format.
This command creates one bundled file for each of the specified apis in the `dist/` folder. Bundled files are in JSON format.

```bash Command
redocly bundle --output dist --ext json openapi/openapi.yaml openapi/petstore.yaml
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/join.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Apart from providing individual API definition files as the input, you can also
### Usage

```bash
redocly join <entrypoint> <entrypoint>...
redocly join <api> <api>...
redocly join <path-to-folder>/<wildcard-pattern> [--lint]
redocly join [--help] [--prefix-components-with-info-prop] [--prefix-tags-with-info-prop] [--prefix-tags-with-filename]

Expand All @@ -40,7 +40,7 @@ redocly join --version

Option | Type | Description
-- | -- | --
entrypoints | array | **REQUIRED.** 1. Array of paths to API definition files that you want to join. At least two input files are required.<br />2. A wildcard pattern to match API definition files within a specific folder.
apis | array | **REQUIRED.** 1. Array of paths to API definition files that you want to join. At least two input files are required.<br />2. A wildcard pattern to match API definition files within a specific folder.
--help | boolean | Show help.
--lint | boolean | Lint definition files.
--prefix-tags-with-filename | string | Prefix tags with property value from file name. See the [prefix-tags-with-filename section](#prefix-tags-with-filename) below.
Expand Down
24 changes: 12 additions & 12 deletions docs/commands/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To learn more about preprocessors and rules, refer to the [custom rules](../reso

```bash
redocly lint
redocly lint <entrypoints>...
redocly lint <apis>...
redocly lint [--max-problems=<n>] [--config=<path>] [--format=<value>]
redocly lint [--generate-ignore-file] [--help]
redocly lint --version
Expand All @@ -24,7 +24,7 @@ redocly lint --version

Option | Type | Description
-- | -- | --
entrypoints | array | Array of API definition filenames that need to be linted. See [the Entrypoints section](#entrypoints) for more options.
apis | array | Array of API definition filenames that need to be linted. See [the Apis section](#apis) for more options.
--config | string | Specify path to the [configuration file](#custom-configuration-file).
--extends | array | [Extend a specific configuration](#extend-configuration) (defaults or config file settings).
--format | string | Format for the output.<br />**Possible values:** `codeframe`, `stylish`, `json`, `checkstyle`, `codeclimate`.
Expand All @@ -38,23 +38,23 @@ entrypoints | array | Array of API definition filenames that need to be linted.

## Examples

### Entrypoints
### Apis

The `lint` command behaves differently depending on how you pass entrypoints to it and whether the [configuration file](#custom-configuration-file) exists.
The `lint` command behaves differently depending on how you pass apis to it and whether the [configuration file](#custom-configuration-file) exists.

#### Pass entrypoints directly
#### Pass apis directly

```bash
redocly lint openapi/openapi.yaml
```

In this case, `lint` will validate the definition(s) passed to the command. The configuration file is ignored.

The `entrypoints` argument can also use any glob format supported by your file system. For example, `redocly lint ./root-documents/*.yaml`.
The `apis` argument can also use any glob format supported by your file system. For example, `redocly lint ./root-documents/*.yaml`.

#### Pass entrypoints via configuration file
#### Pass apis via configuration file

Instead of full paths, you can use names listed in the `apis` section of your Redocly configuration file as entrypoints.
Instead of full paths, you can use names listed in the `apis` section of your Redocly configuration file.

```bash Command
redocly lint core@v1
Expand All @@ -68,9 +68,9 @@ apis:
In this case, after resolving the path behind the `core@v1` name (see the `Configuration file` tab), `lint` will validate the `definition.json` file. The presence of the Redocly configuration file is mandatory.

#### Empty entrypoints
#### Empty apis

You can omit entrypoints completely when executing the `lint` command.
You can omit apis completely when executing the `lint` command.

```bash Command
redocly lint
Expand All @@ -86,11 +86,11 @@ apis:
root: ./openapi/sandbox.yaml
```

In this case, if no API definitions are specified, `lint` validates all entrypoints listed under `apis` in your Redocly configuration file. The presence of the configuration file is mandatory.
In this case, if no API definitions are specified, `lint` validates all apis listed under `apis` in your Redocly configuration file. The presence of the configuration file is mandatory.

:::warning Important

If you try to execute the `lint` command without entrypoints when your project doesn't have any configuration files, the `lint` command will display an error.
If you try to execute the `lint` command without apis when your project doesn't have any configuration files, the `lint` command will display an error.

:::

Expand Down
20 changes: 10 additions & 10 deletions docs/commands/preview-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ To preview docs using the premium Redocly API reference docs, you must first aut
## Usage

```bash
redocly preview-docs <entrypoint> [branchName]
redocly preview-docs <entrypoint> [--config=<path>] [--port=<value>] [--host=<host>] [branchName]
redocly preview-docs <entrypoint> [--force] [--help] [--version] [branchName]
redocly preview-docs <entrypoint> --version
redocly preview-docs <api>
redocly preview-docs <api> [--config=<path>] [--port=<value>] [--host=<host>]
redocly preview-docs <api> [--force] [--help] [--version]
redocly preview-docs <api> --version
```

## Options

Option | Type | Description
-- | -- | --
entrypoints | array | Path to the API definition filename or alias that you want to generate the preview for. Refer to [the entrypoints section](#entrypoints) for more options.
api | string | Path to the API definition filename or alias that you want to generate the preview for. Refer to [the api section](#api) for more options.
--config | string | Specify path to the [configuration file](#custom-configuration-file).
--force, -f | boolean | Generate preview output even when errors occur.
--help | boolean | Show help.
Expand All @@ -36,21 +36,21 @@ entrypoints | array | Path to the API definition filename or alias that you want

## Examples

### Entrypoints
### Api

The command behaves differently depending on how you pass the entrypoint to it, and whether the [configuration file](#custom-configuration-file) exists.
The command behaves differently depending on how you pass the api to it, and whether the [configuration file](#custom-configuration-file) exists.

#### Pass entrypoint directly
#### Pass api directly

```bash
redocly preview-docs openapi/openapi.yaml
```

In this case, `preview-docs` will preview the definition that was passed to the command. The configuration file is ignored.

#### Pass entrypoint alias
#### Pass api alias

Instead of a full path, you can use an API name from the `apis` section of your Redocly configuration file as the entrypoint.
Instead of a full path, you can use an API name from the `apis` section of your Redocly configuration file.

```bash Command
redocly preview-docs core@v1
Expand Down
6 changes: 3 additions & 3 deletions docs/commands/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ To authenticate to the API registry, you can use several approaches:
## Usage

```bash
redocly push [entrypoint] <destination>
redocly push [api] <destination>
redocly push
redocly push [-u] [--batch-id id] [--batch-size number] <path/to/definition.yaml> <@organization-id/api-name@api-version> [--branch]
```
Expand All @@ -78,7 +78,7 @@ redocly push [-u] [--batch-id id] [--batch-size number] <path/to/definition.yaml

Option | Type | Description |
-----------------|:---------:|------------|
entrypoint | string | The API definition that you want to push to the Redocly API registry. Provide it as a path to the root API definition file (or as an alias). See [Set options explicitly](#set-options-explicitly) for more information. |
api | string | The API definition that you want to push to the Redocly API registry. Provide it as a path to the root API definition file (or as an alias). See [Set options explicitly](#set-options-explicitly) for more information. |
destination | string | Conditional. The location in the API registry where you want to push or upsert your API definition. Provide it in the following format: `@organization-id/api-name@api-version` or `api-name@api-version`if organization ID is already defined in the configuration file. See [the Destination section](#destination) for more information. |
--branch, -b | string | The branch where your API definition will be pushed or upserted. Default value is `main`. |
--batch-id | string | Specifies the ID of the CI job that the current push will be associated with. See [the Batch ID section](#batch-id) for more information. |
Expand Down Expand Up @@ -165,7 +165,7 @@ The version of your API should contain only supported characters (`a-z`, `A-Z`,

### Set options explicitly

Provide the `entrypoint` as a path to the root API definition file, and specify the organization ID, API name and version.
Provide the `api` as a path to the root API definition file, and specify the organization ID, API name and version.

```bash
redocly push openapi/petstore.yaml @openapi-org/petstore-api@v1
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/split.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The `split` command doesn't support OpenAPI 2.0 definitions.
## Usage

```bash
redocly split <entrypoint> --outDir=<path>
redocly split <api> --outDir=<path>
redocly split [--help] [--version]
redocly split --version
```
Expand All @@ -20,7 +20,7 @@ redocly split --version

Option | Type | Description
-- | -- | --
entrypoint | string | **REQUIRED.** Path to the API definition file that you want to split into a multi-file structure.
api | string | **REQUIRED.** Path to the API definition file that you want to split into a multi-file structure.
--outDir | string | **REQUIRED.** Path to the directory where you want to save split files. If the specified directory doesn't exist, it will be created automatically.
--help | boolean | Show help.
--separator | string | File path separator used while splitting. The default value is `_`. This controls the file names generated in the `paths` folder (e.g. `/users/create` path becomes `user_create.yaml`).
Expand Down
16 changes: 8 additions & 8 deletions docs/commands/stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,38 @@ The `stats` command provides statistics about the structure of one or more API d
## Usage

```bash
redocly stats <entrypoint>
redocly stats <entrypoint> [--format] [--config=<path>]
redocly stats <api>
redocly stats <api> [--format] [--config=<path>]
redocly stats --version
```

## Options

Option | Type | Description
-- | -- | --
entrypoint | string | **REQUIRED.** Path to the API definition file that you want to split into a multi-file structure.
api | string | **REQUIRED.** Path to the API definition file that you want to split into a multi-file structure.
--config | string | Specify path to the [configuration file](#custom-configuration-file).
--format | string | Format for the output.<br />**Possible values:** `stylish`, `json`.
--help | boolean | Show help.
--version | boolean | Show version number.

## Examples

### Entrypoint
### Api

The `stats` command behaves differently depending on how you pass the entrypoint to it and whether the [configuration file](#custom-configuration-file) exists.
The `stats` command behaves differently depending on how you pass the api to it and whether the [configuration file](#custom-configuration-file) exists.

#### Pass entrypoint directly
#### Pass api directly

```bash
redocly stats openapi/openapi.yaml
```

In this case, `stats` will show statistics for the definition that was passed to the command. The configuration file is ignored.

#### Pass entrypoint via configuration file
#### Pass api via configuration file

Instead of full paths, you can use API names from the `apis` section of your Redocly configuration file as entrypoints.
Instead of full paths, you can use API names from the `apis` section of your Redocly configuration file.

```bash Command
redocly stats core@v1
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__mocks__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const getFallbackEntryPointsOrExit = jest.fn((entrypoints) =>
export const getFallbackApisOrExit = jest.fn((entrypoints) =>
entrypoints.map((path: string) => ({ path }))
);
export const dumpBundle = jest.fn(() => '');
Expand Down
Loading

1 comment on commit b325e6f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 68.47% 2864/4183
🟡 Branches 61.83% 1584/2562
🟡 Functions 60% 459/765
🟡 Lines 68.26% 2652/3885

Test suite run success

431 tests passing in 75 suites.

Report generated by 🧪jest coverage report action from b325e6f

Please sign in to comment.