RestAssured with OpenApiValidationFilter (Swagger Request Validator) combining multiple swagger json specifications

Viewed 27

I'm using OpenApiValidationFilter with RestAssured to create a filter based on a swagger.json specification with the libraries Swagger Request Validator Core and Swagger Request Validator RestAssured

The swagger setup has multiple definitions, where a lot of endpoints are the same (only difference is /public changing to /private). I can only get one swagger.json for every definition, so when I generate my filter I also only get to use one of them.

Is there some way to combine multiple swagger json specifications in one big filter that is gonna work for all the endpoints?

I know I could create multiple filters and a method that return the correct filter based on the url, but I'm hoping for a simpler solution.

String swaggerJsonUrl1 = "foo.com/abcdef/swagger.json";
String swaggerJsonUrl2 = "foo.com/ghijkl/swagger.json";

OpenApiValidationFilter swaggerFilter1 = new OpenApiValidationFilter(swaggerJsonUrl1);
OpenApiValidationFilter swaggerFilter2 = new OpenApiValidationFilter(swaggerJsonUrl2);

// here I want to combine the two filters into one, 
// or maybe I can add the second url to the first filter somehow
0 Answers
Related