Skip to content

Commit

Permalink
chore: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleh Shumov committed Dec 6, 2024
1 parent dd02080 commit 4355f9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions documentation/commands/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Manage your API definition (e.g., syncing, validation, analysis, conversion, etc
* [`rdme openapi convert [SPEC]`](#rdme-openapi-convert-spec)
* [`rdme openapi inspect [SPEC]`](#rdme-openapi-inspect-spec)
* [`rdme openapi reduce [SPEC]`](#rdme-openapi-reduce-spec)
* [`rdme openapi refs [SPEC]`](#rdme-openapi-refs-spec)
* [`rdme openapi validate [SPEC]`](#rdme-openapi-validate-spec)

## `rdme openapi [SPEC]`
Expand Down Expand Up @@ -226,13 +227,13 @@ EXAMPLES
$ rdme openapi reduce petstore.json --path /pet/{id} --method get --method put --out petstore.reduced.json
```

## `rdme openapi:refs [SPEC]`
## `rdme openapi refs [SPEC]`

Resolves circular and recursive references in OpenAPI by replacing them with object schemas.

```
USAGE
$ rdme openapi:refs [SPEC] [--out <value>] [--workingDirectory <value>]
$ rdme openapi refs [SPEC] [--out <value>] [--workingDirectory <value>]
ARGUMENTS
SPEC A file/URL to your API definition
Expand All @@ -254,16 +255,16 @@ DESCRIPTION
EXAMPLES
This will resolve circular and recursive references in the OpenAPI definition at the given file or URL:
$ rdme openapi:refs [url-or-local-path-to-file]
$ rdme openapi refs [url-or-local-path-to-file]
You can omit the file name and `rdme` will scan your working directory (and any subdirectories) for OpenAPI files.
This approach will provide you with CLI prompts, so we do not recommend this technique in CI environments.
$ rdme openapi:refs
$ rdme openapi refs
If you wish to automate this command, you can pass in CLI arguments to bypass the prompts:
$ rdme openapi:refs petstore.json --out petstore.openapi.json
$ rdme openapi refs petstore.json --out petstore.openapi.json
```

## `rdme openapi validate [SPEC]`
Expand Down
2 changes: 1 addition & 1 deletion src/commands/openapi/refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export default class OpenAPIRefsCommand extends BaseCommand<typeof OpenAPIRefsCo
this.debug(`Switching working directory from ${previousWorkingDirectory} to ${process.cwd()}`);
}

const { preparedSpec, specPath, specType } = await prepareOas(spec, 'openapi:refs', { convertToLatest: true });
const { preparedSpec, specPath, specType } = await prepareOas(spec, 'openapi refs', { convertToLatest: true });
if (specType !== 'OpenAPI') {
throw new Error('Sorry, this ref resolver feature in rdme only supports OpenAPI 3.0+ definitions.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/prepareOas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const capitalizeSpecType = (type: string) =>
*/
export default async function prepareOas(
path: string | undefined,
command: 'openapi convert' | 'openapi inspect' | 'openapi reduce' | 'openapi validate' | 'openapi',
command: 'openapi convert' | 'openapi inspect' | 'openapi reduce' | 'openapi refs' |'openapi validate' | 'openapi',
opts: {
/**
* Optionally convert the supplied or discovered API definition to the latest OpenAPI release.
Expand Down

0 comments on commit 4355f9c

Please sign in to comment.