asyncapi/bindings

Clarify Readme files: Specification extensions for binding objects

nadjahagen opened this issue ยท 19 comments

Reason/Context

The README files suggest that specification extensions are not allowed for binding objects because of the sentences "This object MUST NOT contain any properties. Its name is reserved for future use." and "This object MUST contain only the properties defined above.". This can be confusing, especially for people who are new to AsyncAPI and are not aware that specification extensions are possible.

I myself had overlooked the sentence "This object can be extended with Specification Extensions." at the end of the table in the documentation on the website (e.g. like here) and therefore thought that some binding objects cannot be used at the moment.

Description

The sentence "This object MUST NOT contain any properties. Its name is reserved for future use." and "This object MUST contain only the properties defined above." could be replaced or completed by a sentence/link like on the website "This object can be extended with Specification Extensions.".

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.

Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@nadjahagen Hi! Good point! Bindings is still in "alpha" version that we have such a feature, but we haven't any tooling which support this. However, for me

"This object MUST NOT contain any properties. Its name is reserved for future use." and "This object MUST contain only the properties defined above."

means exactly as you wrote at the end. This object can be extended by extension, but the properties for that objects cannot be another than defined, so you can still use the fields with x- prefix, but you cannot define another fields next to defined in the spec of the binding (without x- prefix).

Or there is the possibility that you cannot actually use extensions in bindings. @fmvilas

This object MUST contain only the properties defined above.

This means you can't define any property that's not defined there and therefore also not extensions. @nadjahagen I wonder why you want to place extensions there. Would be great to have an example.

This object MUST NOT contain any properties. Its name is reserved for future use.

Same as above with the additional constraint that this empty MUST be empty. This is to prevent people from putting there whatever they want and then one day we add a schema and they get a breaking change.

@fmvilas my use case is that we are using Kafka and would like to specify the number of partitions for a topic and the replication factor. Like I understood the binding specification for Kafka, that is currently not possible. So I thought that it might be possible to define it by using specification extensions for the Server or Channel object.
Using specification extensions would be my "workaround" until there is a schema for these objects which allows defining this.

I think the number of partitions for a topic is a perfect example of a specification extension use case. Bindings (short for Protocol Bindings) are meant for protocol-specific stuff you need to know during the connection, disconnection, and the sending/receiving of messages. What you want to define is the infrastructure which, from an API perspective, is not relevant. IMO, this makes it a perfect specification extension.

So are specification extensions in a binding object allowed? In your answer above, you stated that "This object MUST contain only the properties defined above." means that no extensions are allowed. But on the AsyncAPI website, it says that specification extensions can be used. Sorry for me being still confused ๐Ÿ˜…

No problem ๐Ÿ˜„ The bindings object on the spec can be extended, as it's described on the spec: https://www.asyncapi.com/docs/specifications/v2.1.0#operationBindingsObject. However, each binding object is not extendable. For instance, you can do this:

bindings:
  ws:
    ...
  kafka:
    key:
      ...
  x-my-extension:
    ...

But you can't do this:

bindings:
  ws:
    ...
  kafka:
    x-my-extension:
      ...
    key:
      ...

Does that make sense?

Ah okay, thank you! Now it makes sense ๐Ÿ˜„ Then I think this should be a feature request:

bindings:
  ws:
    ...
  kafka:
    x-my-extension:
      ...
    key:
      ...

In order to be able to extend each binding object with properties like "number of partitions" or "replication factor". Another use case would be, if you want to add some kind of additional description/documentation for a single binding object. Or is there a reason why extensions should not be possible at this level?

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 โค๏ธ

oh, this is actually very interesting, @fmvilas any particular reason why we do not allow extensions inside each binding by default. It would make lots of sense to enable others to experiment first and then push some props as official ones

Can't remember at the moment tbh ๐Ÿ˜… Yeah, makes sense to let people extend them and experiment ๐Ÿ‘

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 โค๏ธ

As we are talking here about bindings specification, we do not talk about AsyncAPI spec feature. AsyncAPI leaves it up to the bindings. So depends on how much you need it @nadjahagen. Could be that best is to introduce it through #62 and have it as standard for all bindings.

@fmvilas thoughts? cc @iancooper

Yeah, that's one way. Or just go through all the bindings and allow extensions on each one. Just so #62 is not a blocker.

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 โค๏ธ

Still relevant.

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 โค๏ธ