docs: function diffObjects(container, pathPrefix, objOld, objNew, patchSpec) {
  
  	// keep track of processed properties
  	const unrecognizedPropNames = new Set(Object.keys(objNew));
  
  	// diff main properties
  	diffObjectProps(
  		container, pathPrefix,
  		objOld, objNew,
  		unrecognizedPropNames, patchSpec);	
  
  	// check if polymorphic object and check the subtype properties
  	if (container.isPolymorphObject()) {
  
  		// type property is recognized
  		unrecognizedPropNames.delete(container.typePropertyName);
  
  		// match the subtype
  		const subtype = objOld[container.typePropertyName];
  		if (objNew[container.typePropertyName] !== subtype)
  			throw new common.X2SyntaxError(
  				'Polymorphic object type does not match.');
  
  		// go over the subtype properties
  		const subtypeDesc = container.getPropertyDesc(subtype);
  		diffObjectProps(
  			subtypeDesc.nestedProperties, `${pathPrefix}${subtype}:`,
  			objOld, objNew,
  			unrecognizedPropNames, patchSpec);
  	}
  
  	// any unrecognized properties?
  	if (unrecognizedPropNames.size > 0)
  		throw new common.X2SyntaxError(
  			`Unrecognized properties for ${container.recordTypeName}` +
  			` at ${pathPrefix}:` + Array.from(unrecognizedPropNames).join(', '));
  }