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

docs: introduce AsyncAPI document #1868

Merged
merged 18 commits into from
Dec 12, 2023

Conversation

quetzalliwrites
Copy link
Member

@quetzalliwrites quetzalliwrites commented Jun 29, 2023

Description
As part of Google Season of Docs 2023 at AsyncAPI, we're going to write in-depth explanations of the different sections of an AsyncAPI document to avoid difficulties in implementing EDAs.

For this document issue, we'll introduce the AsyncAPI document and why it is necessary.

Related issue(s)
This task is part of the GSoD Docs EPIC: #1507.

Screen Shot 2023-06-28 at 7 28 09 PM

@quetzalliwrites quetzalliwrites added 📑 docs area/docs Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. gsod This label should be used for issues or discussions related to ideas for Google Season of Docs labels Jun 29, 2023
@quetzalliwrites quetzalliwrites self-assigned this Jun 29, 2023
@netlify
Copy link

netlify bot commented Jun 29, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 49ba858
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/6578ade41aad83000888849d
😎 Deploy Preview https://deploy-preview-1868--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@quetzalliwrites quetzalliwrites linked an issue Jun 29, 2023 that may be closed by this pull request
@quetzalliwrites quetzalliwrites changed the title [📑 Docs]: introduce AsyncAPI document docs: introduce AsyncAPI document Jun 29, 2023
@quetzalliwrites
Copy link
Member Author

We require all PRs to follow Conventional Commits specification.

Oops 🙊

@github-actions
Copy link

github-actions bot commented Jun 29, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 20
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://deploy-preview-1868--asyncapi-website.netlify.app/

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 44
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://deploy-preview-1868--asyncapi-website.netlify.app/

@quetzalliwrites
Copy link
Member Author

Heyooo @derberg/ @smoya / @jonaslagoni ...this document introduces the asyncapi-document sub-directory content we're creating as part of 2023 GSoD. I would appreciate help with a review with tailored suggestions to improve this doc. Please let me know if I messed up and described how stuff works in v2, I am unsure if the info I provided is still accurate for v3. 😅 😄

@quetzalliwrites
Copy link
Member Author

The preview link to the doc (https://deploy-preview-1868--asyncapi-website.netlify.app/docs/concepts/asyncapi-document) is giving me a 404. I don't understand (yet) why since I made sure to add the required section.md and index.md files 🧐 .

Feedback is welcome 😂

Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the idea of expanding what the Spec documentation says 🙌 . I really believe we need this kind of documents if we really want to engage more people not only as users but as developers of AsyncAPI.

Thanks for starting this series of documents @alequetzalli!

I did a first review on it and dropped few comments, always assuming this docs will land for v3 and not v2. If that's not correct, please tell me.

Feel free to reach me for any questions.

version: 0.1.0
channels:
user/signedup:
subscribe:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually an invalid document. Version 3 changed how channels, operations, and messages are described and linked.
It also changed the terms Publish/Subscribe to Receive/Send in that order, since documents changed from being Client-Centric to Application-Centric (meaning they describe the applications API and not the client's interaction within those APIs).

Ok, probably too much info there to digest 😓 .

Let's start with some of the changes in v3 that affect this example:

  • Publish/Subscribe thing. Here is a simple cheat sheet I made for the talk I presented at the EDA Summit 23 that helps to convert from v2 to v3.
  • Channels now have a new field called address that holds the address of the channel. Now the name of the channel can be whatever name. I recommend userSignedUp here.
  • Channels don't include the Operation anymore. Instead, Operations are defined in the root document and are "linked" to the channel.

Applying all the previous, your document will look like this:

asyncapi: 3.0.0
info:
  title: Cool Example
  version: 0.1.0
channels:
  userSignedUp:
    address: user/signedup
    messages:
      userSignedUp:
        description: An event describing that a user just signed up.
        payload:
          type: object
          additionalProperties: false
          properties:
            fullName:
              type: string
            email:
              type: string
              format: email
            age:
              type: integer
              minimum: 18
operations: 
  userSignedUp:
    action: send
    channel: 
      $ref: '#/channels/userSignedUp'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, this was a lot of info but I really appreciate how fully you described everything. Thank you 🙏 !!!

One thing slightly confuses me... When you wrote changed the terms Publish/Subscribe to Receive/Send in that order, that made complete sense to me. With you so far. But then when I looked at your cheatsheet, my mind feels like it's trying to do gymnastics. Are you saying that in v3:

  • applications no longer subscribe, they send
  • applications no longer publish, they receive
    ?
    I have copied your updated code snippet and will integrate in my next commit. ✌🏽

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reality is that the approach or point of view of the documented API changes. In v3, we now clearly state that:

The AsyncAPI Specification defines a set of files required to describe the API of an application.

Meaning the document describes the API of the application that offers the AsyncAPI document.
That means operations with the action send, means that the application will perform that operation by sending the messages. On the contrary, receive means the application expects to receive those messages.

pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved


<Remember>
You might have additional fields depending on the implemented protocol (i.e., MQTT, AMQP, Kafka, etc.).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would clarify this with an example

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, noted. Added an example, you let me know if you like it.

@@ -0,0 +1,61 @@
---
title: 'Introduction'
weight: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with subsections it works this way that the "starting weight" is the weight of the _section.md so change it to 50 or more and all the next documents should follow. This way you fix preview and make sure it shows in the UI

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Nov 16, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 37
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-1868--asyncapi-website.netlify.app/

@quetzalliwrites
Copy link
Member Author

Hey there @smoya (cc @derberg), I have FINALLY sat down and addressed all of your great feedback on my GSoD PR introducing the topic of the AsyncAPI document. If possible, I would truly appreciate a review from you again. 🙏

Lukasz, I definitely need your review and (eventual) stamp of approval on my PR. Appreciate your review 🙏

weight: 50
---

The AsyncAPI Specification defines a set of files required to describe the API of an application. One of those files is the AsyncAPI document; it describes the message-driven API in accordance with the AsyncAPI Specification via JSON objects that conform to the JSON standards. (YAML, being a superset of JSON, can also be used.) The AsyncAPI document offers a standardized approach for documenting and describing asynchronous and event-driven systems, clearly defining various components like channels and messages. Additionally, users can leverage both the AsyncAPI document and tools like the AsyncAPI Generator for code and documentation generation, enhancing efficiency and consistency in their development processes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of those files is the AsyncAPI document

I don't think we have other kind of files rather than the AsyncAPI document.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, noted! fixing

Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I used Github mobile app, some of my comments related to the review I did are gone. Today, it happened twice to me... I'm sorry, I tried to replicate those again.

pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
pages/docs/concepts/asyncapi-document/index.md Outdated Show resolved Hide resolved
@quetzalliwrites
Copy link
Member Author

Thank you soooo much, @smoya for another review!

I have addressed all your feedback, so this is ready for review again 😄😅

Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!🙌

weight: 50
---

The AsyncAPI Specification defines a set of files (AsyncAPI documents) required to describe the API of an application. The AsyncAPI document describes the message-driven API in accordance with the AsyncAPI Specification via JSON objects that conform to the JSON standards. YAML, being a superset of JSON, can also be used. It also offers a standardized approach for documenting and describing asynchronous and event-driven systems, clearly defining various objects such as channels and messages. Additionally, users can leverage both the AsyncAPI document and tools like the AsyncAPI Generator for code and documentation generation, enhancing efficiency and consistency in their development processes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AsyncAPI Specification defines a set of files (AsyncAPI documents) required to describe the API of an application. The AsyncAPI document describes the message-driven API

I'm not a fan of this, but I know this is how we have it in spec document 😆 so first we need to fix it there.

it is not that spec defines a set of files. Spec defines a set of fields that one can use to create one or more asyncapi document that describe an API of the app, and such single AsyncAPI document can reference other files that may contain some fields described in he spec

spec says The AsyncAPI Specification defines a set of files required to describe the API of an application - and I think it is a "train of thought" that refers to a fact that one AsyncAPI document can consist of multiple files (because of Reference Object concept, basically refers to this doc) and not that you create a set of AsyncAPI documents for an app. I hope you know what I mean, not sure how explain it better.

super hard to explain with words

in example: you have an AsyncAPI document like https://github.com/asyncapi/spec/blob/master/examples/social-media/backend/asyncapi.yaml but it also contains references to files like https://github.com/asyncapi/spec/blob/master/examples/social-media/common/servers.yaml

☝🏼 is what spec explanation means by The AsyncAPI Specification defines a set of files required to describe the API of an application because in the end it is not just one AsyncAPI document but also another files with some shared fields

when you write The AsyncAPI Specification defines a set of files (AsyncAPI documents), especially the part (AsyncAPI documents) kinda suggests that one app always has set of AsyncAPI documents, but there is always one

please write you know what I mean 🙏🏼 😄 as I have a feeling I got into a loop 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I understand... lemme know if you agree @derberg

The original spec text seems to inaccurately suggest that multiple AsyncAPI documents are required for each application, whereas you're saying that a single AsyncAPI document, potentially referencing other files, is typically used to describe an application's API.

Perhaps it is more accurate to say that the AsyncAPI Specification defines a set of fields that can be used in one or more AsyncAPI documents to describe an application's API. A single AsyncAPI document can reference other files, but it doesn't mean that multiple AsyncAPI documents are required for a single application.

While the AsyncAPI document is the primary file describing the API, it can include references to other files that contain additional details or shared fields. This doesn't equate to requiring multiple AsyncAPI documents for a single application.

📣 How about the following instead?

Proposing the following update to the Spec and this document:

The AsyncAPI Specification defines a set of fields that can be used in an AsyncAPI document to describe an application's API. The document may reference other files for additional details or shared fields, but it is typically a single, primary document that encapsulates the API description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, thanks a 💯 you can update this PR to and we can merge it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@derberg derberg merged commit 531a99f into asyncapi:master Dec 12, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. 📑 docs gsod This label should be used for issues or discussions related to ideas for Google Season of Docs
Projects
Status: Community PR under Review 🧐
Development

Successfully merging this pull request may close these issues.

[📑 Docs]: introduce AsyncAPI document
4 participants