subReport = new ListProcessingReport(report.getLogLevel(), LogLevel.FATAL); ptr = schemaPointer.append(JsonPointer.of(keyword, index)); newData = data.withSchema(tree.setPointer(ptr)); processor.process(subReport, newData); fullReport.put(ptr.toString(), subReport.asJson()); if (subReport.isSuccess()) nrSuccess++;
@Override public RetCode validateSchema(final SyntaxValidator validator, final String fileName, final JsonNode node) throws IOException { final ListProcessingReport report = (ListProcessingReport) validator.validateSchema(node); final boolean success = report.isSuccess(); System.out.println("--- BEGIN " + fileName + "---"); System.out.println("validation: " + (success ? "SUCCESS" : "FAILURE")); if (!success) System.out.println(JacksonUtils.prettyPrint(report.asJson())); System.out.println("--- END " + fileName + "---"); return success ? ALL_OK : SCHEMA_SYNTAX_ERROR; }
private static ProcessingReport buildReport(final ProcessingReport report, final ProcessingException e) { final ListProcessingReport ret = new ListProcessingReport(LogLevel.DEBUG, LogLevel.NONE); try { ret.fatal(e.getProcessingMessage() .put("info", BUNDLE.getMessage("processing.moreMessages"))); ret.mergeWith(report); } catch (ProcessingException ignored) { // can't happen } return ret; } }
/** * Validate a schema and return a report * * @param schema the schema * @return a report */ public ProcessingReport validateSchema(final JsonNode schema) { final ProcessingReport report = new ListProcessingReport(); return getResult(schema, report).getReport(); }
ListProcessingReport lp = new ListProcessingReport(); lp.mergeWith(report); java.util.Iterator<ProcessingMessage> it = lp.iterator(); while (it.hasNext()) { ProcessingMessage pm = it.next();
if ((processingReport != null) && !processingReport.isSuccess()) { return StreamSupport.stream(processingReport.spliterator(), false) .map(pm -> getProcessingMessage(pm, null, keyPrefix)) .reduce(ValidationReport.empty(), ValidationReport::merge);
logger.debug("report" + report); if(!report.isSuccess()) { JsonNode messages = ((ListProcessingReport) report).asJson(); sendErrorResponse(exchange, 400, messages.toString()); logger.error("Schema Validation Failed {}", json);
private static ProcessingReport buildReport(final ProcessingReport report, final ProcessingException e) { final ListProcessingReport ret = new ListProcessingReport(LogLevel.DEBUG, LogLevel.NONE); try { ret.fatal(e.getProcessingMessage() .put("info", BUNDLE.getMessage("processing.moreMessages"))); ret.mergeWith(report); } catch (ProcessingException ignored) { // can't happen } return ret; } }
@Override public void validate(final Processor<FullData, FullData> processor, final ProcessingReport report, final MessageBundle bundle, final FullData data) throws ProcessingException { final SchemaTree tree = data.getSchema(); final ProcessingReport subReport = new ListProcessingReport(report.getLogLevel(), LogLevel.FATAL); processor.process(subReport, data.withSchema(tree.append(PTR))); if (subReport.isSuccess()) report.error(newMsg(data, bundle, "err.draftv4.not.fail")); }
JsonSchema schema = factory.getJsonSchema(schemaObject); ProcessingReport report = schema.validate(spec); ListProcessingReport lp = new ListProcessingReport(); lp.mergeWith(report); java.util.Iterator<ProcessingMessage> it = lp.iterator(); while (it.hasNext()) { ProcessingMessage pm = it.next();
@Override public RetCode validateInstance(final JsonSchema schema, final String fileName, final JsonNode node) throws IOException, ProcessingException { final ListProcessingReport report = (ListProcessingReport) schema.validate(node, true); final boolean success = report.isSuccess(); System.out.println("--- BEGIN " + fileName + "---"); System.out.println("validation: " + (success ? "SUCCESS" : "FAILURE")); if (!success) System.out.println(JacksonUtils.prettyPrint(report .asJson())); System.out.println("--- END " + fileName + "---"); return success ? ALL_OK : VALIDATION_FAILURE; } },
subReport = new ListProcessingReport(report.getLogLevel(), LogLevel.FATAL); ptr = schemaPointer.append(JsonPointer.of(keyword, index)); newData = data.withSchema(tree.setPointer(ptr)); processor.process(subReport, newData); fullReport.put(ptr.toString(), subReport.asJson()); if (subReport.isSuccess()) nrSuccess++;
private static ProcessingReport buildReport(final ProcessingReport report, final ProcessingException e) { final ListProcessingReport ret = new ListProcessingReport(LogLevel.DEBUG, LogLevel.NONE); try { ret.fatal(e.getProcessingMessage() .put("info", BUNDLE.getMessage("processing.moreMessages"))); ret.mergeWith(report); } catch (ProcessingException ignored) { // can't happen } return ret; } }
@Override public ValidatorList process(final ProcessingReport report, final SchemaContext input) throws ProcessingException { final ValueHolder<SchemaTree> in = ValueHolder.hold("schema", input.getSchema()); /* * We have to go through an intermediate report. If we re-enter this * function with a report already telling there is an error, we don't * want to wrongly report that the schema is invalid. */ final ProcessingReport r = new ListProcessingReport(report); final ValueHolder<SchemaTree> out = resolver.process(r, in); report.mergeWith(r); if (!r.isSuccess()) return null; final SchemaContext output = new SchemaContext(out.getValue(), input.getInstanceType()); return builder.process(report, output); }
subReport = new ListProcessingReport(report.getLogLevel(), LogLevel.FATAL); ptr = schemaPointer.append(JsonPointer.of(keyword, index)); newData = data.withSchema(tree.setPointer(ptr)); processor.process(subReport, newData); fullReport.put(ptr.toString(), subReport.asJson()); if (subReport.isSuccess()) nrSuccess++;
@Override public ProcessingReport newReport() { return new ListProcessingReport(logLevel, exceptionThreshold); }
subReport = new ListProcessingReport(report.getLogLevel(), LogLevel.FATAL); ptr = schemaPointer.append(JsonPointer.of(keyword, index)); newData = data.withSchema(tree.setPointer(ptr)); processor.process(subReport, newData); fullReport.put(ptr.toString(), subReport.asJson()); if (subReport.isSuccess()) nrSuccess++;
@Override public ProcessingReport newReport(final LogLevel logLevel) { return new ListProcessingReport(logLevel); }