-
-
Notifications
You must be signed in to change notification settings - Fork 697
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
doc: getting started with traits #7
Comments
This issue has been automatically marked as stale because it has not had recent activity 😴 |
Hi! I just want to cross-reference my Slack discussion on this: My general problem here was that my assumption of traits is that they won't override the existing attributes of the "target" where they are apply. This is at least how traits worked in the context I've seen them before. Since there seem to be different understandings and interpretations of it I'd propose to explicitly state the behavior of traits and it's consequences (e.g. In the current implementation they can't be used to provide defaults) Example: {
"asyncapi": "2.0.0",
"components": {
"messages": {
"Message1": {
"headers": {
"datacontenttype": {
"const": "text/xml"
}
}
},
"traits": [
{
"$ref": "#/components/messageTraits/CloudEventsContext"
}
]
}
},
"messageTraits": {
"CloudEventsContext": {
"headers": {
"type": "object",
"properties": {
"datacontenttype": {
"description": "Content type of the data value. Must adhere to RFC 2046 format.",
"type": "string",
"const": "application/json"
}
}
}
}
}
}
} After traits are applied, the message will effectively have |
Also maybe related: It would be very helpful to have concrete guidance and even better - a flow diagram - how traits, https://asyncapi.slack.com/archives/C34F2JV0U/p1588917213473500 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
@alequetzalli you might want to have it in documentation dashboard 😄 |
@derberg done! Moved to Docs Board and triaged in To-Do column. 👩🏻💻 |
Hello @alequetzalli @fmvilas is this issue still open if it is then please assign it to me; and also please give feedback on my below solution ; In the previous section, we learned how to define messages and operations in an AsyncAPI document. Now, let's explore how to reuse parts of a message or operation by using traits.
|
Hey @ro4i7, please don't spam an issue by copy/pasting your entire written content idea to the threads of comments. The appropriate way to submit a contribution idea is to open a PR with your contribution and then you can tag us to review or link to it in the issue. If you wrote this, and would like to propose this a contribution for this doc, then please open a PR with this content/all info needed. Question: Did you write this, or did you generate it with ChatGPT? |
Hi, am Aditi looking to contribute towards Async API. Could I work on this issue? |
What?
Write a chapter of the getting started guide expanding on reusability. It should go right after #6.
We should keep it simple and explain how to reuse parts of a message or operation by using traits.
We should not mention anything about other reusable components. At most, just provide a link to the spec for the curious. The whole idea is to keep it simple and to the point. No need to explain everything in a single chapter.
Why?
To introduce the
traits
feature and its purpose.The text was updated successfully, but these errors were encountered: