Fix bindings constraint issue in validator
This commit is contained in:
parent
f0a9089bc4
commit
f366962f51
|
@ -720,5 +720,5 @@ TX_SERVER_NO_BATCH_RESPONSE = The server return null from a batch validation req
|
||||||
BUNDLE_POSSSIBLE_MATCHES = The bundle contains no match for {1} by the rules of Bundle reference resolution, but it has multiple resources that match {0} by resource type and id
|
BUNDLE_POSSSIBLE_MATCHES = The bundle contains no match for {1} by the rules of Bundle reference resolution, but it has multiple resources that match {0} by resource type and id
|
||||||
BUNDLE_BUNDLE_POSSIBLE_MATCH_NO_FU = Entry {0} matches the reference {1} by type and id but it does not match the full target URL {2} by Bundle resolution rules
|
BUNDLE_BUNDLE_POSSIBLE_MATCH_NO_FU = Entry {0} matches the reference {1} by type and id but it does not match the full target URL {2} by Bundle resolution rules
|
||||||
BUNDLE_BUNDLE_POSSIBLE_MATCH_WRONG_FU = Entry {0} matches the reference {1} by type and id but it''s fullUrl {2} does not match the full target URL {3} by Bundle resolution rules
|
BUNDLE_BUNDLE_POSSIBLE_MATCH_WRONG_FU = Entry {0} matches the reference {1} by type and id but it''s fullUrl {2} does not match the full target URL {3} by Bundle resolution rules
|
||||||
SD_ILLEGAL_CHARACTERISTICS = This element has a {0} but the types to do not make this kind of constraint relevant
|
SD_ILLEGAL_CHARACTERISTICS = This element has a {0} but the types {1} to do not make this kind of constraint relevant
|
||||||
SD_VALUE_COMPLEX_FIXED = For the complex type {0}, consider using a pattern rather than a fixed value to avoid over-constraining the instance
|
SD_VALUE_COMPLEX_FIXED = For the complex type {0}, consider using a pattern rather than a fixed value to avoid over-constraining the instance
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
addCharacteristics(tcharacteristics, tc);
|
addCharacteristics(tcharacteristics, tc);
|
||||||
characteristics.addAll(tcharacteristics);
|
characteristics.addAll(tcharacteristics);
|
||||||
if (type.hasChildren("targetProfile")) {
|
if (type.hasChildren("targetProfile")) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), tcharacteristics.contains("has-target") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "targetProfile");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), tcharacteristics.contains("has-target") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "targetProfile", tc);
|
||||||
}
|
}
|
||||||
// check the stated profile - must be a constraint on the type
|
// check the stated profile - must be a constraint on the type
|
||||||
if (snapshot || sd != null) {
|
if (snapshot || sd != null) {
|
||||||
|
@ -165,7 +165,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
}
|
}
|
||||||
if (element.hasChild("binding")) {
|
if (element.hasChild("binding")) {
|
||||||
if (!typeCodes.isEmpty()) {
|
if (!typeCodes.isEmpty()) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("can-bind") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "Binding");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("can-bind") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "Binding", typeCodes);
|
||||||
}
|
}
|
||||||
Element binding = element.getNamedChild("binding");
|
Element binding = element.getNamedChild("binding");
|
||||||
validateBinding(errors, binding, stack.push(binding, -1, null, null), typeCodes, snapshot, element.getNamedChildValue("path"));
|
validateBinding(errors, binding, stack.push(binding, -1, null, null), typeCodes, snapshot, element.getNamedChildValue("path"));
|
||||||
|
@ -176,22 +176,22 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
}
|
}
|
||||||
if (!typeCodes.isEmpty()) {
|
if (!typeCodes.isEmpty()) {
|
||||||
if (element.hasChild("maxLength")) {
|
if (element.hasChild("maxLength")) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-length") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MaxLength");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-length") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MaxLength", typeCodes);
|
||||||
}
|
}
|
||||||
if (element.hasExtension(ToolingExtensions.EXT_MIN_LENGTH)) {
|
if (element.hasExtension(ToolingExtensions.EXT_MIN_LENGTH)) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-length") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MinLength Extension");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-length") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MinLength Extension", typeCodes);
|
||||||
}
|
}
|
||||||
if (element.hasChild("minValue")) {
|
if (element.hasChild("minValue")) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-range") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MinValue");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-range") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MinValue", typeCodes);
|
||||||
}
|
}
|
||||||
if (element.hasChild("maxValue")) {
|
if (element.hasChild("maxValue")) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-range") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MaxValue");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-range") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "MaxValue", typeCodes);
|
||||||
}
|
}
|
||||||
if (element.hasExtension(ToolingExtensions.EXT_MAX_DECIMALS)) {
|
if (element.hasExtension(ToolingExtensions.EXT_MAX_DECIMALS)) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("is-continuous") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "Max Decimal Places Extension");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("is-continuous") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "Max Decimal Places Extension", typeCodes);
|
||||||
}
|
}
|
||||||
if (element.hasExtension(ToolingExtensions.EXT_MAX_SIZE)) {
|
if (element.hasExtension(ToolingExtensions.EXT_MAX_SIZE)) {
|
||||||
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-size") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "Max Size");
|
rule(errors, IssueType.BUSINESSRULE, stack.getLiteralPath(), characteristics.contains("has-size") , I18nConstants.SD_ILLEGAL_CHARACTERISTICS, "Max Size", typeCodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in a snapshot, we validate that fixedValue, pattern, and defaultValue, if present, are all of the right type
|
// in a snapshot, we validate that fixedValue, pattern, and defaultValue, if present, are all of the right type
|
||||||
|
@ -285,7 +285,7 @@ public class StructureDefinitionValidator extends BaseValidator {
|
||||||
case "Dosage" : return addCharacteristicsForType(set);
|
case "Dosage" : return addCharacteristicsForType(set);
|
||||||
case "Meta" :return addCharacteristicsForType(set);
|
case "Meta" :return addCharacteristicsForType(set);
|
||||||
case "Resource" :return addCharacteristicsForType(set);
|
case "Resource" :return addCharacteristicsForType(set);
|
||||||
case "Extension" :return addCharacteristicsForType(set);
|
case "Extension" :return addCharacteristicsForType(set, "can-bind");
|
||||||
case "Narrative" :return addCharacteristicsForType(set);
|
case "Narrative" :return addCharacteristicsForType(set);
|
||||||
case "Element" :return addCharacteristicsForType(set);
|
case "Element" :return addCharacteristicsForType(set);
|
||||||
case "BackboneElement" :return addCharacteristicsForType(set);
|
case "BackboneElement" :return addCharacteristicsForType(set);
|
||||||
|
|
Loading…
Reference in New Issue