Class JsonSchemaValidationWorkflowRunner<T extends com.google.protobuf.MessageOrBuilder>
java.lang.Object
org.phenopackets.phenopackettools.validator.jsonschema.JsonSchemaValidationWorkflowRunner<T>
- Type Parameters:
T
- must be one of the three top-level elements of the Phenopacket schema:PhenopacketOrBuilder
,FamilyOrBuilder
, orCohortOrBuilder
.
- All Implemented Interfaces:
ValidationWorkflowRunner<T>
public class JsonSchemaValidationWorkflowRunner<T extends com.google.protobuf.MessageOrBuilder>
extends Object
implements ValidationWorkflowRunner<T>
Validates if given top-level element satisfies the following criteria:
- data format requirements - for instance if the element is a valid JSON document if JSON input is provided
- basic Phenopacket schema syntax requirements - the requirements described by the reference documentation.
Absence of a required field is an
ValidationLevel.ERROR
and absence of a recommended field is aValidationLevel.WARNING
, - custom requirements - requirements provided in a JSON schema document(s) provided by the user or
provided as ad hoc
PhenopacketValidator
s.
The validation is performed in the order as outlined above. Note that the data format validation must pass in order for the latter steps to run.
Use one of JsonSchemaValidationWorkflowRunnerBuilder
s provided via static constructors (e.g. phenopacketBuilder()
) to build
the validation workflow.
-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonSchemaValidationWorkflowRunnerBuilder<org.phenopackets.schema.v2.CohortOrBuilder>
static JsonSchemaValidationWorkflowRunnerBuilder<org.phenopackets.schema.v2.FamilyOrBuilder>
static JsonSchemaValidationWorkflowRunnerBuilder<org.phenopackets.schema.v2.PhenopacketOrBuilder>
validate
(byte[] payload) Validate a top-level element starting from a pile of bytes.Validate a top-level element starting from a string.Validate a top-level element starting from a protobuf item.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.phenopackets.phenopackettools.validator.core.ValidationWorkflowRunner
validate, validate
-
Method Details
-
phenopacketBuilder
public static JsonSchemaValidationWorkflowRunnerBuilder<org.phenopackets.schema.v2.PhenopacketOrBuilder> phenopacketBuilder()- Returns:
- a
JsonSchemaValidationWorkflowRunnerBuilder
for building aJsonSchemaValidationWorkflowRunner
for validatingPhenopacketOrBuilder
.
-
familyBuilder
public static JsonSchemaValidationWorkflowRunnerBuilder<org.phenopackets.schema.v2.FamilyOrBuilder> familyBuilder()- Returns:
- a
JsonSchemaValidationWorkflowRunnerBuilder
for building aJsonSchemaValidationWorkflowRunner
for validatingFamilyOrBuilder
.
-
cohortBuilder
public static JsonSchemaValidationWorkflowRunnerBuilder<org.phenopackets.schema.v2.CohortOrBuilder> cohortBuilder()- Returns:
- a
JsonSchemaValidationWorkflowRunnerBuilder
for building aJsonSchemaValidationWorkflowRunner
for validatingCohortOrBuilder
-
validators
- Specified by:
validators
in interfaceValidationWorkflowRunner<T extends com.google.protobuf.MessageOrBuilder>
- Returns:
- a list with
ValidatorInfo
s describing the validations done by theValidationWorkflowRunner
.
-
validate
Description copied from interface:ValidationWorkflowRunner
Validate a top-level element starting from a pile of bytes.- Specified by:
validate
in interfaceValidationWorkflowRunner<T extends com.google.protobuf.MessageOrBuilder>
- Parameters:
payload
- top-level element in one of thePhenopacketFormat
s.- Returns:
- the validation results.
-
validate
Description copied from interface:ValidationWorkflowRunner
Validate a top-level element starting from a string.- Specified by:
validate
in interfaceValidationWorkflowRunner<T extends com.google.protobuf.MessageOrBuilder>
- Parameters:
json
- top-level element in eitherPhenopacketFormat.JSON
orPhenopacketFormat.YAML
.- Returns:
- the validation results.
-
validate
Description copied from interface:ValidationWorkflowRunner
Validate a top-level element starting from a protobuf item.- Specified by:
validate
in interfaceValidationWorkflowRunner<T extends com.google.protobuf.MessageOrBuilder>
- Parameters:
item
- the top-level element as protobuf item.- Returns:
- the validation results.
-