improve error message for extensions without values
This commit is contained in:
parent
c13f24ef4c
commit
1c1138ec9b
|
@ -118,7 +118,8 @@ public class I18nConstants {
|
||||||
public static final String EXTENSION_EXT_MODIFIER_MISMATCHY = "Extension_EXT_Modifier_MismatchY";
|
public static final String EXTENSION_EXT_MODIFIER_MISMATCHY = "Extension_EXT_Modifier_MismatchY";
|
||||||
public static final String EXTENSION_EXT_MODIFIER_N = "Extension_EXT_Modifier_N";
|
public static final String EXTENSION_EXT_MODIFIER_N = "Extension_EXT_Modifier_N";
|
||||||
public static final String EXTENSION_EXT_MODIFIER_Y = "Extension_EXT_Modifier_Y";
|
public static final String EXTENSION_EXT_MODIFIER_Y = "Extension_EXT_Modifier_Y";
|
||||||
public static final String EXTENSION_EXT_SIMPLE = "Extension_EXT_Simple";
|
public static final String EXTENSION_EXT_SIMPLE_ABSENT = "Extension_EXT_Simple_ABSENT";
|
||||||
|
public static final String EXTENSION_EXT_SIMPLE_WRONG = "Extension_EXT_Simple_WRONG";
|
||||||
public static final String EXTENSION_EXT_SUBEXTENSION_INVALID = "Extension_EXT_SubExtension_Invalid";
|
public static final String EXTENSION_EXT_SUBEXTENSION_INVALID = "Extension_EXT_SubExtension_Invalid";
|
||||||
public static final String EXTENSION_EXT_TYPE = "Extension_EXT_Type";
|
public static final String EXTENSION_EXT_TYPE = "Extension_EXT_Type";
|
||||||
public static final String EXTENSION_EXT_UNKNOWN = "Extension_EXT_Unknown";
|
public static final String EXTENSION_EXT_UNKNOWN = "Extension_EXT_Unknown";
|
||||||
|
|
|
@ -38,7 +38,8 @@ Extension_EXT_Modifier_MismatchN = Extension modifier mismatch: the extension el
|
||||||
Extension_EXT_Modifier_MismatchY = Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not
|
Extension_EXT_Modifier_MismatchY = Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not
|
||||||
Extension_EXT_Modifier_N = The Extension ''{0}'' must not be used as an extension (it''s a modifierExtension)
|
Extension_EXT_Modifier_N = The Extension ''{0}'' must not be used as an extension (it''s a modifierExtension)
|
||||||
Extension_EXT_Modifier_Y = The Extension ''{0}'' must not be used as a modifierExtension (it''s a regular extension)
|
Extension_EXT_Modifier_Y = The Extension ''{0}'' must not be used as a modifierExtension (it''s a regular extension)
|
||||||
Extension_EXT_Simple = The Extension ''{0}'' definition is for a simple extension, so it must contain a value, not extensions
|
Extension_EXT_Simple_ABSENT = The Extension ''{0}'' definition is for a simple extension, so it must contain a value
|
||||||
|
Extension_EXT_Simple_WRONG = The Extension ''{0}'' definition is for a simple extension, so it must contain a value, not extensions
|
||||||
Extension_EXT_SubExtension_Invalid = Sub-extension url ''{0}'' is not defined by the Extension {1}
|
Extension_EXT_SubExtension_Invalid = Sub-extension url ''{0}'' is not defined by the Extension {1}
|
||||||
Extension_EXT_Type = The Extension ''{0}'' definition allows for the types {1} but found type {2}
|
Extension_EXT_Type = The Extension ''{0}'' definition allows for the types {1} but found type {2}
|
||||||
Extension_EXT_URL_Absolute = Extension.url must be an absolute URL
|
Extension_EXT_URL_Absolute = Extension.url must be an absolute URL
|
||||||
|
|
|
@ -1852,10 +1852,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
// check the type of the extension:
|
// check the type of the extension:
|
||||||
Set<String> allowedTypes = listExtensionTypes(ex);
|
Set<String> allowedTypes = listExtensionTypes(ex);
|
||||||
String actualType = getExtensionType(element);
|
String actualType = getExtensionType(element);
|
||||||
if (actualType == null)
|
if (actualType != null)
|
||||||
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowedTypes.isEmpty(), I18nConstants.EXTENSION_EXT_SIMPLE, url);
|
|
||||||
else
|
|
||||||
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowedTypes.contains(actualType), I18nConstants.EXTENSION_EXT_TYPE, url, allowedTypes.toString(), actualType);
|
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowedTypes.contains(actualType), I18nConstants.EXTENSION_EXT_TYPE, url, allowedTypes.toString(), actualType);
|
||||||
|
else if (element.hasChildren("extension"))
|
||||||
|
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowedTypes.isEmpty(), I18nConstants.EXTENSION_EXT_SIMPLE_WRONG, url);
|
||||||
|
else
|
||||||
|
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowedTypes.isEmpty(), I18nConstants.EXTENSION_EXT_SIMPLE_ABSENT, url);
|
||||||
|
|
||||||
// 3. is the content of the extension valid?
|
// 3. is the content of the extension valid?
|
||||||
validateElement(hostContext, errors, ex, ex.getSnapshot().getElement().get(0), null, null, resource, element, "Extension", stack, false, true, url, pct, mode);
|
validateElement(hostContext, errors, ex, ex.getSnapshot().getElement().get(0), null, null, resource, element, "Extension", stack, false, true, url, pct, mode);
|
||||||
|
@ -4215,7 +4217,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (ElementDefinition criteriaElement : criteriaElements) {
|
for (ElementDefinition criteriaElement : criteriaElements) {
|
||||||
found = true;
|
found = true;
|
||||||
if (s.getType() == DiscriminatorType.TYPE) {
|
if ("0".equals(criteriaElement.getMax())) {
|
||||||
|
expression.append(" and " + discriminator + ".empty()");
|
||||||
|
} else if (s.getType() == DiscriminatorType.TYPE) {
|
||||||
String type = null;
|
String type = null;
|
||||||
if (!criteriaElement.getPath().contains("[") && discriminator.contains("[")) {
|
if (!criteriaElement.getPath().contains("[") && discriminator.contains("[")) {
|
||||||
discriminator = discriminator.substring(0, discriminator.indexOf('['));
|
discriminator = discriminator.substring(0, discriminator.indexOf('['));
|
||||||
|
|
Loading…
Reference in New Issue