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

[BUG] inconsistent uses of -o flag in some commands #1656

Open
2 tasks done
Adi-204 opened this issue Feb 9, 2025 · 2 comments
Open
2 tasks done

[BUG] inconsistent uses of -o flag in some commands #1656

Adi-204 opened this issue Feb 9, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Adi-204
Copy link
Contributor

Adi-204 commented Feb 9, 2025

Describe the bug.

In some commands like asyncapi bundle asyncapi format the -o flag is written explicitly in flags file while in below 3 commands it is used from validationFlags() .
According to the code the output flag inside validationFlags() is responsible to write any diagnostics (if present) in file but the description of this flag is - 'The output file name. Omitting this flag the result will be printed in the console.' which might confuse user with other commands output flags.

  1. asyncapi diff OLD NEW - In this command we have 2 flags with -o
    -o, --output= The output file name. Omitting this flag the result will be printed in the console.
    -o, --overrides= path to JSON file containing the override properties

Case 1 - Write only -o

Image

It is assuming that I am trying to use --overrides

Case 2 - Provide --output as flag

Image

It is printing correct output in logs but no file was created.

  1. asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT] -
    In this command if we use -o flag than if their are any diagnostics than it will be printed in file otherwise file will be empty

Case 1 : Empty File

Image

Case 2: If Diagnostics present than shown in output

Image

So command is working fine but in documentation it is written:
-o, --output= The output file name. Omitting this flag the result will be printed in the console.
But about validation of file is still written in logs only because of logGovernanceMessage() in file src\core\parser.ts

  1. asyncapi generate models LANGUAGE FILE

The usage of -o flag in this command is working absolutely fine a folder is created and which contains model file.

Image

But this is created because of ModelinaFlags it also has output flag and was not created with help of validationFlags function.

Expected behavior

Solutions I am thinking to fix the issues -

  1. I think we should change field output inside validationFlags to diagnosticsOutput and flag from -o to -o-diagnostics so user dont get confuse.

  2. For asyncapi diff OLD NEW command we will have 3 flags -o-diagnostics for write diagnostics in file , -o for writing console print inside file and -O for override operation.

  3. For asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT] command the output print in console is simple and we don't require it to copy in file so this command will have only -o-diagnostics flag (which is currently present with -o).

  4. For asyncapi generate models LANGUAGE FILE command -o is working correctly because of ModelinaFlags so if we just do above changes it will also have 2 different flags -o and -o-diagnostics.

Screenshots

Provided above.

How to Reproduce

Already mention above.

🥦 Browser

Google Chrome

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes

@Adi-204 Adi-204 added the bug Something isn't working label Feb 9, 2025
@github-project-automation github-project-automation bot moved this to To Triage in CLI - Kanban Feb 9, 2025
@Adi-204
Copy link
Contributor Author

Adi-204 commented Feb 9, 2025

Waiting for issue approval by maintainers. Please assign me the issue.

@Adi-204
Copy link
Contributor Author

Adi-204 commented Feb 9, 2025

Please explain me if I am missing something and understanding something wrong.

@Adi-204 Adi-204 changed the title [BUG] Wrong uses of -o flag in some commands [BUG] inconsistent uses of -o flag in some commands Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To Triage
Development

No branches or pull requests

1 participant