ValidateRecord

Description:

Validates the Records of an incoming FlowFile against a given schema. All records that adhere to the schema are routed to the "valid" relationship while records that do not adhere to the schema are routed to the "invalid" relationship. It is therefore possible for a single incoming FlowFile to be split into two individual FlowFiles if some records are valid according to the schema and others are not. Any FlowFile that is routed to the "invalid" relationship will emit a ROUTE Provenance Event with the Details field populated to explain why records were invalid. In addition, to gain further explanation of why records were invalid, DEBUG-level logging can be enabled for the "org.apache.nifi.processors.standard.ValidateRecord" logger.

Tags:

record, schema, validate

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.

NameDefault ValueAllowable ValuesDescription
Record ReaderController Service API:
RecordReaderFactory
Implementations: Syslog5424Reader
AvroReader
JsonPathReader
ScriptedReader
XMLReader
GrokReader
JsonTreeReader
SyslogReader
CSVReader
Specifies the Controller Service to use for reading incoming data
Record WriterController Service API:
RecordSetWriterFactory
Implementations: ScriptedRecordSetWriter
JsonRecordSetWriter
CSVRecordSetWriter
AvroRecordSetWriter
XMLRecordSetWriter
FreeFormTextRecordSetWriter
Specifies the Controller Service to use for writing out the records
Record Writer for Invalid RecordsController Service API:
RecordSetWriterFactory
Implementations: ScriptedRecordSetWriter
JsonRecordSetWriter
CSVRecordSetWriter
AvroRecordSetWriter
XMLRecordSetWriter
FreeFormTextRecordSetWriter
If specified, this Controller Service will be used to write out any records that are invalid. If not specified, the writer specified by the "Record Writer" property will be used. This is useful, for example, when the configured Record Writer cannot write data that does not adhere to its schema (as is the case with Avro) or when it is desirable to keep invalid records in their original format while converting valid records to another format.
Schema Access Strategyreader-schema
  • Use Reader's Schema The schema to validate the data against is determined by asking the configured Record Reader for its schema
  • Use Schema Name Property The schema to validate the data against is determined by looking at the 'Schema Name' Property and looking up the schema in the configured Schema Registry
  • Use Schema Text Property The schema to validate the data against is determined by looking at the 'Schema Text' Property and parsing the schema as an Avro schema
Specifies how to obtain the schema that should be used to validate records
Schema RegistryController Service API:
SchemaRegistry
Implementations: ConfluentSchemaRegistry
HortonworksSchemaRegistry
AvroSchemaRegistry
Specifies the Controller Service to use for the Schema Registry. This is necessary only if the Schema Access Strategy is set to "Use 'Schema Name' Property".
Schema 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)
Schema Text${avro.schema}The text of an Avro-formatted Schema
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Allow Extra Fieldstrue
  • true
  • false
If the incoming data has fields that are not present in the schema, this property determines whether or not the Record is valid. If true, the Record is still valid. If false, the Record will be invalid due to the extra fields.
Strict Type Checkingtrue
  • true
  • false
If the incoming data has a Record where a field is not of the correct type, this property determine whether how to handle the Record. If true, the Record will still be considered invalid. If false, the Record will be considered valid and the field will be coerced into the correct type (if possible, according to the type coercion supported by the Record Writer).

Relationships:

NameDescription
validRecords that are valid according to the schema will be routed to this relationship
invalidRecords that are not valid according to the schema will be routed to this relationship
failureIf the records cannot be read, validated, or written, for any reason, the original FlowFile will be routed to this relationship

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
mime.typeSets the mime.type attribute to the MIME Type specified by the Record Writer
record.countThe number of records in the FlowFile routed to a relationship

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.