io.vertx.json.schema

## Interface Validator

-     public interface Validator

  A validator, validates some input object using a well known schema.
  Author:
    Paulo Lopes

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Validator` | `create(JsonSchema schema, JsonSchemaOptions options)` Creates a new validator with some initial schema and options.
    `static Validator` | `create(JsonSchema schema, JsonSchemaOptions options, JsonFormatValidator jsonFormatValidator)` Creates a new validator with some initial schema, options and a custom JSON format validator.
    `OutputUnit` | `validate(Object instance)` Validate a given input against the initial schema.

- - ### Method Detail

    - #### create

          static Validator create(JsonSchema schema,
                                  JsonSchemaOptions options)

      Creates a new validator with some initial schema and options.

      When validation is to be reused, it is recommended to create a `SchemaRepository` instance and use the `SchemaRepository.validator(String)`} method. The use of a `String` key allows avoiding re-parsing and fast lookups.

      Parameters:
        `schema` - the initial schema
        `options` - the validator options
      Returns:
        a validator instance

    - #### create

          static Validator create(JsonSchema schema,
                                  JsonSchemaOptions options,
                                  JsonFormatValidator jsonFormatValidator)

      Creates a new validator with some initial schema, options and a custom JSON format validator. When validation is to be reused, it is recommended to create a `SchemaRepository` instance and use the `SchemaRepository.validator(String)`} method. The use of a `String` key allows avoiding re-parsing and fast lookups.
      Parameters:
        `schema` - the initial schema
        `options` - the validator options
        `jsonFormatValidator` - the custom JSON format validator
      Returns:
        a validator instance

    - #### validate

          OutputUnit validate(Object instance)
                       throws SchemaException

      Validate a given input against the initial schema.
      Parameters:
        `instance` - instance to validate
      Returns:
        returns a output unit object as defined by the options
      Throws:
        `SchemaException` - if the validation cannot complete, for example when a reference is missing.

Copyright © 2024 Eclipse. All rights reserved.