-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
trait vs. allOf ref vs. component ref - CloudEvents #1057
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
Hi @black-snow, I created the issue cloudevents/spec#1276 because I think it is a bit more complicated. For the fetching, caching, etc. questions: This is not part of the spec, but an implementation detail (but please correct me if I'm wrong). |
Let me throw here a similar discussion we had in AsyncAPI Slack -> https://asyncapi.slack.com/archives/C0230UAM6R3/p1712148557132589 (you need to first register with https://asyncapi.com/slack-invite) lemme paste it here
I started the conversation after reading https://atamel.dev/posts/2023/05-23_asyncapi_cloudevents/ and https://developers.redhat.com/articles/2021/06/02/simulating-cloudevents-asyncapi-and-microcks |
Thanks for sharing that thread. Very insightful. As someone having that use case I absolutely agree there is a use case :D It gets really messy once you produce or consume just half a handful of events. Right now my schema looks like components:
messages:
WhatevsEvent:
# ...
payload:
allOf:
- $ref: "#/components/schemas/Envelope"
- $ref: "#/components/schemas/WhatevsEventEnvelopeOverrides"
- type: object
properties:
data:
$ref: "#/components/schemas/WhatevsEventPayload"
# ...
schemas:
Envelope:
allOf:
- $ref: 'https://raw.githubusercontent.com/cloudevents/spec/v1.0.2/cloudevents/formats/cloudevents.json'
- $ref: "#/components/schemas/MyEnvelopeExtensions" Where overrides contains constants for |
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 ❤️ |
Stale it is, but no less relevant. I wonder if I should close it in favour of cloudevents/spec#1276, tho. |
I just stumbled across traits, must've missed them before. My initial thought was: 'oh nice, now I can pull out the CloudEvents JSON schema from the specs and don't need all the copypasta'.
I then found this and there is ... no trait:
Now I'm a bit confused. If I get it right, it'll just merge in the whole CloudEvents spec object, including its properties (why the
allOf
, though? Would it conflict with the explicitproperties
otherwise?). Now that's what I thought traits would be useful for. If we can just do it like that, why do we have traits? I'm pretty sure I'm missing something.Another thing in the back of my mind is schema validation. If I externalize parts of the schema, how will validation behave? Applications now need to reach out to GH and fetch the CloudEvents spec from there. Do I want this? Will it be cached? Should I rather split it into the spec I write and a "compiled" spec with everything inlined?
So, I was wondering how you do it and what traits are there for (the docs are rather brief).
The text was updated successfully, but these errors were encountered: