ValidateJson

Description:

Validates the contents of FlowFiles against a configurable JSON Schema. See json-schema.org for specification standards. This Processor does not support input containing multiple JSON objects, such as newline-delimited JSON. If the input FlowFile contains newline-delimited JSON, only the first line will be validated.

Tags:

JSON, schema, validation

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Schema Access StrategySchema Access StrategyJSON Schema Property
  • Schema Name Property The name of the Schema to use is specified by the 'Schema Name' Property. The value of this property is used to lookup the Schema in the configured JSON Schema Registry Service.
  • JSON Schema Property A URL or file path to the JSON schema or the actual JSON schema is specified by the 'JSON Schema' Property. No matter how the JSON schema is specified, it must be a valid JSON schema
Specifies how to obtain the schema that is to be used for interpreting the data.
Schema NameSchema Name${schema.name}Specifies the name of the schema to lookup in the Schema Registry property
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)

This Property is only considered if the [Schema Access Strategy] Property has a value of "Schema Name Property".
JSON Schema RegistryJSON Schema RegistryController Service API:
JsonSchemaRegistry
Implementation: StandardJsonSchemaRegistry
Specifies the Controller Service to use for the JSON Schema Registry

This Property is only considered if the [Schema Access Strategy] Property has a value of "Schema Name Property".
JSON SchemaJSON SchemaA URL or file path to the JSON schema or the actual JSON schema content

This property requires exactly one resource to be provided. That resource may be any of the following types: URL, file, text.


This Property is only considered if the [Schema Access Strategy] Property has a value of "JSON Schema Property".
JSON Schema VersionJSON Schema VersionDraft 2020-12
  • Draft 4 Draft Version 4
  • Draft 6 Draft Version 6
  • Draft 7 Draft Version 7
  • Draft 2019-09 Draft Version 2019-09
  • Draft 2020-12 Draft Version 2020-12
The JSON schema specification

This Property is only considered if the [Schema Access Strategy] Property has a value of "JSON Schema Property".

Relationships:

NameDescription
validFlowFiles that are successfully validated against the schema are routed to this relationship
invalidFlowFiles that are not valid according to the specified schema are routed to this relationship
failureFlowFiles that cannot be read as JSON are routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
json.validation.errorsIf the flow file is routed to the invalid relationship , this attribute will contain the error message resulting from the validation failure.

State management:

This component does not store state.

Restricted:

Required PermissionExplanation
reference remote resourcesSchema configuration can reference resources over HTTP

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

ResourceDescription
MEMORYValidating JSON requires reading FlowFile content into memory