Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proxy implementation for optimize validate and convert fixed #1669

Merged
merged 3 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smooth-rabbits-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/cli": patch
---

fix: proxy implementation for optimize validate and convert fixed
24 changes: 9 additions & 15 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ USAGE
- [`asyncapi config context remove CONTEXT-NAME`](#asyncapi-config-context-remove-context-name)
- [`asyncapi config context use CONTEXT-NAME`](#asyncapi-config-context-use-context-name)
- [`asyncapi config versions`](#asyncapi-config-versions)
- [`asyncapi convert [SPEC-FILE] [PROXYHOST] [PROXYPORT]`](#asyncapi-convert-spec-file-proxyhost-proxyport)
- [`asyncapi convert [SPEC-FILE]`](#asyncapi-convert-spec-file)
- [`asyncapi diff OLD NEW`](#asyncapi-diff-old-new)
- [`asyncapi format [SPEC-FILE]`](#asyncapi-format-spec-file)
- [`asyncapi generate`](#asyncapi-generate)
Expand All @@ -62,11 +62,11 @@ USAGE
- [`asyncapi new file`](#asyncapi-new-file)
- [`asyncapi new glee`](#asyncapi-new-glee)
- [`asyncapi new template`](#asyncapi-new-template)
- [`asyncapi optimize [SPEC-FILE] [PROXYHOST] [PROXYPORT]`](#asyncapi-optimize-spec-file-proxyhost-proxyport)
- [`asyncapi optimize [SPEC-FILE]`](#asyncapi-optimize-spec-file)
- [`asyncapi pretty SPEC-FILE`](#asyncapi-pretty-spec-file)
- [`asyncapi start`](#asyncapi-start)
- [`asyncapi start studio`](#asyncapi-start-studio)
- [`asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT]`](#asyncapi-validate-spec-file-proxyhost-proxyport)
- [`asyncapi validate [SPEC-FILE]`](#asyncapi-validate-spec-file)

## `asyncapi bundle`

Expand Down Expand Up @@ -310,19 +310,17 @@ DESCRIPTION

_See code: [src/commands/config/versions.ts](https://github.com/asyncapi/cli/blob/v2.14.1/src/commands/config/versions.ts)_

## `asyncapi convert [SPEC-FILE] [PROXYHOST] [PROXYPORT]`
## `asyncapi convert [SPEC-FILE]`

Convert asyncapi documents older to newer versions or OpenAPI/postman-collection documents to AsyncAPI

```
USAGE
$ asyncapi convert [SPEC-FILE] [PROXYHOST] [PROXYPORT] -f openapi|asyncapi|postman-collection [-h] [-o
$ asyncapi convert [SPEC-FILE] -f openapi|asyncapi|postman-collection [-h] [-o
<value>] [-t <value>] [-p client|server] [--proxyHost <value>] [--proxyPort <value>]

ARGUMENTS
SPEC-FILE spec path, url, or context-name
PROXYHOST Name of the Proxy Host
PROXYPORT Name of the Port of the ProxyHost

FLAGS
-f, --format=<option> (required) [default: asyncapi] Specify the format to convert from (openapi or asyncapi)
Expand Down Expand Up @@ -658,20 +656,18 @@ DESCRIPTION

_See code: [src/commands/new/template.ts](https://github.com/asyncapi/cli/blob/v2.14.1/src/commands/new/template.ts)_

## `asyncapi optimize [SPEC-FILE] [PROXYHOST] [PROXYPORT]`
## `asyncapi optimize [SPEC-FILE]`

optimize asyncapi specification file

```
USAGE
$ asyncapi optimize [SPEC-FILE] [PROXYHOST] [PROXYPORT] [-h] [-p
$ asyncapi optimize [SPEC-FILE] [-h] [-p
remove-components|reuse-components|move-duplicates-to-components|move-all-to-components...] [-i schema...] [-o
terminal|new-file|overwrite] [--no-tty] [--proxyHost <value>] [--proxyPort <value>]

ARGUMENTS
SPEC-FILE spec path, url, or context-name
PROXYHOST Name of the Proxy Host
PROXYPORT Name of the Port of the ProxyHost

FLAGS
-h, --help Show CLI help.
Expand Down Expand Up @@ -764,20 +760,18 @@ DESCRIPTION

_See code: [src/commands/start/studio.ts](https://github.com/asyncapi/cli/blob/v2.14.1/src/commands/start/studio.ts)_

## `asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT]`
## `asyncapi validate [SPEC-FILE]`

validate asyncapi file

```
USAGE
$ asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT] [-h] [-w] [--log-diagnostics] [--diagnostics-format
$ asyncapi validate [SPEC-FILE] [-h] [-w] [--log-diagnostics] [--diagnostics-format
json|stylish|junit|html|text|teamcity|pretty] [--fail-severity error|warn|info|hint] [-o <value>] [--score]
[--proxyHost <value>] [--proxyPort <value>]

ARGUMENTS
SPEC-FILE spec path, url, or context-name
PROXYHOST Name of the Proxy Host
PROXYPORT Name of the Port of the ProxyHost

FLAGS
-h, --help Show CLI help.
Expand Down
2 changes: 0 additions & 2 deletions src/commands/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export default class Convert extends Command {

static args = {
'spec-file': Args.string({description: 'spec path, url, or context-name', required: false}),
proxyHost: Args.string({description: 'Name of the Proxy Host', required: false}),
proxyPort: Args.string({description: 'Name of the Port of the ProxyHost', required: false}),
};

async run() {
Expand Down
2 changes: 0 additions & 2 deletions src/commands/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@

static args = {
'spec-file': Args.string({description: 'spec path, url, or context-name', required: false}),
proxyHost: Args.string({description: 'Name of the Proxy Host', required: false}),
proxyPort: Args.string({description: 'Name of the Port of the ProxyHost', required: false}),
};

parser = new Parser();

async run() {

Check warning on line 57 in src/commands/optimize.ts

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed
const { args, flags } = await this.parse(Optimize); //NOSONAR
let filePath = args['spec-file'];
const proxyHost = flags['proxyHost'];
Expand Down
2 changes: 0 additions & 2 deletions src/commands/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export default class Validate extends Command {

static args = {
'spec-file': Args.string({description: 'spec path, url, or context-name', required: false}),
proxyHost: Args.string({description: 'Name of the Proxy Host', required: false}),
proxyPort: Args.string({description: 'Name of the Port of the ProxyHost', required: false}),
};

async run() {
Expand Down
Loading