def map_json_files()

in scripts/dashboard/validate_dashboards_format.py [0:0]


def map_json_files(directory, path_map):
  '''Stores json data into dictionary'''
  for json_file in path_map[directory]['json_files']:
    json_path = os.path.join('.', 'dashboards', directory, json_file)
    dash_dict = get_sample_dashboards_json(json_path)

    if not 'displayName' in dash_dict:
      raise JsonFormattingError("{} is missing displayName field".format(json_file))

    file_name_parts = json_file.split('.')
    check_json_file_name(json_file, file_name_parts)

    path_map[directory]['json_data'][file_name_parts[0]] = dash_dict['displayName']