10000 feat: raise exception at wrong router including by bshelkhonov · Pull Request #2172 · ag2ai/faststream · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: raise exception at wrong router including #2172

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

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

bshelkhonov
Copy link
Contributor

Description

Now method include_router raises SetupError for if wrong router is provided .

Fixes #2164

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
  • I have included code examples to illustrate the modifications

@CLAassistant
Copy link
CLAassistant commented Apr 9, 2025

CLA assistant check
All committers have signed the CLA.

@bshelkhonov
Copy link
Contributor Author

@Lancetnik what do you think about annotating router argument like in NatsRegistrator instead of using ABCBroker? NatsRegistrator has already had such annotation.

def include_router(  # type: ignore[override]
        self,
        router: "NatsRegistrator",
        *,
        prefix: str = "",
        dependencies: Iterable["Depends"] = (),
        middlewares: Iterable["BrokerMiddleware[Msg]"] = (),
        include_in_schema: Optional[bool] = None,
) -> None:

@Lancetnik
Copy link
Collaborator

@Lancetnik what do you think about annotating router argument like in NatsRegistrator instead of using ABCBroker? NatsRegistrator has already had such annotation.

def include_router(  # type: ignore[override]
        self,
        router: "NatsRegistrator",
        *,
        prefix: str = "",
        dependencies: Iterable["Depends"] = (),
        middlewares: Iterable["BrokerMiddleware[Msg]"] = (),
        include_in_schema: Optional[bool] = None,
) -> None:

I think, it's a good idea. But, we should validate it in code anyway

8000

@Lancetnik
Copy link
Collaborator

Thank you for your work!

@Lancetnik Lancetnik added this pull request to the merge queue Apr 9, 2025
Merged via the queue into ag2ai:main with commit cf04446 Apr 9, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: raise an exception at wrong router including
3 participants
0