Skip to content
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: allow servers and channels to be defined as components #133

Merged

Conversation

smoya
Copy link
Member

@smoya smoya commented Dec 2, 2021

Note that this PR is targeting asyncapi:2022-01-release branch, so merging it won't release a new version.

Description
This PR is part of asyncapi/spec#660.
It allows both servers and channels to be defined as (and referenced from) components, meaning the following will be now valid:

servers:
  production:
    $ref: '#/components/servers/myserver'
channels:
  some/events:
    $ref: '#/components/channels/myChannel'
components:
  servers:
    myserver:
      url: "http://localhost:5000/ws"
      protocol: ws
  channels:
    myChannel:
      description: "mychannel"

You can see the diff between this new schema 2.3.0 vs the previous 2.2.0 here: https://www.diffnow.com/report/l7ib3

Alternative, attached here:

2c2
<   "title": "AsyncAPI 2.2.0 schema.",
---
>   "title": "AsyncAPI 2.3.0 schema.",
20c20
<         "2.2.0"
---
>         "2.3.0"
33,36c33
<       "type": "object",
<       "additionalProperties": {
<         "$ref": "#/definitions/server"
<       }
---
>       "$ref": "#/definitions/servers"
59a57
>       
165,168c163,166
<       "required": [
<         "url",
<         "protocol"
<       ],
---
>       "anyOf" : [
>         { "required" : ["url", "protocol"] },
>         { "required" : ["$ref"] }
>       ],    
175a174,176
>         "$ref": {
>           "$ref": "#/definitions/ReferenceObject"
>         },
202a204,209
>     "servers": {
>       "type": "object",
>       "additionalProperties": {
>         "$ref": "#/definitions/server"
>       }
>     },
262a270,275
>         },
>         "servers": {
>           "$ref": "#/definitions/servers"
>         },
>         "channels": {
>           "$ref": "#/definitions/channels"

Related issue(s)
asyncapi/spec#660

@smoya smoya force-pushed the feat/serversChannelsAsComponents branch from b70330f to fc12b93 Compare December 2, 2021 15:31
@smoya smoya force-pushed the feat/serversChannelsAsComponents branch from fc12b93 to 0eafa78 Compare December 2, 2021 15:36
schemas/2.3.0.json Outdated Show resolved Hide resolved
schemas/2.3.0.json Outdated Show resolved Hide resolved
schemas/2.3.0.json Outdated Show resolved Hide resolved
@smoya smoya requested a review from magicmatatjahu December 7, 2021 13:20
@magicmatatjahu
Copy link
Member

magicmatatjahu commented Dec 17, 2021

@smoya You should wait for merge of it #139 and then switch PR's destination to the release-branch :) Changes are LGTM :)

@smoya
Copy link
Member Author

smoya commented Dec 17, 2021

then switch PR's destination to the release-branch

The destination branch is already there (it was already created) and this PR is targeting to be merged into it. If there are no other changes to introduce in 2.3.0 that are ready to merge on this repo, I think we can proceed with merging this one.

@magicmatatjahu
Copy link
Member

hah, I got confused, sorry 😅

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

LGTM

@derberg
Copy link
Member

derberg commented Dec 21, 2021

looks good but we need to wait for #139 and then you will need to solve some conflicts

@smoya
Copy link
Member Author

smoya commented Dec 22, 2021

looks good but we need to wait for #139 and then you will need to solve some conflicts

@derberg Would you mind approving this PR anyway? i won't mark it as ready to be merged until #139 is merged.

@derberg
Copy link
Member

derberg commented Dec 22, 2021

my approval won't make much sense as you will anyway have conflicts, which means additional commits that will cause a dismiss of my approval 😄

@smoya
Copy link
Member Author

smoya commented Dec 22, 2021

my approval won't make much sense as you will anyway have conflicts, which means additional commits that will cause a dismiss of my approval 😄

But it means a lot to my ❤️ , @derberg. Kidding, yeah you are right. Let's wait for those conflicts to come and get resolved!

@sonarqubecloud
Copy link

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
No Duplication information No Duplication information

@smoya
Copy link
Member Author

smoya commented Dec 28, 2021

This branch is now up-to-date with 2022-01-release and all conflicts have been solved. cc @derberg

@smoya smoya requested a review from magicmatatjahu December 30, 2021 09:49
Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

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

/dnm

@derberg
Copy link
Member

derberg commented Jan 13, 2022

asyncapi/spec#665 merged, so merging this one too

/rtm

@asyncapi-bot asyncapi-bot merged commit b51f0aa into asyncapi:2022-01-release Jan 13, 2022
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 2.13.0-2022-01-release.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@smoya smoya deleted the feat/serversChannelsAsComponents branch January 13, 2022 11:07
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.

5 participants