How to write ResetableResponseServletWrapper to validate response .

Issue #108 resolved
Former user created an issue

Hi ,

I wasn't validate response like , so I want to extract the actual response so that I can pass this value to swagger api to validate this response.I want to implement class like ResettableRequestServletWrapper to extract response body.

Can you please post some sample? I have tried but it is not working.

Thanks in advance.

Comments (10)

  1. James Navin

    Hi,

    I haven't looked too deeply at the Spring MVC stuff, but I would probably start by looking into using a HandlerInterceptor and implementing the postHandle method to validate the HTTP response (similar to what the com.atlassian.oai.validator.springmvc.SwaggerValidationInterceptor does for the request).

    There are examples on how the interceptor is wired up in https://bitbucket.org/atlassian/swagger-request-validator/src/master/swagger-request-validator-springmvc/src/test/java/com/atlassian/oai/validator/springmvc/example/

    Hope that helps.

  2. harinath batarayappa

    Thanks for your reply,James. Do you have any idea like when issue#58 fix will be implemented to validate response as well? Thanks in Advance.

  3. James Navin

    I dont have any plans to address it any time soon unfortunately.

    If you wanted to do an implementation and raise a PR I'd happily review it. Otherwise if you comment on the ticket what your use case is and vote for it it will help me triage where I spend effort in the future.

    Cheers.

  4. harinath batarayappa

    Thanks for your reply.I want to implement response validation along with request validation. ResetableRequestServletWrapper class already provided swagger api. i'm looking ResetableResponseServletWrapper so that i can pass in Filter class like this.

    filterChain.doFilter(resetableRequestServletWrapper, resetableResponseServletWrapper) Im using ContentCachingResponseWrapper but validation error response is not sent to swagger Ui.

  5. harinath batarayappa

    GM malinink, Above temporary response validation implementation is committed along with any of the recent PRs? so that i can download latest jars and test it.

  6. Sven Döring

    Hi.

    I'm the contributor of the Spring MVC adapter. Perhaps I should address #58 soon and contribute a solution for the SRV.

    @jfnavin If someone has issues with the Spring MVC adapter you can address me.

    Kind regards Sven

  7. Log in to comment