asyncapi/spec

Should the Reply Object extend from the Operation Object?

smoya opened this issue · 5 comments

smoya commented

The purpose of this issue is to have a place where we discuss the possibility of treating the current Operation Reply Object as Operation Object.

This question has been raised at least twice:

  • #981 (comment)
    • Adding a new field, like operationId as you suggest, makes the reply object being very close to what an Operation is.
      Wondering if then would make sense to suggest we reference an operation in the reply field instead of that?

    • A reply to a request it's an operation that is triggered by another operation. I see it in that way.

  • https://asyncapi.slack.com/archives/C0230UAM6R3/p1702644957009039?thread_ts=1702644262.509169&cid=C0230UAM6R3
    • I think it makes sense to define the reply object as a send operation with an address field. what do you think?

    • If specs support the channel in the reply as a logical consequence it should treat the reply as an operation IMHO.

Some caveats and doubts to consider if replies become operations:

  • What about the action field? Should become send or receive? Does it even make sense to have the action?
  • When using $ref to an operation in the reply operation field, is recursivity a concern?
  • Others? (expect to have more)

cc @KhudaDad414 @fmvilas @derberg @Tenischev @GreenRover

smoya commented

@GreenRover Would you mind expanding info from your comment in #981 (comment) ? Specially around this sentence:

What i intended with the current solution is that you can generate code out of the spec that full fills the classic blocking request reply.

Thank you 🙏

With the current solution a code generator could create methods like: public Pong ping(Ping ping) ...

@Tenischev if there would be 2 operations for a RequestReply. Where is the need for the relation between them?

@Tenischev if there would be 2 operations for a RequestReply. Where is the need for the relation between them?

You asking about code or spec?
If about the spec, for me the reply part of operation is greatly serve for a dynamic return address. Other users may see their benefits.
If about the code, well it's depends on how code is structured.

Regarding the topic, I see a logical problem that action and channel fields which are required in Operation Object will be not required in child object (at least channel could be null).
In the same time, I think following properties would bring good for users

  • summary, description and externalDocs - it's always good if user have a place where document
  • security - maybe reply channel or address will require less permission (or another scope e.g. for oauth)
  • bindings - definitely yes, e.g. for Kafka it could define a "reply partition". Maybe should I open a separate issue to add bindings to the reply?
  • traits - why not

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 ❤️