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: adding document for Reuse with traits page #2036

Closed
wants to merge 6 commits into from

Conversation

mhmohona
Copy link
Contributor

@mhmohona mhmohona commented Aug 8, 2023

Description
Added Adding document for Reuse with traits page.

It is a part of GSoD'23 project.

Related issue(s):
fixes #1517

@netlify
Copy link

netlify bot commented Aug 8, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 68310b0
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64d228b2e047e00008530abd
😎 Deploy Preview https://deploy-preview-2036--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.

@mhmohona mhmohona changed the base branch from master to next-major-spec August 8, 2023 11:36
@github-actions
Copy link

github-actions bot commented Aug 8, 2023

⚡️ Lighthouse report for the changes in this PR:

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

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

@mhmohona mhmohona marked this pull request as ready for review August 8, 2023 15:59
@netlify
Copy link

netlify bot commented Aug 8, 2023

Deploy Preview for shimmering-choux-eb0798 ready!

Name Link
🔨 Latest commit 77224b5
🔍 Latest deploy log https://app.netlify.com/sites/shimmering-choux-eb0798/deploys/654985e37b478700078e2fdb
😎 Deploy Preview https://deploy-preview-2036--shimmering-choux-eb0798.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 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 Sep 1, 2023
Copy link
Member

@quetzalliwrites quetzalliwrites left a comment

Choose a reason for hiding this comment

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

I really enjoyed this draft, thank you for all your hard work so far ✨✨✨

Similar to the other PRs, we need to focus on getting a technical review before I can provide a more detailed editorial review. Let's make sure you get someone like Sergio or Lukasz to review this now.

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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


In this example, the `commonHeaders` trait, which includes a `Content-Type` header, is applied to the `commonMessage`.

## Trait Merging
Copy link
Member

Choose a reason for hiding this comment

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

is is different with 3.0
asyncapi/spec#907

weight: 200
---

Traits are a powerful way to define properties that can be reused across multiple message objects within the specification. Reusing traits promotes code maintainability, reduces duplication, and makes your AsyncAPI documents cleaner and easier to manage.
Copy link
Member

Choose a reason for hiding this comment

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

it is not only for for messages

@@ -0,0 +1,105 @@
---
title: Reusing Traits
Copy link
Member

Choose a reason for hiding this comment

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

it is not about reusing traits

maybe better Messages and Operations reusability with Traits?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the name dont you think Messages and Operations reusability with Traits is gonna be too long? How about only Traits??


Here's applying the `kafka` trait to an operation:

```yml
Copy link
Member

Choose a reason for hiding this comment

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

is this a valid document? almost all on root, and kinda confusing that $ref is there with other props 🤔

also if you show how to use trait, also show how the trait looks like

and most important, show how resulting document will look like after traits are really applied to document

type: integer
```

To apply this trait to a message object, you can do:
Copy link
Member

Choose a reason for hiding this comment

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

like in case of operation

I need to clearly see example trait, example how it is referenced to be used, and how resulting document will look like

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am struggling to come up with cde example. @derberg could you please help me here with the example?

@derberg derberg deleted the branch asyncapi:next-major-spec December 5, 2023 09:40
@derberg derberg closed this Dec 5, 2023
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]: document how to reuse traits
3 participants