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

Bug: ConfluentConfig TypeDict uses Enums instead of enum values #1759

Closed
yann-combarnous opened this issue Sep 4, 2024 · 0 comments · Fixed by #1762
Closed

Bug: ConfluentConfig TypeDict uses Enums instead of enum values #1759

yann-combarnous opened this issue Sep 4, 2024 · 0 comments · Fixed by #1762
Labels
bug Something isn't working Confluent Issues related to `faststream.confluent` module

Comments

@yann-combarnous
Copy link

yann-combarnous commented Sep 4, 2024

Describe the bug
When we create a ConfluentConfig dictionnary and connect to Kafka, the following config works, but generates a type error in Pylance/Pyright:

config: ConfluentConfig = {
    "security.protocol": "sasl_ssl",
    "sasl.oauthbearer.method": "oidc",
    "debug": "msg",
     ...
}

When we correct the type error by using the enums for these properties, then connecting to Kafka fails, as the code does not expect enums but Literal

from faststream.confluent.config import ConfluentConfig, SASLOAUTHBearerMethod, SecurityProtocol, Debug
...

config: ConfluentConfig = {
    "security.protocol": SecurityProtocol.sasl_ssl,
    "sasl.oauthbearer.method": SASLOAUTHBearerMethod.oidc,
    "debug": Debug.msg,
     ...
}

How to reproduce
Include source code:

See above

Environment
Running FastStream 0.5.20 with CPython 3.12.4 on Darwin

@yann-combarnous yann-combarnous added the bug Something isn't working label Sep 4, 2024
@kumaranvpl kumaranvpl added the Confluent Issues related to `faststream.confluent` module label Sep 5, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 5, 2024
* docs: remove confusing reply_to result

* fix (#1759): cast Enums to str in ConfluentConfig

* tests: add check for enum->str confluent config

* lint: fix typo

* docs: generate API References

---------

Co-authored-by: Lancetnik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Confluent Issues related to `faststream.confluent` module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants