code: public Map<String, Role> ymlToRoles(String yml) {
          try {
              Map<String, Role> map = mapper
                  .readValue(yml, new TypeReference<TreeMap<String, Role>>() {
                  });
              map.forEach((roleKey, role) -> role.setKey(roleKey));
              return map;
          } catch (Exception e) {
              log.error("Failed to create roles collection from YML file, error: {}", e.getMessage(), e);
          }
          return Collections.emptyMap();
      }
docs: Convert roles yml string to map.
  
  @param yml string
  @return roles map