com.github.fge.jsonschema.core.report.ListProcessingReport Java Examples
The following examples show how to use
com.github.fge.jsonschema.core.report.ListProcessingReport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JJSchemaProcessing.java From json-schema-validator-demo with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected JsonNode buildResult(final String input) throws IOException { final ValueHolder<String> holder = ValueHolder.hold("source", input); final ProcessingReport report = new ListProcessingReport(); final ProcessingResult<ValueHolder<SchemaTree>> result = ProcessingResult.uncheckedResult(PROCESSOR, report, holder); final ProcessingReport processingReport = result.getReport(); final ObjectNode ret = FACTORY.objectNode(); final boolean success = processingReport.isSuccess(); ret.put(VALID, success); final JsonNode content = success ? result.getResult().getValue().getBaseNode() : buildReport(result.getReport()); ret.put(RESULTS, JacksonUtils.prettyPrint(content)); return ret; }
Example #2
Source File: JsonPatch.java From json-schema-validator-demo with GNU Lesser General Public License v3.0 | 5 votes |
private static JsonNode buildResult(final String rawPatch, final String rawData) throws IOException { final ObjectNode ret = JsonNodeFactory.instance.objectNode(); final boolean invalidSchema = fillWithData(ret, INPUT, INVALID_INPUT, rawPatch); final boolean invalidData = fillWithData(ret, INPUT2, INVALID_INPUT2, rawData); final JsonNode patchNode = ret.remove(INPUT); final JsonNode data = ret.remove(INPUT2); if (invalidSchema || invalidData) return ret; final JsonPatchInput input = new JsonPatchInput(patchNode, data); final ProcessingReport report = new ListProcessingReport(); final ProcessingResult<ValueHolder<JsonNode>> result = ProcessingResult.uncheckedResult(PROCESSOR, report, input); final boolean success = result.isSuccess(); ret.put(VALID, success); final JsonNode node = result.isSuccess() ? result.getResult() .getValue() : buildReport(result.getReport()); ret.put(RESULTS, JacksonUtils.prettyPrint(node)); return ret; }
Example #3
Source File: AvroProcessing.java From json-schema-validator-demo with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected JsonNode buildResult(final String input) throws IOException, ProcessingException { final ObjectNode ret = FACTORY.objectNode(); final boolean invalidSchema = fillWithData(ret, INPUT, INVALID_INPUT, input); final JsonNode schemaNode = ret.remove(INPUT); if (invalidSchema) return ret; final JsonTree tree = new SimpleJsonTree(schemaNode); final ValueHolder<JsonTree> holder = ValueHolder.hold(tree); final ProcessingReport report = new ListProcessingReport(); final ProcessingResult<ValueHolder<SchemaTree>> result = ProcessingResult.uncheckedResult(PROCESSOR, report, holder); final boolean success = result.isSuccess(); final JsonNode content = success ? result.getResult().getValue().getBaseNode() : buildReport(result.getReport()); ret.put(VALID, success); ret.put(RESULTS, JacksonUtils.prettyPrint(content)); return ret; }
Example #4
Source File: Schema2PojoProcessing.java From json-schema-validator-demo with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected JsonNode buildResult(final String input) throws IOException, ProcessingException { final ObjectNode ret = FACTORY.objectNode(); final boolean invalidSchema = fillWithData(ret, INPUT, INVALID_INPUT, input); final JsonNode schemaNode = ret.remove(INPUT); if (invalidSchema) return ret; final SchemaTree tree = new CanonicalSchemaTree(SchemaKey.anonymousKey(), schemaNode); final ValueHolder<SchemaTree> holder = ValueHolder.hold("schema", tree); final ProcessingReport report = new ListProcessingReport(); final ProcessingResult<ValueHolder<String>> result = ProcessingResult.uncheckedResult(PROCESSOR, report, holder); final boolean success = result.isSuccess(); ret.put(VALID, success); final String content = success ? result.getResult().getValue() : JacksonUtils.prettyPrint(buildReport(result.getReport())); ret.put(RESULTS, content); return ret; }