def yaml_diagnostic(name='${diag_name}',
                    message='${message}',
                    file_path='/tidy/file.c',
                    file_offset=1,
                    replacements=(),
                    notes=()):
  """Creates a diagnostic serializable as YAML with reasonable defaults."""
  result = {
      'DiagnosticName': name,
      'DiagnosticMessage': {
          'Message': message,
          'FilePath': file_path,
          'FileOffset': file_offset,
      },
  }

  if replacements:
    result['DiagnosticMessage']['Replacements'] = [{
        'FilePath': x.file_path,
        'Offset': x.offset,
        'Length': x.length,
        'ReplacementText': x.text,
    } for x in replacements]

  if notes:
    result['Notes'] = [{
        'Message': x.message,
        'FilePath': x.file_path,
        'FileOffset': x.file_offset,
    } for x in notes]

  return result