Skip to content

feat: add new channels object - #827

Merged
asyncapi-bot merged 11 commits into
asyncapi:next-major-specfrom
fmvilas:new-channels-object
Sep 21, 2022
Merged

asyncapi-bot merged 11 commits into
asyncapi:next-major-specfrom
fmvilas:new-channels-object

Conversation

@fmvilas

@fmvilas fmvilas commented Aug 27, 2022

Copy link
Copy Markdown
Contributor

Related issue(s):
#663
#682
#618

@fmvilas

fmvilas commented Aug 28, 2022

Copy link
Copy Markdown
Contributor Author

@GreenRover this PR should unblock your request/reply work.

Comment thread spec/asyncapi.md Resolved
@fmvilas

fmvilas commented Sep 6, 2022

Copy link
Copy Markdown
Contributor Author

/progress 60

New channels shape is defined but it's still pending review by code owners.

@fmvilas

fmvilas commented Sep 7, 2022

Copy link
Copy Markdown
Contributor Author

@derberg @dalelane @smoya would you mind having a look?

Comment thread spec/asyncapi.md
<a name="A2SServers"></a>servers | [Servers Object](#serversObject) | Provides connection details of servers.
<a name="A2SDefaultContentType"></a>defaultContentType | [Default Content Type](#defaultContentTypeString) | Default content type to use when encoding/decoding a message's payload.
<a name="A2SChannels"></a>channels | [Channels Object](#channelsObject) | **Required** The available channels and messages for the API.
<a name="A2SChannels"></a>channels | [Channels Object](#channelsObject) | The channels used by this [application](#definitionsApplication).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice channels is not required anymore.

Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md
<a name="channelItemObjectPublish"></a>publish | [Operation Object](#operationObject) | A definition of the PUBLISH operation, which defines the messages consumed by the application from the channel.
<a name="channelItemObjectParameters"></a>parameters | [Parameters Object](#parametersObject) | A map of the parameters included in the channel name. It SHOULD be present only when using channels with expressions (as defined by [RFC 6570 section 2.2](https://tools.ietf.org/html/rfc6570#section-2.2)).
<a name="channelItemObjectBindings"></a>bindings | [Channel Bindings Object](#channelBindingsObject) \| [Reference Object](#referenceObject) | A map where the keys describe the name of the protocol and the values describe protocol-specific definitions for the channel.
<a name="channelObjectAddress"></a>address | `string` \| `null` | An optional string representation of this channel's address. The address is typically the "topic name", "routing key", "event type", or "path". When `null` or absent, it MUST be interpreted as unknown. This is useful when the address is generated dynamically at runtime or can't be known upfront. It MAY contain [Channel Address Expressions](#channelAddressExpressions).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address is no longer a URL template and, instead, it's just a plain string that supports Channel Address Expressions.

Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md


Using explicit by-name references to the servers on which the channel is available:
#### <a name="channelAddressExpressions"></a>Channel Address Expressions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went all-in defining our own templating rules here. I don't know what I was thinking when I defined the channel address as a URL template in version 2.0.0 😅 Have a look: https://www.rfc-editor.org/rfc/rfc6570#section-2.4.2.

Comment thread spec/asyncapi.md Outdated

Expressions MUST be composed by a name enclosed in curly braces (`{` and `}`). E.g., `{userId}`.

When the channel address contains [delimiters](#channelObjectAddressDelimiter), the expressions MUST be surrounded by either the delimiters, the beginning of the string, or the end of the string. E.g., assuming a `.` (dot) delimiter, `users.{userId}` is correct but `users.id{userId}` is not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is covering most of the protocols supporting any form of wildcards: AMQP, MQTT, NATS, etc. It's still missing a Kafka feature that lets you subscribe to a regular expression. I tried to map it here but it's too complex and therefore left it out.

If you got any ideas on how to do it, I'm all ears. Otherwise, I'll open a follow-up issue and this can be included in future versions.


If you're curious, I came up with a solution like users_{userId:/[\w\d]{8}/i} but quickly got trapped in the differences between regular expression engines hole.

Kafka protocol doesn't define anything so it's hard for us to make a commitment here. Maybe go for the engine with fewer features, just to make sure everything is supported in every engine? Coming up with a subset ourselves? Should we just forget about it? Hot topic!

@derberg derberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments

3.0 is materializing ❤️

Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md Resolved
Comment thread spec/asyncapi.md Resolved
@fmvilas

fmvilas commented Sep 9, 2022

Copy link
Copy Markdown
Contributor Author

@derberg I addressed all the feedback. Let me know what you think now.

@fmvilas
fmvilas requested a review from jonaslagoni September 12, 2022 10:33

@derberg derberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

again, info, once we merge, we release a release candidate 😉

@jonaslagoni jonaslagoni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a few remarks, otherwise looks good 👍

Comment thread spec/asyncapi.md
#### <a name="channelObject"></a>Channel Object

Describes the operations available on a single channel.
Describes a shared communication channel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A shared communication channel with who? Am I the only one who feels like this sentence is incomplete in some way... 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't know in advance. We only know it's gonna be shared 🤷

Comment thread spec/asyncapi.md Resolved

@dalelane dalelane left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I particularly like moving the topic name out of the spec document key, and into an address field

Co-authored-by: Jonas Lagoni <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@fmvilas

fmvilas commented Sep 21, 2022

Copy link
Copy Markdown
Contributor Author

/rtm

@asyncapi-bot
asyncapi-bot merged commit 8805c88 into asyncapi:next-major-spec Sep 21, 2022
@fmvilas
fmvilas deleted the new-channels-object branch September 21, 2022 12:43
@fmvilas

fmvilas commented Sep 21, 2022

Copy link
Copy Markdown
Contributor Author

😱 😄

@fmvilas

fmvilas commented Sep 21, 2022

Copy link
Copy Markdown
Contributor Author

@derberg It didn't create any release candidate. Is it expected?

@derberg

derberg commented Sep 21, 2022

Copy link
Copy Markdown
Member

no, mainly because the fix I did in release pipeline did not go to next-major-spec branch as there are merge conflicts between it and master. It is good though, as PR title should be feat!: to get 3.0 RC and not 2.5 RC. So by accident we did not release a confusing release 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants