-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
feat: add missed "metadata" fields in the Server/Channel/Operation Objects #796
feat: add missed "metadata" fields in the Server/Channel/Operation Objects #796
Conversation
spec/asyncapi.md
Outdated
|
||
#### <a name="metadataObject"></a>Metadata Object | ||
|
||
The object provides metadata about the described object. May contain previously non defined fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a problem with May contain previously non defined fields.
sentence, because I don't know if we should allow only defining extensions and not non defined field. With this possibility there will be problems with validation on tooling side, by extension we can support it, by non defined fields no.
@fmvilas @jonaslagoni @jessemenning New way of applying Metadata Object was introduces alongside with Server and Channel Traits in latest commits. Feedback are more that welcome :) |
Kudos, SonarCloud Quality Gate passed! |
I agree with some folks from https://www.youtube.com/watch?v=uoKEet0jcSc to not having a Metadata Object but have all those fields inline on those objects that don't have them. What I'm concerned about right now is the fact |
We don't have id on each object, please don't look on mentioned issue :)
For me it doesn't make the specification more complex, but let's see what other people say about it. |
By |
But |
Let's check the definition for
Now let's think, Isn't the My suggestion is to not only not add the |
I don't think so. As I wrote, id should be one in spec, names you can have several. A good analogy would probably be a dictionary. You can only have unique keys but the given keys can have the same values. That's how I've always understood it. |
Is there a clear use case for declaring the same name on different messages? |
@smoya I don't know. I'm not the creator of this spec |
I have a few concerns with this PR:
|
@fmvilas thanks! So tl;dr; 😄
|
Yes, but only the fields that make sense or are providing real value. |
8805c88
to
624ad52
Compare
1b876a1
to
4aa95d0
Compare
spec/asyncapi.md
Outdated
@@ -371,32 +391,54 @@ Field Name | Type | Description | |||
<a name="serverObjectUrl"></a>url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the AsyncAPI document is being served. Variable substitutions will be made when a variable is named in `{`braces`}`. | |||
<a name="serverObjectProtocol"></a>protocol | `string` | **REQUIRED**. The protocol this URL supports for connection. Supported protocol include, but are not limited to: `amqp`, `amqps`, `http`, `https`, `ibmmq`, `jms`, `kafka`, `kafka-secure`, `anypointmq`, `mqtt`, `secure-mqtt`, `solace`, `stomp`, `stomps`, `ws`, `wss`, `mercure`, `googlepubsub`. | |||
<a name="serverObjectProtocolVersion"></a>protocolVersion | `string` | The version of the protocol used for connection. For instance: AMQP `0.9.1`, HTTP `2.0`, Kafka `1.0.0`, etc. | |||
<a name="serverObjectName"></a>name | `string` | A machine-friendly name for the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the server id (the key in servers
object) already a machine-friendly name for the server? Why do we need one more property here? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review! This is one field I wonder if it makes sense. Of course, we can treat the key in servers/channels/operations as an id/name of object, but in v3, servers/channels/operations/messages will be easily referenced, hence this id between references can change, and someone, for example, needs to give a "static" name for an object that will not change between refs. This makes a lot of sense for model generation and reusability of models.
If, on the other hand, the name
doesn't make sense, we should probably remove it also from the Message Object
- the messageId
could be such a name for message. What do you think?
spec/asyncapi.md
Outdated
@@ -612,12 +654,15 @@ Field Name | Type | Description | |||
---|:---:|--- | |||
<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). | |||
<a name="channelObjectMessages"></a>messages | [Messages Object](#messagesObject) | A map of the messages that will be sent to this channel by any application at any time. **Every message sent to this channel MUST be valid against one, and only one, of the [message objects](#messageObject) defined in this map.** | |||
<a name="channelObjectName"></a>name | `string` | A machine-friendly name for the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as with server above. Isn't the channel id already a machine-friendly name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we end up leaving it, let's not forget to fix the typo:
<a name="channelObjectName"></a>name | `string` | A machine-friendly name for the server. | |
<a name="channelObjectName"></a>name | `string` | A machine-friendly name for the channel. |
spec/asyncapi.md
Outdated
@@ -612,12 +654,15 @@ Field Name | Type | Description | |||
---|:---:|--- | |||
<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). | |||
<a name="channelObjectMessages"></a>messages | [Messages Object](#messagesObject) | A map of the messages that will be sent to this channel by any application at any time. **Every message sent to this channel MUST be valid against one, and only one, of the [message objects](#messageObject) defined in this map.** | |||
<a name="channelObjectName"></a>name | `string` | A machine-friendly name for the server. | |||
<a name="channelObjectTitle"></a>title | `string` | A human-friendly title for the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<a name="channelObjectTitle"></a>title | `string` | A human-friendly title for the server. | |
<a name="channelObjectTitle"></a>title | `string` | A human-friendly title for the channel. |
spec/asyncapi.md
Outdated
@@ -808,6 +855,8 @@ Field Name | Type | Description | |||
---|:---:|--- | |||
<a name="operationObjectAction"></a>action | `string` | **Required**. Allowed values are `send` and `receive`. Use `send` when it's expected that the application will send a message to the given [`channel`](#operationObjectChannel), and `receive` when the application should expect receiving messages from the given [`channel`](#operationObjectChannel). | |||
<a name="operationObjectChannel"></a>channel | [Reference Object](#referenceObject) | **Required**. A `$ref` pointer to the definition of the channel in which this operation is performed. Please note the `channel` property value MUST be a [Reference Object](#referenceObject) and, therefore, MUST NOT contain a [Channel Object](#channelObject). However, it is RECOMMENDED that parsers (or other software) dereference this property for a better development experience. | |||
<a name="operationObjectName"></a>name | `string` | A machine-friendly name for the operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as with server and channel above. Isn't it enough with the operation id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but you got conflicts.
@fmvilas Thanks for review! Done :) |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@@ -2316,7 +2362,7 @@ type: userPassword | |||
``` | |||
|
|||
```yaml | |||
type: apiKey, | |||
type: apiKey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch :-)
PR in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice work!
/rtm |
Sorry! I had forgotten that automerge works here 😅 |
🎉 This PR is included in version 3.0.0-next-major-spec.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
…jects (asyncapi#796) Co-authored-by: Jonas Lagoni <[email protected]>
title: add missed "metadata" fields in the Server/Channel/Operation Objects
Related issue(s):
Resolves #795
Part of #750
This PR introduces:
title
,summary
,externalDocs
fields inServer Object
,title
,summary
fields inChannel Object
,title
field inOperation Object
andOperation Trait Object
,cc @fmvilas @derberg @jonaslagoni @smoya @dalelane