-
-
Notifications
You must be signed in to change notification settings - Fork 681
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
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-2036--asyncapi-website.netlify.app/ |
✅ Deploy Preview for shimmering-choux-eb0798 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are really great examples in https://github.com/asyncapi/spec/blob/next-major-spec/examples/streetlights-kafka.yml
|
||
In this example, the `commonHeaders` trait, which includes a `Content-Type` header, is applied to the `commonMessage`. | ||
|
||
## Trait Merging |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
Description
Added Adding document for Reuse with traits page.
It is a part of GSoD'23 project.
Related issue(s):
fixes #1517