I'm working with Spring Boot and REST Assured to test REST APIs. I was trying the example with JSON schema validation but it throws this error:
java.lang.IllegalArgumentException: Schema to use cannot be null
According to documentation, the schema should be located in the classpath. My example schema is located there. Here is my project structure and example schema location:
Here is my code. Without schema validation it works fine.
given().
contentType("application/json").
when().
get("http://myExample/users").
then().
assertThat().body(matchesJsonSchemaInClasspath("example_schema.json"));