Class SchemaValidator
- java.lang.Object
-
- com.networknt.aws.lambda.handler.middleware.validator.SchemaValidator
-
public class SchemaValidator extends Object
Validate a value against the schema defined in an OpenAPI specification.Supports validation of properties and request/response bodies, and supports schema references.
- Author:
- Steve Hu
-
-
Constructor Summary
Constructors Constructor Description SchemaValidator()Build a new validator with no API specification.SchemaValidator(com.networknt.oas.model.OpenApi3 api)Build a new validator for the given API specification.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.networknt.status.Statusvalidate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema)com.networknt.status.Statusvalidate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema, com.networknt.schema.JsonNodePath instanceLocation)com.networknt.status.Statusvalidate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema, com.networknt.schema.SchemaValidatorsConfig config)Validate the given value against the given property schema.com.networknt.status.Statusvalidate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema, com.networknt.schema.SchemaValidatorsConfig config, com.networknt.schema.JsonNodePath instanceLocation)Validate the given value against the given property schema.
-
-
-
Constructor Detail
-
SchemaValidator
public SchemaValidator()
Build a new validator with no API specification.This will not perform any validation of $ref references that reference local schemas.
-
SchemaValidator
public SchemaValidator(com.networknt.oas.model.OpenApi3 api)
Build a new validator for the given API specification.- Parameters:
api- The API to build the validator for. If provided, is used to retrieve schemas in components for use in references.
-
-
Method Detail
-
validate
public com.networknt.status.Status validate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema, com.networknt.schema.SchemaValidatorsConfig config)Validate the given value against the given property schema.- Parameters:
value- The value to validateschema- The property schema to validate the value againstconfig- The config model for some validator- Returns:
- A status containing error code and description
-
validate
public com.networknt.status.Status validate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema, com.networknt.schema.SchemaValidatorsConfig config, com.networknt.schema.JsonNodePath instanceLocation)Validate the given value against the given property schema.- Parameters:
value- The value to validateschema- The property schema to validate the value againstconfig- The config model for some validatorinstanceLocation- The JsonNodePath being validated- Returns:
- Status object
-
validate
public com.networknt.status.Status validate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema)
-
validate
public com.networknt.status.Status validate(com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode schema, com.networknt.schema.JsonNodePath instanceLocation)
-
-