Error in json-schema validation for Bundle


#1

The problem is that each resource in the bundle should match just one of the definitions listed in ResourceList.schema.json (path: definitions.resourceList.oneOf), but there are some types in there that will match any kind of resource.

Those are:
-Resource
-Parameters (this one is also duplicated)
-DomainResource

So the entries in the bundle will match their correct definition AND those 3. That is an error in the json-schema spec.

In case I’m not making myself clear, here is a modified version of ResourceList.schema.json with which the bundles will be correctly validated.

cc @grahamegrieve


#2

I noticed the same problem with contained resources, which must be ‘oneOf’ the ResourceList resources.

For instance, a Condition, to be valid, must be both a valid DomainResource and a valid Condition. Yet, to be a valid item in a list of contained resources, the Condition must be ONLY one of a list of resources which includes both the Condition and the DomainResource. That’s a logical impossibility.

It seems your solution is to remove the potential duplicates from the list. Alternatively, the ResourceList condition could be changed to ‘anyOf’ (one or more).