Skip to content
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

use it to validate real requests? #43

Open
nidi3 opened this issue Aug 5, 2015 · 3 comments
Open

use it to validate real requests? #43

nidi3 opened this issue Aug 5, 2015 · 3 comments

Comments

@nidi3
Copy link
Owner

nidi3 commented Aug 5, 2015

No description provided.

@ddidier
Copy link

ddidier commented Nov 27, 2015

Is this to say that it cannot validate real request? Because I tried and I cannot make it work (with JAX-RS). I just cannot figure out how to do it. What is assumingBaseUri for?

@nidi3
Copy link
Owner Author

nidi3 commented Nov 27, 2015

With "real" I mean requests during the productive runtime of an application, not in tests.
This issue is about special support/documentation for this, there's no reason it shouldn't work right now.

There are probably more JAX-RS specific possibilities, but the simplest thing that should work would be a ServletFilter along these lines:

public class RamlFilter implements Filter {
    private RamlDefinition api;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        api = RamlLoaders.fromClasspath(getClass()).load("api.raml");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                         throws IOException, ServletException {
        final RamlReport report = api.testAgainst(request, response, chain);
        //do something with the report
    }

}

@nidi3
Copy link
Owner Author

nidi3 commented Nov 27, 2015

Or you could use https://github.com/nidi3/raml-tester-proxy. It's a proxy that sits between the client and the server and logs all requests that are not conforming to the RAML.

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

No branches or pull requests

2 participants