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

Binding interface does not support excess properties #735

Closed
oviecodes opened this issue Mar 24, 2023 · 11 comments
Closed

Binding interface does not support excess properties #735

oviecodes opened this issue Mar 24, 2023 · 11 comments
Labels
bug Something isn't working stale

Comments

@oviecodes
Copy link

oviecodes commented Mar 24, 2023

Describe the bug

The OldServer, ServerV2, and Server classes do not support excess properties on the Binding interface.

How to Reproduce

using "@asyncapi/parser": "^2.0.0-next-major.15"

import { OldAsyncAPIDocument, OldServer } from '@asyncapi/parser'

//inside an exported class
private _AsyncAPIServer: OldServer

get AsyncAPIServer(): OldServer {
    return this._AsyncAPIServer
}

//in another file with a class that extends the class above

const mqttServerBinding = this.AsyncAPIServer.binding('mqtt')
const mqtt5ServerBinding = this.AsyncAPIServer.binding('mqtt5')

const serverBinding = protocolVersion === 5 ? mqtt5ServerBinding : mqttServerBinding

mqtt.connect({
      ...
      clientId: serverBinding?.clientId ?? auth?.clientId,
      clean: serverBinding?.cleanSession,
      ...
})

An error is thrown that clientId does not exist on type Binding.

glee_error

The Binding interface
glee_binding

Expected behavior

The Binding interface should support excess properties possibly by using [propName: string]: any;

@oviecodes oviecodes added the bug Something isn't working label Mar 24, 2023
@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup 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.

@magicmatatjahu
Copy link
Member

@oviecodes Do you wanna add PR?

@oviecodes
Copy link
Author

Alright @magicmatatjahu , I'll do so

@oviecodes
Copy link
Author

oviecodes commented Apr 6, 2023

@magicmatatjahu I also noticed that the AsyncApiDocumentV2 interface doesn't have a couple of properties the old AsyncApiDocument has e.g serverNames(), channel(), channelNames() properties. Was this done on purpose?

@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This issue 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 issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue 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 issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Aug 5, 2023
@jonaslagoni
Copy link
Member

Cc @smoya can you remember whether this was addressed in one of the recent changes?

@github-actions github-actions bot removed the stale label Aug 6, 2023
@smoya
Copy link
Member

smoya commented Aug 7, 2023

Cc @smoya can you remember whether this was addressed in one of the recent changes?

No, you will still need to do something like (mqttServerBinding as any).clientId to fetch the value.

In the new API, this is solved by the binding.value() method signature: <V = T>(): V

@oviecodes are you ok creating the PR for this? I'm +1 to add the [propName: string]: any; to both v2 and v3 BindingInterface spec types.
cc @magicmatatjahu

@oviecodes
Copy link
Author

yeah @smoya , just waiting for @magicmatatjahu to respond then it's a go

@magicmatatjahu
Copy link
Member

Go with this.

@oviecodes
Copy link
Author

Alright, I'll create a PR

Copy link

github-actions bot commented Dec 7, 2023

This issue 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 issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue 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 issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Dec 7, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

4 participants