Interface ValidationListener
-
public interface ValidationListener
Interface to capture which schemas are matching against a specific event in theValidatingVisitor
.All methods of this interface have a default empty implementation, so if an interface implementation is interested only about a few specific event types, there is no need to add empty overrides of the unhandles events.
-
-
Field Summary
Fields Modifier and Type Field Description static ValidationListener
NOOP
Default no-operation implementation
-
Method Summary
Modifier and Type Method Description default void
combinedSchemaMatch(CombinedSchemaMatchEvent event)
Called when aCombinedSchema
's given subschema matches the instance.default void
combinedSchemaMismatch(CombinedSchemaMismatchEvent event)
Called when aCombinedSchema
's given subschema does not match the instance.default void
elseSchemaMatch(ConditionalSchemaMatchEvent event)
Called when the instance passes the validation against a"else"
schema.default void
elseSchemaMismatch(ConditionalSchemaMismatchEvent event)
Called when the instance does not pass the validation against a"else"
schema.default void
ifSchemaMatch(ConditionalSchemaMatchEvent event)
Called when an"if"
schema matches.default void
ifSchemaMismatch(ConditionalSchemaMismatchEvent event)
Called when the instance does not pass the validation against an"if"
schema.default void
schemaReferenced(SchemaReferencedEvent event)
Called when a"$ref"
JSON reference is resolved.default void
thenSchemaMatch(ConditionalSchemaMatchEvent event)
Called when the instance passes the validation against a"then"
schema.default void
thenSchemaMismatch(ConditionalSchemaMismatchEvent event)
Called when the instance does not pass the validation against a"then"
schema.
-
-
-
Field Detail
-
NOOP
static final ValidationListener NOOP
Default no-operation implementation
-
-
Method Detail
-
combinedSchemaMatch
default void combinedSchemaMatch(CombinedSchemaMatchEvent event)
Called when aCombinedSchema
's given subschema matches the instance.The
CombinedSchema
(which means an"allOf"
or"anyOf"
or"oneOf"
schema) can be referenced by callingValidationEvent.getSchema()
and the matching subschema is returned byCombinedSchemaValidationEvent.getSubSchema()
.
-
combinedSchemaMismatch
default void combinedSchemaMismatch(CombinedSchemaMismatchEvent event)
Called when aCombinedSchema
's given subschema does not match the instance.The
CombinedSchema
(which means an"allOf"
or"anyOf"
or"oneOf"
schema) can be referenced by callingValidationEvent.getSchema()
and the matching subschema is returned byCombinedSchemaValidationEvent.getSubSchema()
. The validation failure of the subschema is returned byCombinedSchemaMismatchEvent.getFailure()
.Note: the invocation of this method by the validator does not necessarily mean that the validation against the
CombinedSchema
will fail. In the case of the"anyOf"
and"oneOf"
schemas it can be an intermediate failure while the root-level schema validation still passes.
-
schemaReferenced
default void schemaReferenced(SchemaReferencedEvent event)
Called when a"$ref"
JSON reference is resolved.The referred schema is returned by
SchemaReferencedEvent.getReferredSchema()
, and the"$ref"
itself is returned byValidationEvent.getSchema()
-
ifSchemaMatch
default void ifSchemaMatch(ConditionalSchemaMatchEvent event)
Called when an"if"
schema matches.The
ConditionalSchema
(holding both the"if"
,"then"
and"else"
schemas) is returned byValidationEvent.getSchema()
, andConditionalSchemaValidationEvent.getKeyword()
always returnsConditionalSchemaValidationEvent.Keyword.IF
in this method.Note: the invocation of this method does not necessarily mean that the validation of the
ConditionalSchema
will succeed. Instead it means that the evaluation continues with the"then"
schema.
-
ifSchemaMismatch
default void ifSchemaMismatch(ConditionalSchemaMismatchEvent event)
Called when the instance does not pass the validation against an"if"
schema.The
ConditionalSchema
(holding both the"if"
,"then"
and"else"
schemas) is returned byValidationEvent.getSchema()
, andConditionalSchemaValidationEvent.getKeyword()
always returnsConditionalSchemaValidationEvent.Keyword.IF
in this method.Note: the invocation of this method does not necessarily mean that the validation of the
ConditionalSchema
will fail. Instead it means that the evaluation continues with the"else"
schema.
-
thenSchemaMatch
default void thenSchemaMatch(ConditionalSchemaMatchEvent event)
Called when the instance passes the validation against a"then"
schema.The
ConditionalSchema
(holding both the"if"
,"then"
and"else"
schemas) is returned byValidationEvent.getSchema()
, andConditionalSchemaValidationEvent.getKeyword()
always returnsConditionalSchemaValidationEvent.Keyword.THEN
in this method.
-
thenSchemaMismatch
default void thenSchemaMismatch(ConditionalSchemaMismatchEvent event)
Called when the instance does not pass the validation against a"then"
schema.The
ConditionalSchema
(holding both the"if"
,"then"
and"else"
schemas) is returned byValidationEvent.getSchema()
, andConditionalSchemaValidationEvent.getKeyword()
always returnsConditionalSchemaValidationEvent.Keyword.THEN
in this method.
-
elseSchemaMatch
default void elseSchemaMatch(ConditionalSchemaMatchEvent event)
Called when the instance passes the validation against a"else"
schema.The
ConditionalSchema
(holding both the"if"
,"then"
and"else"
schemas) is returned byValidationEvent.getSchema()
, andConditionalSchemaValidationEvent.getKeyword()
always returnsConditionalSchemaValidationEvent.Keyword.ELSE
in this method.
-
elseSchemaMismatch
default void elseSchemaMismatch(ConditionalSchemaMismatchEvent event)
Called when the instance does not pass the validation against a"else"
schema.The
ConditionalSchema
(holding both the"if"
,"then"
and"else"
schemas) is returned byValidationEvent.getSchema()
, andConditionalSchemaValidationEvent.getKeyword()
always returnsConditionalSchemaValidationEvent.Keyword.ELSE
in this method.
-
-