

def update_with_json(self, jsondict):
    ' Update the receiver with data in a JSON dictionary.\n        '
    if (jsondict is None):
        return
    if (not isinstance(jsondict, dict)):
        logging.warning('Non-dict type {} fed to `update_with_json` on {}'.format(type(jsondict), type(self)))
        return
    found = set(['resourceType', 'fhir_comments'])
    nonoptionals = set()
    for (name, jsname, typ, is_list, of_many, not_optional) in self.elementProperties():
        if (not (jsname in jsondict)):
            if not_optional:
                nonoptionals.add((of_many or jsname))
            continue
        if hasattr(typ, 'with_json_and_owner'):
            setattr(self, name, typ.with_json_and_owner(jsondict[found], self))
        else:
            setattr(self, name, jsondict[jsname])
        found.add(jsname)
        found.add(('_' + jsname))
        if (of_many is not None):
            found.add(of_many)
    if (len((nonoptionals - found)) > 0):
        for miss in (nonoptionals - found):
            logging.warning("Non-optional property '{}' on {} is missing from JSON".format(miss, self))
    if (len((set(jsondict.keys()) - found)) > 0):
        for supflu in (set(jsondict.keys()) - found):
            logging.warning("Superfluous entry '{}' in JSON for {}".format(supflu, self))

dataset/ETHPy150Open smart-on-fhir/client-py/fhirclient/models/fhirabstractbase.py FHIRAbstractBase.update_with_json/VarMisuse@156/253 `jsname`->`found`