in services/library/src/main/java/com/google/cloud/pso/bq_pii_classifier/helpers/Utils.java [102:120]
public static List<String> getArgFromJsonParamsAsList(JsonObject requestJson, String argName, boolean required) {
JsonArray jsonArray = new JsonArray();
// check in Json
if (requestJson != null && requestJson.has(argName)) {
jsonArray = requestJson.get(argName).getAsJsonArray();
}
// validate it exists
if(required) {
if (jsonArray.size() == 0)
throw new IllegalArgumentException(String.format("%s is required", argName));
}
Type listType = new TypeToken<List<String>>() {}.getType();
return new Gson().fromJson(jsonArray, listType);
}