Open ewoutkramer opened 9 months ago
Here's the relevant Java. As you can see, Grahame has combined the rules per type of resource in specialized validators. Some of them really complex (like the Bundle one), others (like Observation) much more simple. I'd say this is VERY useful to do, as this would bridge a lot of the gaps between the two validators. But also, as a rough estimate I think it would take about 20 days.
if (element.getType().equals(BUNDLE)) {
return new BundleValidator(this, serverBase).validateBundle(errors, element, stack, checkSpecials, valContext, pct, mode) && ok;
} else if (element.getType().equals("Observation")) {
return new ObservationValidator(this).validateObservation(valContext, errors, element, stack, pct, mode) && ok;
} else if (element.getType().equals("Questionnaire")) {
return new QuestionnaireValidator(this, myEnableWhenEvaluator, fpe, questionnaireMode).validateQuestionannaire(errors, element, element, stack) && ok;
} else if (element.getType().equals("QuestionnaireResponse")) {
return new QuestionnaireValidator(this, myEnableWhenEvaluator, fpe, questionnaireMode).validateQuestionannaireResponse(valContext, errors, element, stack) && ok;
} else if (element.getType().equals("Measure")) {
return new MeasureValidator(this).validateMeasure(valContext, errors, element, stack) && ok;
} else if (element.getType().equals("MeasureReport")) {
return new MeasureValidator(this).validateMeasureReport(valContext, errors, element, stack) && ok;
} else if (element.getType().equals("CapabilityStatement")) {
return validateCapabilityStatement(errors, element, stack) && ok;
} else if (element.getType().equals("CodeSystem")) {
return new CodeSystemValidator(this).validateCodeSystem(errors, element, stack, baseOptions.withLanguage(stack.getWorkingLang())) && ok;
} else if (element.getType().equals("ConceptMap")) {
return new ConceptMapValidator(this).validateConceptMap(errors, element, stack, baseOptions.withLanguage(stack.getWorkingLang())) && ok;
} else if (element.getType().equals("SearchParameter")) {
return new SearchParameterValidator(this, fpe).validateSearchParameter(errors, element, stack) && ok;
} else if (element.getType().equals("StructureDefinition")) {
return new StructureDefinitionValidator(this, fpe, wantCheckSnapshotUnchanged).validateStructureDefinition(errors, element, stack) && ok;
} else if (element.getType().equals("StructureMap")) {
return new StructureMapValidator(this, fpe, profileUtilities).validateStructureMap(errors, element, stack) && ok;
} else if (element.getType().equals("ValueSet")) {
return new ValueSetValidator(this).validateValueSet(errors, element, stack) && ok;
This picture show (in purple) the lines that call the methods that contain all the hand-written validations in the Java validator.
We should be adding those to the validator and monitor newly added ones.