Updating com.atlassian.oai.validator.springmvc.OpenApiValidationInterceptor in the latest releases?

Issue #405 duplicate
Madhur.Jolly@bglgroup.co.uk created an issue

Hi,

With Spring 6 HandlerInterceptorAdapter (deprecated class in Spring 5) which OpenApiValidationInterceptor extends is no longer available. Is there any plan to replace HandlerInterceptorAdapter so that OpenApiValidationInterceptor is available to use with Spring 6?

Comments (7)

  1. Sven Döring

    That upgrade has already been covered.

    You may want to change the artifactId of your dependency from swagger-request-validator-springmvc to swagger-request-validator-spring-webmvc - version >= 2.33.1.

    swagger-request-validator-springmvc is still used for Spring 5 applications.
    swagger-request-validator-spring-webmvc is used for Spring 6 applications.

    Because of the breaking changes with that upgrade and Spring 5 very much alive and kicking we decided to add a new artifact.

  2. Martin Dietze

    I believe that this issue is closely related to #404. The removal of HandlerInterceptorAdapter is only one of the dealbreakers introduced with Spring 6.

    While you can work around the issue by adding your own HandlerInterceptorAdapter like this:

    package org.springframework.web.servlet.handler;
    import org.springframework.web.servlet.HandlerInterceptor;
    public abstract class HandlerInterceptorAdapter implements HandlerInterceptor {}
    

    … you would be able to compile code using it, however, if you - like probably most others - are using Spring 6 in combination with SpringBoot 3, you’d run straight into a problem caused by the namespace change for servlet APIs like e.g. HttpServletRequest.

    It looks like anyone trying to upgrade to Spring6/SpringBoot3 will for now be simply unable to use the swagger-request-validator until #404 has been fixed.

    Since there isn’t really any alternative to this (excellent, by the way, and thank you very much!) library, we’re pretty much facing a blocker keeping us from using the latest stable Spring/SpringBoot versions in new projects.

  3. Sven Döring

    This issue is very closely related to #399, because it’s a duplicate.

    It has been already covered and merged. Simply replace this old swagger-request-validator-springmvc dependency with the new swagger-request-validator-spring-webmvc dependency and you are good to go.

    Issue #404, actually, simply uses a method, that has been removed in Spring Boot 3. It’s one of the rare cases where the Jakarta namespace change is not the problem. 😁

  4. Martin Dietze

    Meaning that after #404 has been fixed and merged, the library will be usable with Spring6/SpringBoot3? That would be extremely good news as I am currently in the process of fixing issues related to that upgrade, and this here is currently one of the things I cannot easily fix myself ;)

  5. Sven Döring

    Meaning that it already works with the latest version. #399 is done. Simply use swagger-request-validator-spring-webmvc instead of swagger-request-validator-springmvc.

    This issue can be closed as duplicate.

  6. Log in to comment