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

Add convert command #41

Closed
Tracked by #251
magicmatatjahu opened this issue Jul 29, 2021 · 8 comments
Closed
Tracked by #251

Add convert command #41

magicmatatjahu opened this issue Jul 29, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@magicmatatjahu
Copy link
Member

magicmatatjahu commented Jul 29, 2021

Our comverter-js has builded custom CLI, but we should move it to the main CLI.

AC:

  • add new convert command to the CLI
  • add tests for new command
  • update docs (Readme.md) with new command
  • add --help flag
  • to discuss: should we remove --id flag from https://github.com/asyncapi/converter-js CLi? It's only needed between 1.X.X -> 2.X.X.

Usage (my proposition):

asyncapi convert --file {FILE} --to 2.1.0 // convert to the 2.1.0 version
asyncapi convert --file {FILE} --to latest // convert to the latest version of spec
asyncapi convert --file {FILE} // convert to the latest version of spec (omit the `--to` flag)
asyncapi convert --file {FILE} --output {OUTPUT_FILE} // convert and save in the `output`

Maybe we should treat --to as standalone argument?

asyncapi convert --file {FILE} 2.1.0 // convert to the 2.1.0 version

I have also problem with --output flag, because I don't know if we should follow with custom CLI for converter:

image

Any suggestions?

Also we should consider saving the converted spec to the existing context, it means that user will operate on some context and action like:

asyncapi convert --context {CONTEXT} --to 2.1.0

will save the output to the {CONTEXT}.

Some my questions about the future of the command:

  • should we only focus on converting the AsyncAPI, or maybe extend it with converting OpenAPI to the AsyncAPI? and another specs 😏
  • should we also add option to convert the RAML, AVRO etc formats to our Schema Object format - similar to our custom parsers for formats, but as standalone command in our CLI?

@derberg @Souvikns What do you think?

@magicmatatjahu magicmatatjahu added the enhancement New feature or request label Jul 29, 2021
@Souvikns
Copy link
Member

Maybe we have a --output flag that takes a path as an input. Converts the old version to the new version and outputs in that path, and if the --output flag is missing we can just update the original file.

@derberg
Copy link
Member

derberg commented Jul 29, 2021

Our comverter-js has builded custom CLI, but we should move it to the main CLI.

definitely, same with generator. This is the ultimate goal of this CLI. One CLI to rule them all 😄

I would definitely like CLI to be friendly and interactive, and when you do asyncapi convert, you get an interactive response from the CLI with list of versions that you can convert too, so you select the version that you want manually. And of course you can skip this interactiveness with a flag like --targetVersion or -t.

the future of the command
my opinion is that we should not put = between asyncapi convert and the JavaScript Converter that we have. Meaning: that now asyncapi convert will invoke the list of available target versions, but simply because in code we will by default support AsyncAPI now, but in future this should be definitely extendable, so we can add other formats, why not 🤷🏼

--output
imho we should do --output as it will be universal for other commands, not >. And if you do not provide --output or -o then we print the result in the terminal

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Sep 28, 2021
@derberg derberg removed the stale label Sep 28, 2021
@peter-rr
Copy link
Member

peter-rr commented Dec 9, 2021

Hi all! 👋 @magicmatatjahu @Souvikns @derberg
I've been having a look and investigating a bit on this issue and I'd like to start working on it as a starting point to contribute to the CLI repo. If no objections from your side, please let me work on it and I'll get back to you with a proposal as soon as I have some working code 💪 Cheers!

@derberg
Copy link
Member

derberg commented Dec 9, 2021

@peter-rr go ahead mate!

@magicmatatjahu
Copy link
Member Author

Solution that we should consider for that issue asyncapi/community#249 It's only an idea so please treat it as suggestion, not final approach. Feel free to comment :)

@Souvikns Souvikns mentioned this issue Mar 3, 2022
16 tasks
@fmvilas
Copy link
Member

fmvilas commented Apr 29, 2022

I think this issue can be closed as it was implemented by @peter-rr in #188. @Souvikns @magicmatatjahu can you close it? I can do it but I should not 😄

@magicmatatjahu
Copy link
Member Author

Yeah, it's implemented. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants