Package io.restassured.module.jsv
Class JsonSchemaValidatorSettings
java.lang.Object
io.restassured.module.jsv.JsonSchemaValidatorSettings
Settings for the JsonSchemaValidator
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes JsonSchemaValidatorSettings with a defaultJsonSchemaFactory(generated byJsonSchemaFactory.byDefault()) and using checked validation and treating uri's and url's as Strings.JsonSchemaValidatorSettings(com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory) Initializes JsonSchemaValidatorSettings with a specificJsonSchemaFactory.JsonSchemaValidatorSettings(com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory, boolean checkedValidation) Initializes JsonSchemaValidatorSettings with a specificJsonSchemaFactoryand checked validation. -
Method Summary
Modifier and TypeMethodDescriptionand()Syntactic sugar.checkedValidation(boolean shouldUseCheckedValidation) Instruct the JsonSchemaValidator to use checked validation or not.com.github.fge.jsonschema.main.JsonSchemaFactoryjsonSchemaFactory(com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory) Set aJsonSchemaFactoryinstance that will be used when creating the validator.parseUriAndUrlsAsJsonNode(boolean parseUriAndUrlsAsJsonNode) Instruct the JsonSchemaValidator to parse URI's and URL's as JsonNode before they are passed to validation.static JsonSchemaValidatorSettingssettings()Create a new instance ofJsonSchemaValidatorSettings.booleanbooleanwith()Syntactic sugar.
-
Constructor Details
-
JsonSchemaValidatorSettings
public JsonSchemaValidatorSettings(com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory, boolean checkedValidation) Initializes JsonSchemaValidatorSettings with a specificJsonSchemaFactoryand checked validation. It will also use checked validation and treating uri's and url's as Strings. To change the latter refer toparseUriAndUrlsAsJsonNode(boolean). -
JsonSchemaValidatorSettings
public JsonSchemaValidatorSettings(com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory) Initializes JsonSchemaValidatorSettings with a specificJsonSchemaFactory. The settings will also use checked validation and treating uri's and url's as Strings. -
JsonSchemaValidatorSettings
public JsonSchemaValidatorSettings()Initializes JsonSchemaValidatorSettings with a defaultJsonSchemaFactory(generated byJsonSchemaFactory.byDefault()) and using checked validation and treating uri's and url's as Strings.
-
-
Method Details
-
jsonSchemaFactory
public com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory() -
shouldParseUriAndUrlsAsJsonNode
public boolean shouldParseUriAndUrlsAsJsonNode() -
shouldUseCheckedValidation
public boolean shouldUseCheckedValidation() -
checkedValidation
Instruct the JsonSchemaValidator to use checked validation or not.- Parameters:
shouldUseCheckedValidation-trueto use checked validation,falseotherwise.- Returns:
- A new instance of JsonSchemaValidatorSettings
-
parseUriAndUrlsAsJsonNode
Instruct the JsonSchemaValidator to parse URI's and URL's as JsonNode before they are passed to validation. IftruethenJsonSchemaValidator.matchesJsonSchema(url)handled like this:instanceSettings.jsonSchemaFactory().getJsonSchema(JsonLoader.fromURL(url))
IffalsethenJsonSchemaValidator.matchesJsonSchema(url)handled like this:instanceSettings.jsonSchemaFactory().getJsonSchema(url)
The latter is good for you need to resolve relative ref in a parent schema because the validator does not know what is the base URI of the parent schema if first having parsed it as a JsonNode.Default is
false.- Parameters:
parseUriAndUrlsAsJsonNode-trueto parse URI's and URL's asJsonNode's,falseotherwise.- Returns:
- A new instance of JsonSchemaValidatorSettings
-
jsonSchemaFactory
public JsonSchemaValidatorSettings jsonSchemaFactory(com.github.fge.jsonschema.main.JsonSchemaFactory jsonSchemaFactory) Set aJsonSchemaFactoryinstance that will be used when creating the validator.- Parameters:
jsonSchemaFactory- TheJsonSchemaFactoryinstance to use.- Returns:
- A new instance of JsonSchemaValidatorSettings
-
and
Syntactic sugar.- Returns:
- The same settings instance.
-
with
Syntactic sugar.- Returns:
- The same settings instance.
-
settings
Create a new instance ofJsonSchemaValidatorSettings. Same as callingJsonSchemaValidatorSettings().- Returns:
- A default instance of the
JsonSchemaValidatorSettings.
-