Search in sources :

Example 1 with FhirInstanceValidator

use of org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator in project dpc-app by CMSgov.

the class RosterValidationTest method setup.

@BeforeAll
static void setup() {
    ctx = FhirContext.forDstu3();
    final FhirInstanceValidator instanceValidator = new FhirInstanceValidator();
    fhirValidator = ctx.newValidator();
    fhirValidator.setValidateAgainstStandardSchematron(false);
    fhirValidator.setValidateAgainstStandardSchema(false);
    fhirValidator.registerValidatorModule(instanceValidator);
    dpcModule = new DPCProfileSupport(ctx);
    final ValidationSupportChain chain = new ValidationSupportChain(new DefaultProfileValidationSupport(), dpcModule);
    instanceValidator.setValidationSupport(chain);
}
Also used : ValidationSupportChain(org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain) FhirInstanceValidator(org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator) DefaultProfileValidationSupport(org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with FhirInstanceValidator

use of org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator in project dpc-app by CMSgov.

the class AttestationValidationTest method setup.

@BeforeAll
static void setup() {
    ctx = FhirContext.forDstu3();
    final FhirInstanceValidator instanceValidator = new FhirInstanceValidator();
    fhirValidator = ctx.newValidator();
    fhirValidator.setValidateAgainstStandardSchematron(false);
    fhirValidator.setValidateAgainstStandardSchema(false);
    fhirValidator.registerValidatorModule(instanceValidator);
    dpcModule = new DPCProfileSupport(ctx);
    final ValidationSupportChain chain = new ValidationSupportChain(new DefaultProfileValidationSupport(), dpcModule);
    instanceValidator.setValidationSupport(chain);
}
Also used : ValidationSupportChain(org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain) FhirInstanceValidator(org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator) DefaultProfileValidationSupport(org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with FhirInstanceValidator

use of org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator in project dpc-app by CMSgov.

the class OrganizationValidationTest method setup.

@BeforeAll
static void setup() {
    ctx = FhirContext.forDstu3();
    final FhirInstanceValidator instanceValidator = new FhirInstanceValidator();
    fhirValidator = ctx.newValidator();
    fhirValidator.setValidateAgainstStandardSchematron(false);
    fhirValidator.setValidateAgainstStandardSchema(false);
    fhirValidator.registerValidatorModule(instanceValidator);
    dpcModule = new DPCProfileSupport(ctx);
    final ValidationSupportChain chain = new ValidationSupportChain(new DefaultProfileValidationSupport(), dpcModule);
    instanceValidator.setValidationSupport(chain);
}
Also used : ValidationSupportChain(org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain) FhirInstanceValidator(org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator) DefaultProfileValidationSupport(org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with FhirInstanceValidator

use of org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator in project dpc-app by CMSgov.

the class FHIRValidatorProvider method get.

@Override
public FhirValidator get() {
    logger.debug("Schema validation enabled: {}.\nSchematron validation enabled: {}", validationConfiguration.isSchemaValidation(), validationConfiguration.isSchematronValidation());
    final FhirInstanceValidator instanceValidator = new FhirInstanceValidator();
    final FhirValidator fhirValidator = ctx.newValidator();
    fhirValidator.setValidateAgainstStandardSchematron(validationConfiguration.isSchematronValidation());
    fhirValidator.setValidateAgainstStandardSchema(validationConfiguration.isSchemaValidation());
    fhirValidator.registerValidatorModule(instanceValidator);
    instanceValidator.setValidationSupport(this.supportChain);
    return fhirValidator;
}
Also used : FhirInstanceValidator(org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator) FhirValidator(ca.uhn.fhir.validation.FhirValidator)

Example 5 with FhirInstanceValidator

use of org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator in project synthea by synthetichealth.

the class ValidationResources method initializeSTU3.

private void initializeSTU3() {
    FhirContext ctx = FhirStu3.getContext();
    FhirInstanceValidator instanceValidator = new FhirInstanceValidator(ctx);
    ValidationSupportChain chain = new ValidationSupportChain(new ValidationSupportSTU3(ctx), new DefaultProfileValidationSupport(ctx), new InMemoryTerminologyServerValidationSupport(ctx), new CommonCodeSystemsTerminologyService(ctx));
    instanceValidator.setValidationSupport(chain);
    instanceValidator.setAnyExtensionsAllowed(true);
    instanceValidator.setErrorForUnknownProfiles(false);
    validatorSTU3 = ctx.newValidator().registerValidatorModule(instanceValidator);
}
Also used : FhirContext(ca.uhn.fhir.context.FhirContext) InMemoryTerminologyServerValidationSupport(org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport) ValidationSupportChain(org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain) FhirInstanceValidator(org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator) DefaultProfileValidationSupport(ca.uhn.fhir.context.support.DefaultProfileValidationSupport) CommonCodeSystemsTerminologyService(org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyService)

Aggregations

FhirInstanceValidator (org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator)7 DefaultProfileValidationSupport (org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport)6 ValidationSupportChain (org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain)6 BeforeAll (org.junit.jupiter.api.BeforeAll)6 FhirInstanceValidator (org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator)4 FhirContext (ca.uhn.fhir.context.FhirContext)2 DefaultProfileValidationSupport (ca.uhn.fhir.context.support.DefaultProfileValidationSupport)2 CommonCodeSystemsTerminologyService (org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyService)2 InMemoryTerminologyServerValidationSupport (org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport)2 ValidationSupportChain (org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain)2 FhirValidator (ca.uhn.fhir.validation.FhirValidator)1 IValidatorModule (ca.uhn.fhir.validation.IValidatorModule)1