本文整理了Java中com.github.fge.jsonschema.main.JsonSchema.validateUnchecked()
方法的一些代码示例,展示了JsonSchema.validateUnchecked()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonSchema.validateUnchecked()
方法的具体详情如下:
包路径:com.github.fge.jsonschema.main.JsonSchema
类名称:JsonSchema
方法名:validateUnchecked
[英]Validate an instance and return a processing report (unchecked version)
This calls #validateUnchecked(JsonNode,boolean) with false as a third argument.
[中]验证实例并返回处理报告(未选中版本)
这将调用#validateUnchecked(JsonNode,boolean),并将false作为第三个参数。
代码示例来源:origin: rest-assured/rest-assured
@Override
protected boolean matchesSafely(String content) {
try {
JsonNode contentAsJsonNode = JsonLoader.fromString(content);
JsonSchemaFactory jsonSchemaFactory = instanceSettings.jsonSchemaFactory();
Schema loadedSchema = loadSchema(schema, instanceSettings);
final JsonSchema jsonSchema;
if (loadedSchema.hasType(JsonNode.class)) {
jsonSchema = jsonSchemaFactory.getJsonSchema(JsonNode.class.cast(loadedSchema.schema));
} else if (loadedSchema.hasType(String.class)) {
jsonSchema = jsonSchemaFactory.getJsonSchema(String.class.cast(loadedSchema.schema));
} else {
throw new RuntimeException("Internal error when loading schema from factory. Type was " + loadedSchema.schema.getClass().getName());
}
if (instanceSettings.shouldUseCheckedValidation()) {
report = jsonSchema.validate(contentAsJsonNode);
} else {
report = jsonSchema.validateUnchecked(contentAsJsonNode);
}
return report.isSuccess();
} catch (Exception e) {
throw new JsonSchemaValidationException(e);
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public ProcessingReport validate(JsonNode node, String schema) {
JsonSchema jsonSchema;
try {
jsonSchema = getJsonSchemaFactory().getJsonSchema(schema);
} catch (ProcessingException ex) {
throw new IllegalArgumentException("Unknown schema: " + schema, ex);
}
return jsonSchema.validateUnchecked(node);
}
代码示例来源:origin: org.swisspush/gateleen-validation
ProcessingReport report = schema.validateUnchecked(JsonLoader.fromString(jsonBuffer.toString()));
if(report.isSuccess()) {
log.debug("Valid ("+type+")");
代码示例来源:origin: io.rest-assured/json-schema-validator
@Override
protected boolean matchesSafely(String content) {
try {
JsonNode contentAsJsonNode = JsonLoader.fromString(content);
JsonSchemaFactory jsonSchemaFactory = instanceSettings.jsonSchemaFactory();
Schema loadedSchema = loadSchema(schema, instanceSettings);
final JsonSchema jsonSchema;
if (loadedSchema.hasType(JsonNode.class)) {
jsonSchema = jsonSchemaFactory.getJsonSchema(JsonNode.class.cast(loadedSchema.schema));
} else if (loadedSchema.hasType(String.class)) {
jsonSchema = jsonSchemaFactory.getJsonSchema(String.class.cast(loadedSchema.schema));
} else {
throw new RuntimeException("Internal error when loading schema from factory. Type was " + loadedSchema.schema.getClass().getName());
}
if (instanceSettings.shouldUseCheckedValidation()) {
report = jsonSchema.validate(contentAsJsonNode);
} else {
report = jsonSchema.validateUnchecked(contentAsJsonNode);
}
return report.isSuccess();
} catch (Exception e) {
throw new JsonSchemaValidationException(e);
}
}
代码示例来源:origin: org.swisspush/gateleen-validation
ProcessingReport report = schema.validateUnchecked(JsonLoader.fromString(dataToBeValidated.toString()));
if(report.isSuccess()) {
return new ValidationResult(ValidationStatus.VALIDATED_POSITIV);
内容来源于网络,如有侵权,请联系作者删除!