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

support address parameters in channels #544

Closed
KhudaDad414 opened this issue Oct 20, 2023 · 5 comments · Fixed by #551
Closed

support address parameters in channels #544

KhudaDad414 opened this issue Oct 20, 2023 · 5 comments · Fixed by #551
Assignees
Labels
enhancement New feature or request released

Comments

@KhudaDad414
Copy link
Member

KhudaDad414 commented Oct 20, 2023

Reason/Context

suppose I have the following AsyncAPI spec file in version 3 of the spec:

...
servers:
  slack:
    host: wss-primary.slack.com
    protocol: wss
channels:
  main:
    address: "/link/?ticket={ticket}&app_id={appID}"
    parameters:
      ticket:
        description: "your ticket ID. Ticket id can only be used for once."
        location: "$message.payload#/messageId"
        enum: ["a", "b"]
        default: ""
      appID:
        description: "Your slack app ID"
        enum: ["ffff", "ddddd"]
        default: ""
    bindings: 
      ws: {}
    messages:
      reactionAdded:
        $ref: "#/components/messages/reactionAdded"
...

it will fail because the parameters are going to be ignored.

Description

Glee should be able to handle the parameters.

If there is a location

parse the values from the message's payload or header and pass it to the operation function.
the new glee function type should be:

Attribute Description
payload The payload/body of the received event.
parameters The parameters of the channel's address.
headers The headers/metadata of the received event.
channel The name of the channel/topic from which the event was read.
serverName The name of the server/broker from which the event was received.

NOTE: glee should pick up the default value and use it if location is missing.

NOTE: if enum is specified, the parameter should be validated.

@KhudaDad414 KhudaDad414 added the enhancement New feature or request label Oct 20, 2023
@KhudaDad414 KhudaDad414 changed the title support address field in channel support address parameters in channel Oct 20, 2023
@KhudaDad414 KhudaDad414 changed the title support address parameters in channel support address parameters in channels Oct 20, 2023
@p21nc3
Copy link

p21nc3 commented Oct 23, 2023

Hi @KhudaDad414, this can be fixed by making changes to parse parameters, having a new function type with attributes (payload, parameters, header, channels, servername). additionally enum validation & default value handling. here introducing an function type may or may not have regression in the framework, will run some test to validate that.
I would like to work on it, requesting to assign this issue to me.

@KhudaDad414
Copy link
Member Author

@p21nc3 we do not assign issues. you can start working on it. if you need some help please let me know.

@KhudaDad414
Copy link
Member Author

@p21nc3 I have started working on the issue here: #551 please check it out and leave some feedback.

@KhudaDad414
Copy link
Member Author

/progress 60
partially implemented in #551

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.30.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants