docs: private void writePrincipals(List<Principal> principals)
              throws JsonGenerationException, IOException {
          if (principals.size() == 1 && principals.get(0).equals(Principal.All)) {
              writeJsonKeyValue(JsonDocumentFields.PRINCIPAL, Principal.All.getId());
          } else {
              writeJsonObjectStart(JsonDocumentFields.PRINCIPAL);
  
              Map<String, List<String>> principalsByScheme = groupPrincipalByScheme(principals);
  
              List<String> principalValues;
              for (Map.Entry<String, List<String>> entry : principalsByScheme.entrySet()) {
                  principalValues = principalsByScheme.get(entry.getKey());
  
                  if (principalValues.size() == 1) {
                      writeJsonKeyValue(entry.getKey(), principalValues.get(0));
                  } else {
                      writeJsonArray(entry.getKey(), principalValues);
                  }
  
              }
              writeJsonObjectEnd();
          }
      }