You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The io.swagger.v3.oas.annotations.Webhook has @Target({METHOD, ANNOTATION_TYPE})
/** * The annotation may be used to define a method as an OpenAPI Webhook. * * @see <a target="_new" href="https://github.com/OAI/OpenAPI-Specification/blob/3.1.1/versions/3.1.1.md#oas-webhooks">Webhook (OpenAPI specification)</a> * @see io.swagger.v3.oas.annotations.OpenAPIDefinition **/@Target({METHOD, ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited@OpenAPI31public @interface Webhook {
/** * Provides the name related to this webhook. * @return webhook name */Stringname();
/** * Provides the operation related to this webhook. * @return webhook operation */Operationoperation();
Which is a bit misleading because SpringDoc seems to be searching only for io.swagger.v3.oas.annotations.Webhooks on the class level and never tries to resolve annotations on the method level.
Try to use io.swagger.v3.oas.annotations.Webhook on the method level, as per its target .
Expected behavior
Either log a warning that the annotation should be on the class level or support them on the method level too.
Workaround
Use io.swagger.v3.oas.annotations.Webhooks on class level on any Spring Bean and add the webhooks as its child (nested) io.swagger.v3.oas.annotations.Webhook annotations.
The text was updated successfully, but these errors were encountered:
AlexanderBartash
changed the title
io.swagger.v3.oas.annotations.Webhook does not work when defined at method level
io.swagger.v3.oas.annotations.Webhook does not work when defined on method level
May 17, 2025
AlexanderBartash
changed the title
io.swagger.v3.oas.annotations.Webhook does not work when defined on method level
io.swagger.v3.oas.annotations.Webhook does not work when defined on the method level
May 17, 2025
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
The
io.swagger.v3.oas.annotations.Webhook
has@Target({METHOD, ANNOTATION_TYPE})
Which is a bit misleading because SpringDoc seems to be searching only for
io.swagger.v3.oas.annotations.Webhooks
on the class level and never tries to resolve annotations on the method level.springdoc-openapi/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/OpenAPIService.java
Line 542 in bce44db
springdoc-openapi/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java
Line 525 in bce44db
To Reproduce
Steps to reproduce the behavior:
io.swagger.v3.oas.annotations.Webhook
on the method level, as per its target .Expected behavior
Workaround
io.swagger.v3.oas.annotations.Webhooks
on class level on any Spring Bean and add the webhooks as its child (nested)io.swagger.v3.oas.annotations.Webhook
annotations.The text was updated successfully, but these errors were encountered: