-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
docs: channel object / $ref note. #826
Conversation
Change note about `$ref` fixed field, to prevent scaring folks off from using `$ref` under `channels`.
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide 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.
spec/asyncapi.md
Outdated
@@ -569,7 +569,7 @@ Describes the operations available on a single channel. | |||
|
|||
Field Name | Type | Description | |||
---|:---:|--- | |||
<a name="channelItemObjectRef"></a>$ref | `string` | Allows for an external definition of this channel item. The referenced structure MUST be in the format of a [Channel Item Object](#channelItemObject). If there are conflicts between the referenced definition and this Channel Item's definition, the behavior is *undefined*. <br/><br/>**Deprecated:** Usage of the `$ref` property has been deprecated. | |||
<a name="channelItemObjectRef"></a>$ref | `string` | Allows for an external definition of this channel item. The referenced structure MUST be in the format of a [Channel Item Object](#channelItemObject). If there are conflicts between the referenced definition and this Channel Item's definition, the behavior is *undefined*. <br/><br/>**Technical Note:** Going forward, `$ref` will no longer form part of these _fixed fields_, but will continue to function in the same role, as part of [Reference Object](#referenceObject). |
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.
Hi @ponelat,
Thanks for the proposal, here are couple of notes I have to this change:
Removal of deprecation message
If we remove the deprecation message, it's going to look like a cosmetic change, but it's not. We're actually removing a fixed field from the Channel Item Object
, which will change the way, how the eventual transcluded referenced value shape will look like (merging). I think we can make the deprecation message more precise by doing following change to clarify the deprecation scope:
**Deprecated:** Usage of the `$ref` property has been deprecated when accompanied with one or more fixed fields from Channel Item Object`.
We did the same change in OpenAPI specification some time ago to Path Item Object - https://github.com/OAI/OpenAPI-Specification/pull/2656/files
Self containment
The wording of the change is IMHO not self-contained. The wording inside one version of the spec should probably not refer to the future version of the spec - OAI/OpenAPI-Specification#2656 (comment)
Different behavior
but will continue to function in the same role, as part of [Reference Object](#referenceObject)
- this might not be true. Reference Object
does't allow additional fields, which means, no merging with referenced value is performed. ChannelItem.$ref
does allow additional fields, which gets merged with the referenced value. If there is a conflict, the behavior is undefined, but most implementations do merge using right shallow merge algorithm.
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.
Hey @char0n ,
Removal of deprecation message
Understood, although without highlighting how it can be used outside of fixed fields, then it reads as "Don't use $ref here".
Perhaps a tweak on your suggestion:
Deprecated: Using
$ref
with sibling fixed fields has been deprecated. Usage without any siblings is still encouraged!
The motivation behind changing the wording: highlighting that a specific usage of $ref is deprecated.
Self containment and Different behavior. Understood and agreed.
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.
The tweak sounds great, and is aligned with #699
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.
Made the change.
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 to disagree with you. IMHO, the sentence Using $ref with sibling fixed fields has been deprecated. Usage without any siblings is still encouraged!
is very difficult to understand. In particular, the word siblings
and referring to fixed fields
sounds confusing to me.
WDYT about this version?
Usage of the
$ref
property has been deprecated when accompanied by any of the other properties of a Channel Item Object.
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.
Hi @smoya,
Usage of the $ref property has been deprecated when accompanied by any of the other properties of a Channel Item Object.
When using https://grammarly.com/ to analyze the sentence, there are two suggestions to it:
- Passive voice - This sentence appears to be written in the passive voice. Consider writing in the active voice.
- Wordy sentence - Too many non-content words may indicate wordiness. Consider rewriting to avoid some of these words: of, the, has, been, when, by, any, a
IMHO @ponelat intention was to make explicit that if you use $ref
without any other properties nothing will change in the future.
I propose another suggestion that passes grammarly and is less technical (possibly less confusing as well):
Using $ref property has been deprecated when accompanied by other properties.
This doesn't suffer from passive voice and wordy sentence issues and it aligned with your suggestion. properties
is already used within the spec to refer to fixed or pattern fields. For me personally it also implicitly communicates that using $ref with no additional properties
is not deprecated and will continue to functional equivalently, but IMHO it's worth considering if we want to communicate explicitly as @ponelat did in his suggestion as a second sentence.
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'm happy with:
Using $ref property has been deprecated when accompanied by other properties.
Let's see what others say.
cc @alequetzalli @derberg
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.
Updated, but used field
instead of property
, to be consistent with the column name Field name
and the section Fixed 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.
LGTM. @ponelat I changed the title to make it conformant to the rules.
Not sure you saw (I think its marked as resolved?) we were discussing about the wording here #826 (comment) |
No, didn't see. Thanks for pointing out. |
Kudos, SonarCloud Quality Gate passed! |
Hi @derberg, would you mind looking in this PR? Thanks! |
Hey, sorry but I'm not a native speaker, and |
We're removing the Saying it also in different way: All the All the More info in: #607 and OAI/OpenAPI-Specification#2656 (comment) (just imagine that |
@derberg did my explanation helped a bit? |
thanks a lot for the explanation 🙏🏼 How about:
how about this way? The most important part is JSON reference says:
my question is:
?? |
As I pointed in #826 (comment) (and other issues and comments) - the wording of the suggested change is IMHO not self-contained. The wording inside one version of the spec should probably not refer to the future version of the spec (as this version of the spec can be the last one) - OAI/OpenAPI-Specification#2656 (comment)
This looks like an issue of the tooling. The specification is crystal clear that
IMHO this is why the
IMHO no. Additional fields allows to annotate
As per my answer above. |
Thanks for all the explanation @char0n I would only make a small suggestion that instead of |
IMHO
Used grammarly.com to analyze the wording. I guess I still prefer |
@derberg I'd like to move this forward a bit. Any preference on one of the following sentences? It's basically your suggestion run via grammarly.com.
|
I'm ok with I like It's just that the reality is that there are people that do not read spec on website, or on github specific tag. They read raw spec on Have a look at below, why I think people read from |
@derberg I'm fine with either of your sentences. @ponelat what do you think?
As I do ;]
Right, I'm not arguing that. What I said was: |
This pull request 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 pull request, add a comment with detailed explanation. There can be many reasons why some specific pull request 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 pull request forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
@derberg seems you need to resolve some more conflicts 🙂 |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@jonaslagoni thanks @char0n please have a final look and approve |
@char0n hey man, would be good to merge it before 3.0 |
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.
Looks good. Good to go!
/ready-to-merge |
🎉 This PR is included in version 3.0.0-next-major-spec.18 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 3.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
title: ✏️ Update docs: Channel Object / $ref note.
This is to prevent confusion around whether folks can/should make use of
$refs
under#/channels
.Hopefully it is
$ref
in$.channels.*.$ref
cc @char0n @smoya