Found a project https://github.com/nh13/ruamel_yaml_line_info which in principle is supposed to save the reference of the yaml keys. This could be very useful for referencing back which key and which line a validation error occurs at for example.