Skip to content

Add asyncapi bundle command #219

Closed

Description

@derberg

This issue is for https://www.openforce.tech/ participants. If you do not participate in this even please pick up other issue from this repo, there is plenty of help needed 😄

Reason/Context

We need to enable the community to use all AsyncAPI tools in CLI if only possible -> https://github.com/asyncapi/bundler

Description

This issue is for https://www.openforce.tech/ participants. If you do not participate in this even please pick up other issue from this repo, there is plenty of help needed 😄

@Souvikns pinging you so you are aware 😄

Activity

  1. added
    enhancement
    on Feb 8, 2022
  2. amanbedi1 commented on Mar 14, 2022

    @amanbedi1
    Contributor

    HI @derberg @Souvikns I am Amanpreet a contributor to OpenForce 2022. I would like to work on this issue. I would be making a PR as soon as I am done with resolving the issue. Thank you.

  3. amanbedi1 commented on Mar 14, 2022

    @amanbedi1
    Contributor

    I just want to ask in this command the first file passed to command should be base file or not.

  4. derberg commented on Mar 14, 2022

    @derberg
    MemberAuthor

    @Souvikns what do you think about the question from @amanbedi1 ? I'm personally not 100% sure but I think non of the files should be considered a base, but simply by default we should put bundled document in the terminal output, and there should also be an option like --output that user could use to specify where to output bundled doc as a file. Thoughts?

  5. Souvikns commented on Mar 14, 2022

    @Souvikns
    Member

    I just want to ask in this command the first file passed to command should be base file or not.

    bundler takes an array of files but it does not read the files, so you have to read and pass in the content. And base is an option that you can pass. base is for when you want to preserve some schema objects while you are merging multiple separate specifications.

    and there should also be an option like --output that user could use to specify where to output bundled doc as a file. Thoughts?

    Yeah actually when bundler had a CLI it had a --output but since it is library now it just returns a document object and in the CLI interface we can implement the --output. My thought behind this was since server-api will also integrate bundler it would be easier to just bundle and then send the final document over REST.

  6. amanbedi1 commented on Mar 14, 2022

    @amanbedi1
    Contributor

    Ok so I think I just have to output bundled file in terminal or --output flag specify where to output bundled doc as a file.
    I will try to resolve it.

  7. derberg commented on Mar 14, 2022

    @derberg
    MemberAuthor

    My thought behind this was since server-api will also integrate bundler it would be easier to just bundle and then send the final document over REST.

    what do you mean @Souvikns

  8. Souvikns commented on Mar 14, 2022

    @Souvikns
    Member

    I mean there is no way to output a file to a certain directory right now in bundler. It just gives you string and JSON object. So bundler does not care about file system so tools like studio where we do not have access to the file system can also use bundler same goes for server-api which will just send the data over HTTP request.

  9. derberg commented on Mar 14, 2022

    @derberg
    MemberAuthor

    but this is CLI where we implement bundler option, so CLI should handle the option to output bundler-provided data into a file. Same like server-api will handle sending reply with JSON object. As you wrote, bundler is just to bundle and provide JSON Object (or string) and tools that integrate it, like CLI or Studio or server-api handle rest, like post processing of bundler output.

    we just need to remember that this --output flag just like --watcher should be generic, reusable, so other commands can easily use it too, like diff for example

  10. Souvikns commented on Mar 14, 2022

    @Souvikns
    Member

    we just need to remember that this --output flag just like --watcher should be generic, reusable, so other commands can easily use it too, like diff for example

    Oh now I get you 😄, yeah definitely --output should be reusable.

  11. amanbedi1 commented on Mar 18, 2022

    @amanbedi1
    Contributor

    Hey @derberg @Souvikns I am almost done with bundle command but there is a problem when I try to bundle below files the output is not as expected. So can you guide me how to do this. Files are attached below.

    signup.yaml

    asyncapi: '2.2.0'
    info:
      title: Account Service
      version: 1.0.0
      description: This service is in charge of processing user Signup 
    
    channels:
      user/signedup:
        subscribe:
          message:
            payload:
              type: object
              properties:
                displayName:
                  type: string
                email:
                  type: string
                  format: email
    
    

    login.yaml

    asyncapi: '2.2.0'
    info:
      title: Account Service
      version: 1.0.0
      description: This service is in charge of processing user signup
    
    channels:
      user/loggenin:
        subscribe:
          message:
            payload:
              type: object
              properties:
                displayName:
                  type: string
    
    

    Bundled (terminal) output

      asyncapi: '2.2.0',
      info: {
        title: 'Account Service',
        version: '1.0.0',
        description: 'This service is in charge of processing user signup'
      },
      channels: {
        'user/signedup': { subscribe: [Object] },
        'user/loggenin': { subscribe: [Object] }
      }
    

    Expected output

    asyncapi: '2.2.0'
    info:
      title: Account Service
      version: 1.0.0
      description: This service is in charge for processing user authentication 
    
    channles:
      user/signedup:
        subscribe:
          message:
            payload:
              type: object
              properties:
                displayName:
                  type: string
                email:
                  type: string
                  format: email
      user/loggedin:
        subscribe:
          message:
            payload:
              type: object
              properties:
                displayName:
                  type: string
    
  12. Souvikns commented on Mar 18, 2022

    @Souvikns
    Member

    Would be better if you open a WIP PR then I can take a look at your changes, but this is happening most probably because you are using document.json() that's why you are getting output in JSON format for YAML format you have to use document.yml() you can refer this document to learn more https://github.com/asyncapi/bundler/blob/master/API.md#Document+yml

  13. amanbedi1 commented on Mar 18, 2022

    @amanbedi1
    Contributor

    @Souvikns thanks its working.

  14. amanbedi1 commented on Mar 18, 2022

    @amanbedi1
    Contributor

    hey @Souvikns @derberg I just made a PR. Please review it

  15. github-actions commented on Jul 17, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity 😴

    It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

    There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

    Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

    Thank you for your patience ❤️

  16. github-actions commented on Nov 16, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity 😴

    It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

    There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

    Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

    Thank you for your patience ❤️

  17. asyncapi-bot commented on Mar 30, 2023

    @asyncapi-bot
    Contributor

    🎉 This issue has been resolved in version 0.36.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  18. s1mrankaur commented on Feb 16, 2024

    @s1mrankaur

    @amanbedi1 @Souvikns
    My yml file has

    $ref: ./components/channels/site-channels.yml#/channels/sites-change

    The bundle command errors out with
    ENOENT: no such file or directory,

    as it doesn't get the path right.

    My structure is

    
    event-catalog2/
      event-specs/
         channels/
           site-channels.yml
         asyncpi.yml
    
    
    

    and the command was looking for
    C:\BLBLA\event-catalog2\components\channels\site-channels.yml'

    i.e skipped event-specs folder somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleasedstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions