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

asyncapi start studio is not consistent with other commands #1623

Closed
derberg opened this issue Jan 14, 2025 · 10 comments · Fixed by #1638
Closed

asyncapi start studio is not consistent with other commands #1623

derberg opened this issue Jan 14, 2025 · 10 comments · Fixed by #1638
Labels
enhancement New feature or request

Comments

@derberg
Copy link
Member

derberg commented Jan 14, 2025

To start studio with asyncapi start studio you need to specify path to AsyncAPI document.

Assumption, my document location is ./asyncapi-client.yaml.

With all other CLI commands, you just provide the path:

  • asyncapi validate ./asyncapi-client.yaml
  • asyncapi format ./asyncapi-client.yaml
  • asyncapi pretty ./asyncapi-client.yaml

Now, in case of Studio, you need to do: asyncapi start studio -f ./asyncapi-client.yaml

And when you execute asyncapi start studio without pointing file, you get generic error that is not true:

error locating AsyncAPI document: These are your options to specify in the CLI what AsyncAPI file should be used:
        - You can provide a path to the AsyncAPI file: asyncapi <command> path/to/file/asyncapi.yml
        - You can provide URL to the AsyncAPI file: asyncapi <command> https://example.com/path/to/file/asyncapi.yml
        - You can also pass a saved context that points to your AsyncAPI file: asyncapi <command> context-name
        - In case you did not specify a context that you want to use, the CLI checks if there is a default context and uses it. To set default context run: asyncapi config context use mycontext
        - In case you did not provide any reference to AsyncAPI file and there is no default context, the CLI detects if in your current working directory you have files like asyncapi.json, asyncapi.yaml, asyncapi.yml. Just rename your file accordingly.

Fix suggestion

  • remove -f flag from asyncapi start studio and make it work like in other commands
  • it would probably also make sense to not make it required to point document, I think maybe better start studio, just without any file opened in it by default + drop in termina a hint that user can open specific file if they want, and how
@derberg derberg added the enhancement New feature or request label Jan 14, 2025
@github-project-automation github-project-automation bot moved this to To Triage in CLI - Kanban Jan 14, 2025
@Adi-204
Copy link
Contributor

Adi-204 commented Jan 15, 2025

Please assign me this issue. I am working on this.

@lmalkam
Copy link

lmalkam commented Jan 15, 2025

assign me this issue please

@Adi-204
Copy link
Contributor

Adi-204 commented Jan 15, 2025

@derberg by default studio opens with a file Streetlights Kafka API 1.0.0 show when user runs asyncapi start studio the same file should be open ? If we wont specify anything then following error will displayed in studio.
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "ES2021",
},
"exclude": [
"coverage",
],
}
This may confuse user more. Maybe we can store default_studio_file.yml in project and it will get open when user doesn't specify file path and we will leave hint in CLI how user can open file of his/her choice.
Please provide feedback and what is your idea?

@derberg
Copy link
Member Author

derberg commented Jan 15, 2025

by default studio opens with a file Streetlights Kafka API 1.0.0

you mean when you run asyncapi start studio?

@Adi-204
Copy link
Contributor

Adi-204 commented Jan 15, 2025

by default studio opens with a file Streetlights Kafka API 1.0.0

you mean when you run asyncapi start studio?

Yes @derberg

Copy link
Member Author

derberg commented Jan 15, 2025

hmm interesting, as I'm getting an error as described in description 🤔

@Adi-204
Copy link
Contributor

Adi-204 commented Jan 16, 2025

@derberg
Suggestion:
When a user runs the command asyncapi start studio without specifying a file, we could display the following default AsyncAPI document in the Studio:

asyncapi: '3.0.0'
info:
  title: Welcome to AsyncAPI Studio
  version: '1.0.0'
  description: This is a sample AsyncAPI document to help you get started. Define your async APIs, channels, messages, and bindings here.
  contact:
    name: AsyncAPI 
    url: https://www.asyncapi.com
    email: [email protected]

Additionally, we can provide a CLI hint guiding users on how to open a specific document:
Hint: To open a specific AsyncAPI file in the Studio, use: asyncapi start studio [spec-file]

This approach ensures a smooth onboarding experience by providing users with an immediate starting point while also educating them on how to load their own specifications.
Let me know if you’d like any refinements!

Visuals of AsyncAPI Studio

Image

@Adi-204
Copy link
Contributor

Adi-204 commented Jan 19, 2025

@SahilDahekar I was working on this issue and discussing possibilities with @derberg. It is not confirmed yet, this was my suggestion.

@derberg
Copy link
Member Author

derberg commented Jan 20, 2025

@Adi-204 hint for future - if you discuss the scope, this means your PR is not yet ready, then create it as a draft - GH supports such type of PRs

  • asyncapi start studio ./myfile.yaml should start studio with a file I referenced
  • asyncapi start studio:
    • no dummy file should be open
    • in CLI we have mechanism to support that if you do not provide reference to the file, CLI follows default and checks if asyncapi called document is there in the CDW
    • if there are no defaults, no documents that we can open, open empty studio and in console log provide proper information why empty studio is opened

@Adi-204
Copy link
Contributor

Adi-204 commented Jan 20, 2025

@derberg please provide feedback on PR changes and any suggestions from your side.

@github-project-automation github-project-automation bot moved this from To Triage to Done in CLI - Kanban Jan 21, 2025
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
Status: Done
3 participants