@Override public ValidationResult validate(String subject, String uri, ValidationContext context) { Configuration conf = getConfiguration(context.getProperty(CONF_XML_FILES).getValue()); String inputUri = context.getProperty(INPUT_SCHEMA).getValue(); String error = null; final boolean elPresent = context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(uri); if (!elPresent) { try { Schema outputSchema = getSchema(uri, conf); Schema inputSchema = getSchema(inputUri, conf); // Get the explicitly mapped fields. This is identical to // logic in onTrigger, but ValidationContext and // ProcessContext share no ancestor, so we cannot generalize // the code. Map<String, String> fieldMapping = new HashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { if (entry.getKey().isDynamic()) { fieldMapping.put(entry.getKey().getName(), entry.getValue()); } } AvroRecordConverter converter = new AvroRecordConverter(inputSchema, outputSchema, fieldMapping); Collection<String> unmappedFields = converter.getUnmappedFields(); if (unmappedFields.size() > 0) { error = "The following fields are unmapped: " + unmappedFields; } } catch (SchemaNotFoundException e) { error = e.getMessage(); } } return new ValidationResult.Builder() .subject(subject) .input(uri) .explanation(error) .valid(error == null) .build(); }