-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Message referencing from operation needs to be more strict #991
Comments
That makes sense to me yea 🤔 |
Yes, that makes sense to me as well. |
How should this interact with operation traits that specify a message? Only allowing references to messages in a specific channel for them would limit their reusability. |
@buehlefs could you visualize a problem with an example? message trait is used usually when |
@fmvilas @jonaslagoni be aware that it can affect release date, unless we get help to make sure that is supported in parser-js and converter-js. Probably examples need a review. Nevertheless, better to add this limitation now, and relax with 3.1 or 3.2, cause other way around it will be a breaking change |
@derberg I am talking about an |
@buehlefs The following sentence located in the description of the Operation Trait object is wrong (nice catch!):
If you take a look at the fields an Operation Trait object has, You can confirm this is by design and expected by checking its corresponding JSON Schema definition at https://github.com/asyncapi/spec-json-schemas/blob/next-major-spec/definitions/3.0.0/operationTrait.json. We should fix that sentence. (I created the following issue so we work on it asap #994) |
@derberg @fmvilas I'm gonna start working on the validation for this in Parser-JS. We would need to add an Spectral rule to check that. Btw, we do not have particular rules for v3 implemented atm besides the standard ruleset. |
Awesome! Thanks, @smoya! I was wondering today if we shouldn't apply a similar rule to the It should be applied to the spec, JSON schemas, and the parser. |
Probably a good idea 🤔 |
Yup, good catch |
I gave this another thought and I think this shouldn't happen. What happens with channels and linked operations declared under components? Consider the following components in an AsyncAPI v3 doc: components:
channels:
aChannel:
messages:
aMessage:
$ref: '#/components/messages/aMessage'
operations:
anOperation:
action: send
channel:
$ref: '#/components/channels/aChannel'
messages:
- $ref: '#/components/channels/aChannel/messages/aMessage' You can see the I believe the current description of the
If the channel is located under |
Clarifying the rules we want to add:
Are we aligned? cc @fmvilas @derberg @jonaslagoni and anyone interested |
Yes, that's exactly what I mean. |
1/3 rules created: asyncapi/parser-js#911 |
Actually this won't be considered as a rule because there is nothing to validate here, right? |
Second rule created: smoya/parser-js#5 |
we have similar situation with so in general, we need to add one new sentence to suggested edit, for channel:
above example can of course be easily modified and for messages will for example sound
|
Good catch again. I will create the proper Spectral rule as well. |
Done. Added into the same previous PR asyncapi/parser-js#913 |
All parser-js required Spectral rules are now merged and enabled in |
I don't think we need to change that. It sounds pretty clear to me, specially now that we will update the
|
@smoya but current text is not clear that $ref pointer must point to the channel - it only says the message must be the same (but it is not explicit - even for us as even our converter do not convert properly) |
Let's move this discussion into #996 |
We are missing the Spectral rules for
Does it make sense? |
I think it does, yeah 👍 |
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 ❤️ |
Hi everyone! 👋 I believe this issue is still important despite the inactivity. We're missing Spectral rules for OperationReply.channel and OperationReply.messages. These rules should validate that: messages point to a subset of messages in the OperationReply.channel. Looking forward to your thoughts! Thanks! ❤️ |
Context
Messages in operation
Messages in operation reply
Key of the problem
Confusion
but does that mean that the reference must point to a message through channel location, or can be also
components
?for me this should be enforced:
this part
and people should not be allowed to do
otherwise we'll get into a trouble of mismatch, unless I'm wrong and
messageId
is not considered to be a part of messagetake this v2 example
converter will convert it to
operation points to message
UserSignedUp
but on a channel level we have a messagesubscribe.message
imho the only proper way is to specify that
$ref
pointer must point to the channel - and this needs to be validated with parser of course.Am I missing any possible errors that this could cause?
The text was updated successfully, but these errors were encountered: