Class FHIRValidator
- java.lang.Object
-
- org.linuxforhealth.fhir.validation.FHIRValidator
-
@NotThreadSafe public class FHIRValidator extends java.lang.Object
A validator that uses conformance resources from theFHIRRegistry
to validate resource instances against the base specification and, optionally, extended profiles. The static factory methodvalidator()
is threadsafe, but the created instances are not.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SOURCE_VALIDATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isFailFast()
Indicates whether this validator is fail-fastjava.util.List<OperationOutcome.Issue>
validate(Resource resource, boolean includeResourceAssertedProfiles, java.lang.String... profiles)
Validate aResource
against constraints in the base specification and resource-asserted profile references and/or specific profile references.java.util.List<OperationOutcome.Issue>
validate(Resource resource, java.lang.String... profiles)
Validate aResource
against constraints in the base specification and resource-asserted profile references or specific profile references but not both.java.util.List<OperationOutcome.Issue>
validate(FHIRPathEvaluator.EvaluationContext evaluationContext, boolean includeResourceAssertedProfiles, java.lang.String... profiles)
Validate a resource, using anFHIRPathEvaluator.EvaluationContext
, against constraints in the base specification and resource-asserted profile references and/or specific profile references.java.util.List<OperationOutcome.Issue>
validate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String... profiles)
Validate a resource, using anFHIRPathEvaluator.EvaluationContext
, against constraints in the base specification and resource-asserted profile references or specific profile references but not both.static FHIRValidator
validator()
static FHIRValidator
validator(boolean failFast)
-
-
-
Field Detail
-
SOURCE_VALIDATOR
public static final java.lang.String SOURCE_VALIDATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
isFailFast
public boolean isFailFast()
Indicates whether this validator is fail-fastA fail-fast validator is one that terminates on the first issue it finds with a severity of ERROR.
- Returns:
- true if this validator is fail-fast, false otherwise
-
validate
public java.util.List<OperationOutcome.Issue> validate(Resource resource, java.lang.String... profiles) throws FHIRValidationException
Validate aResource
against constraints in the base specification and resource-asserted profile references or specific profile references but not both.Resource-asserted profile references that are not available in the FHIRRegistry result in issues with severity WARNING.
Unknown profile references passed as arguments to this method result in issues with severity ERROR.
Profiles that are incompatible with the resource type being validated result in issues with severity ERROR.
Profile references that are passed into this method are only applicable to the outermost resource (not contained resources).
- Parameters:
resource
- aResource
instance (the target of validation)profiles
- specific profile references to validate the resource against- Returns:
- a non-null, possibly empty list of issues generated during validation (sorted by severity)
- Throws:
FHIRValidationException
- for errors that occur during validation
-
validate
public java.util.List<OperationOutcome.Issue> validate(Resource resource, boolean includeResourceAssertedProfiles, java.lang.String... profiles) throws FHIRValidationException
Validate aResource
against constraints in the base specification and resource-asserted profile references and/or specific profile references.Resource-asserted profile references that are not available in the FHIRRegistry result in issues with severity WARNING.
Unknown profile references passed as arguments to this method result in issues with severity ERROR.
Profiles that are incompatible with the resource type being validated result in issues with severity ERROR.
Profile references that are passed into this method are only applicable to the outermost resource (not contained resources).
- Parameters:
resource
- aResource
instance (the target of validation)includeResourceAssertedProfiles
- whether or not to consider resource-asserted profiles during validationprofiles
- specific profile references to validate the resource against- Returns:
- a non-null, possibly empty list of issues generated during validation (sorted by severity)
- Throws:
FHIRValidationException
- for errors that occur during validation
-
validate
public java.util.List<OperationOutcome.Issue> validate(FHIRPathEvaluator.EvaluationContext evaluationContext, java.lang.String... profiles) throws FHIRValidationException
Validate a resource, using anFHIRPathEvaluator.EvaluationContext
, against constraints in the base specification and resource-asserted profile references or specific profile references but not both.Resource-asserted profile references that are not available in the FHIRRegistry result in issues with severity WARNING.
Unknown profile references passed as arguments to this method result in issues with severity ERROR.
Profiles that are incompatible with the resource type being validated result in issues with severity ERROR.
Profile references that are passed into this method are only applicable to the outermost resource (not contained resources).
- Parameters:
evaluationContext
- theFHIRPathEvaluator.EvaluationContext
for this validation which includes aFHIRPathTree
built from aResource
instance (the target of validation)profiles
- specific profile references to validate the evaluation context against- Returns:
- a non-null, possibly empty list of issues generated during validation (sorted by severity)
- Throws:
FHIRValidationException
- for errors that occur during validation
-
validate
public java.util.List<OperationOutcome.Issue> validate(FHIRPathEvaluator.EvaluationContext evaluationContext, boolean includeResourceAssertedProfiles, java.lang.String... profiles) throws FHIRValidationException
Validate a resource, using anFHIRPathEvaluator.EvaluationContext
, against constraints in the base specification and resource-asserted profile references and/or specific profile references.Resource-asserted profile references that are not available in the FHIRRegistry result in issues with severity WARNING.
Unknown profile references passed as arguments to this method result in issues with severity ERROR.
Profiles that are incompatible with the resource type being validated result in issues with severity ERROR.
Profile references that are passed into this method are only applicable to the outermost resource (not contained resources).
- Parameters:
evaluationContext
- theFHIRPathEvaluator.EvaluationContext
for this validation which includes aFHIRPathTree
built from aResource
instance (the target of validation)includeResourceAssertedProfiles
- whether or not to consider resource-asserted profiles during validationprofiles
- specific profile references to validate the evaluation context against- Returns:
- a non-null, possibly empty list of issues generated during validation (sorted by severity)
- Throws:
FHIRValidationException
- for errors that occur during validation
-
validator
public static FHIRValidator validator()
-
validator
public static FHIRValidator validator(boolean failFast)
-
-