Skip to content

Refactor webhook discovery and scanning mechanism #3057

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 1 commit into from
Aug 18, 2025

Conversation

zdary
Copy link
Contributor

@zdary zdary commented Aug 12, 2025

Implement package-based filtering for webhooks
This commit introduces support for filtering webhooks based on the springdoc.packages-to-scan and springdoc.packages-to-exclude properties. This provides users with more granular control over which webhooks are included in the generated OpenAPI specification, aligning their behavior with that of controllers.

To verify and illustrate this new functionality, a new application test (SpringDocApp246Test) has been added. This test:
•Defines webhook components in two separate packages.
•Configures one package to be included and the other to be excluded.
•Asserts that the final OpenAPI document correctly contains only the webhooks from the scanned package.

Additionally, a new abstract base class, AbstractSpringDocV31Test, has been created to streamline the setup for OpenAPI 3.1 integration tests.

Fixes #3056

@Mattias-Sehlstedt
Copy link
Contributor

Hi @zdary

I would suggested adding an application test to further illustrate the changed behavior. So something similar to this test, but that it explicitly covers how the new filtering works (the test produces and exposes a specification for the code, and the expected specification is then located in resources/results).

I am not affiliate with this project in any way, so only a suggestion rather than a review.

This commit introduces support for filtering webhooks based on the `springdoc.packages-to-scan` and `springdoc.packages-to-exclude` properties. This provides users with more granular control over which webhooks are included in the generated OpenAPI specification, aligning their behavior with that of controllers.

To verify and illustrate this new functionality, a new application test (`SpringDocApp246Test`) has been added. This test:
•Defines webhook components in two separate packages.
•Configures one package to be included and the other to be excluded.
•Asserts that the final OpenAPI document correctly contains only the webhooks from the scanned package.

Additionally, a new abstract base class, `AbstractSpringDocV31Test`, has been created to streamline the setup for OpenAPI 3.1 integration tests.

Fixes springdoc#3056
@zdary
Copy link
Contributor Author

zdary commented Aug 13, 2025

Hi @zdary

I would suggested adding an application test to further illustrate the changed behavior. So something similar to this test, but that it explicitly covers how the new filtering works (the test produces and exposes a specification for the code, and the expected specification is then located in resources/results).

I am not affiliate with this project in any way, so only a suggestion rather than a review.

good point, I have added the tests to cover the filtering. thank you

@bnasslahsen bnasslahsen merged commit da34e96 into springdoc:main Aug 18, 2025
1 check 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.

Customizer for @Webhooks
4 participants