org.infinispan.schematic

## Interface SchemaLibrary

- All Superinterfaces:
    DocumentLibrary
  All Known Implementing Classes:
    InMemorySchemaLibrary

      public interface SchemaLibrary
      extends DocumentLibrary

  A library of JSON Schema documents. Because JSON Schemas are in fact JSON documents, this library is also a DocumentLibrary.
  Since:
    5.1

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `SchemaLibrary.MismatchedTypeProblem` A special type of problem where a field value was not of the expected type, but where the field value could be converted to the expected type
    `static interface` | `SchemaLibrary.Problem`
    `static class` | `SchemaLibrary.ProblemType`
    `static interface` | `SchemaLibrary.Results` The results from a `validation`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Document` | `convertValues(Document document, SchemaLibrary.Results results)` Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.
    `Document` | `convertValues(Document document, String schemaUri)` Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.
    `SchemaLibrary.Results` | `validate(Document document, String schemaUri)` Validate the supplied document against the JSON Schema with the supplied URI.

    - ### Methods inherited from interface org.infinispan.schematic.DocumentLibrary

      `get, getName, put, putIfAbsent, remove, replace`

- - ### Method Detail

    - #### validate

          SchemaLibrary.Results validate(Document document,
                                       String schemaUri)

      Validate the supplied document against the JSON Schema with the supplied URI.
      Parameters:
        `document` - the document to be validated; may not be null
        `schemaUri` - the URI of the JSON Schema that should be used to validate the document; may not be null
      Returns:
        the results of the validation; never null

    - #### convertValues

          Document convertValues(Document document,
                               SchemaLibrary.Results results)

      Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.

      This is often useful when the results from `validate(Document, String)` contain only `mismatched type errors`. In such a case, the document can be converted and the resulting document will likely satisfy the schema.

      Parameters:
        `document` - the document to be validated; may not be null
        `results` - the results from the `validate(Document, String)` call; may not be null
      Returns:
        the converted document, or the same input `document` if the

    - #### convertValues

          Document convertValues(Document document,
                               String schemaUri)

      Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.

      This method is similar to `convertValues(Document, Results)`, except that this method automatically runs a JSON Schema validation to obtain the results. If you've already `validated` the document, then instead of calling this method (which would validate a second time) try calling `convertValues(Document, Results)`.

      Parameters:
        `document` - the document to be validated; may not be null
        `schemaUri` - the URI of the JSON Schema that should be used to validate the document; may not be null
      Returns:
        the converted document, or the same input `document` if the

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.