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

Bundle references into components #34

Closed
jonaslagoni opened this issue Mar 24, 2022 · 3 comments · Fixed by #46
Closed

Bundle references into components #34

jonaslagoni opened this issue Mar 24, 2022 · 3 comments · Fixed by #46
Labels
enhancement New feature or request released

Comments

@jonaslagoni
Copy link
Member

jonaslagoni commented Mar 24, 2022

Reason/Context

Currently, we inline the references inside the AsyncAPI document. However, I think the references should be kept, and relocate it inside components instead, or provide an option to do so, although I dont know why both would be needed. This also fixes a problem with circular references.

For example:

# asyncapi.yaml
asyncapi: '2.2.0'
info:
  title: Account Service
  version: 1.0.0
  description: This service is in charge of processing user signups
channels:
  user/signup:
    subscribe:
      message:
        $ref: './messages.yaml#/messages/UserSignedUp'

#messages.yaml
messages:
  UserSignedUp:
    payload:
      type: object
      properties:
        displayName:
          type: string
          description: Name of the user
        email:
          type: string
          format: email
          description: Email of the user

Should resolve to:

# After combining 
asyncapi: 2.2.0
info:
  title: Account Service
  version: 1.0.0
  description: This service is in charge of processing user signups
channels:
  user/signedup:
    subscribe:
      message:
        $ref: '#/components/messages/UserSignedUp'
components: 
  messages:
    UserSignedUp:
      payload:
        type: object
        properties:
          displayName:
            type: string
            description: Name of the user
          email:
            type: string
            format: email
            description: Email of the user
@jonaslagoni jonaslagoni added the enhancement New feature or request label Mar 24, 2022
@Souvikns
Copy link
Member

I think we can use https://github.com/asyncapi/optimizer to move references to components, I haven't tested anything yet but giving a quick read I think we will be able to do it.

I will try this out and let you know @jonaslagoni

@github-actions
Copy link

github-actions bot commented Aug 1, 2022

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 ❤️

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants