Class ValidationMessageAdapter

java.lang.Object
io.micronaut.jsonschema.validation.ValidationMessageAdapter
All Implemented Interfaces:
ValidationMessage
Direct Known Subclasses:
NetworkNtValidationMessage

@Internal public class ValidationMessageAdapter extends Object implements ValidationMessage
The ValidationMessage implementation of the JsonSchemaValidator implementations. It carries the details of an error: the messages of the NetworkNT based validator are a subclass that also gives access to the NetworkNT error (NetworkNtValidationMessage, in micronaut-json-schema-validator-networknt). Prior to 2.3.2 this type wrapped the NetworkNT com.networknt.schema.Error.
Since:
1.0.0
Author:
Sergio del Amo
  • Constructor Details

    • ValidationMessageAdapter

      public ValidationMessageAdapter(String instanceLocation, String keyword, String schemaLocation, String detail)
      Creates a validation message.
      Parameters:
      instanceLocation - The JSON Pointer of the invalid instance location
      keyword - The keyword that failed
      schemaLocation - The absolute location of the keyword in the schema
      detail - The message, without the instance location
      Since:
      2.3.2
  • Method Details

    • getMessage

      public String getMessage()
      Description copied from interface: ValidationMessage
      Returns the validation message.
      Specified by:
      getMessage in interface ValidationMessage
      Returns:
      JSON Schema Validation Message, prefixed with the JSON Pointer of the invalid instance location
    • getInstanceLocation

      public String getInstanceLocation()
      Description copied from interface: ValidationMessage
      Returns the location of the invalid value.
      Specified by:
      getInstanceLocation in interface ValidationMessage
      Returns:
      The JSON Pointer (RFC 6901) of the instance location that failed validation, empty for the root
    • getKeyword

      public String getKeyword()
      Description copied from interface: ValidationMessage
      Returns the keyword that failed.
      Specified by:
      getKeyword in interface ValidationMessage
      Returns:
      The JSON Schema keyword that failed validation, if known
    • getSchemaLocation

      public String getSchemaLocation()
      Description copied from interface: ValidationMessage
      Returns the location of the failing keyword in the schema.
      Specified by:
      getSchemaLocation in interface ValidationMessage
      Returns:
      The location of the failing keyword within the schema (the base URI of the schema plus a JSON Pointer fragment), if known. It is absolute when the schema has an absolute base URI
    • getDetail

      public String getDetail()
      Returns the message without the instance location.
      Returns:
      The message without the instance location prefix
      Since:
      2.3.2
    • toString

      public String toString()
      Overrides:
      toString in class Object