-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
Ambiguity in Operation.message
field
#588
Comments
Exactly, we have a bug with type of
we cannot use this description, because you can use here single Message Object or list of Message Objects, so:
would be better. According to your suggestion with type: EDIT: |
On the other hand, I wonder why we are using the @fmvilas I need your help here. Why even from |
Then the Type definition should be
What would be the semantics of this? In order for this to be in spec, we have to define it's behavior.
IMHO it doesn't make any sense, as I already pointed out in my issue description and now you realizing it. |
Additionally, the use of the word Currently you can define message as: message:
payload: ... or message:
oneOf:
- payload: ... # message 1
- payload: ... # message 2 so
TBH I don't know, maybe as I wrote, |
Found an example here: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#channel-item-object-example (third and forth example). I agree it's difficult to understand and figure it out, looking at currently defined
I assume that the intention was to indicate that only one of defined messages apply here and not all. Having it defined as an array ( |
Yes, the intention behind having I'd like to clarify that I think the definition should be something like @char0n would you mind opening a PR clarifying it? Also explaining the meaning of |
@fmvilas sure I'll handle it, now that I understand the original intention, it shouldn't be a problem. |
In practice for tooling implementations, can be translated to a Schema with only a |
I don't think so, because |
Sorry my bad. I meant for validating, to use a Schema with only a oneOf field containing all message payloads, which are actually Schemas. |
You can do that, but this operation should retrieves all payloads from possible messages and concatenate them in the |
Yep, exactly, JSON Schema should only include another JSON Schema; every unrecognized keyword is ignored. The situation changes in Draft 2020-12 where addition keywords can be given semantics by metaschemas. From the perspective of AsyncAPI spec it would be more than improper to include arbitrary object within JSON Schema, like Message Object; so we must clearly communicate that
I'm not sure this would be possible. |
PR provided: #603 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
The PR is waiting for approval. All the requested changes has been processed. |
The PR has landed 2.3.0-2022-01-release.2. Should I close the issue or should I leave it to you (maintainers) to manage it's life cycle further? |
hey, in theory, #681 should close it once merged and bot should add a comment here that it is included in 2.3 🤞🏼 😄 |
Hi everybody,
I've intercepted a possible ambiguity and un-clarity within the specification (2.1.0) regarding
Operation.message
fixed field.Type of
Operation.message
fixed field is defined as[Message Object | Reference Object]
which means that the field is going to be a list and either Message Object or Reference Object is allowed within it.Inconsistent description
First sentence in the description then says
A definition of the message that will be published or received on this channel.
Other fields descriptions containing list of union types start with following sentence:A list of ...
. So I propose we change the first sentence of description toA list of Message Objects that will be published or received on this channel.
Allowing additional type in union not specified in Type field
Second sentence in description says:
oneOf is allowed here to specify multiple messages
. This has very serious implications. In order for this to be true we have to amend the Type ofOperation.message
to[Message Object | Reference Object | Schema Object]
. From the perspective of usage this doesn't really make sense as we already have this mechanism in[Message Object | Reference Object]
. I suggest to eliminate this sentence entirely to reduce complexity. The alternative ca be defining the type as[Message Object | Reference Object | Schema Object]
, but as argued there is no additional value in this.Invalid example
This example contains invalid usage of
Operation.message
field. The value of the field in example is defined as Message Object. This shouldn't be possible according to the current spec.I can issue a PR with the changeset if we agree on these points.
The text was updated successfully, but these errors were encountered: