use of com.artipie.front.misc.Yaml2Json in project front by artipie.
the class GetRepository method handle.
@Override
public String handle(final Request request, final Response response) {
final JsonObject repo = new Yaml2Json().apply(new String(this.stn.value(GetRepository.NAME_PARAM.parse(request), RequestAttr.Standard.USER_ID.readOrThrow(request)), StandardCharsets.UTF_8)).asJsonObject().getJsonObject(GetRepository.REPO);
JsonObjectBuilder builder = Json.createObjectBuilder();
for (final Map.Entry<String, JsonValue> item : repo.entrySet()) {
if (!"permissions".equals(item.getKey())) {
builder = builder.add(item.getKey(), item.getValue());
}
}
response.type("application/json");
return Json.createObjectBuilder().add(GetRepository.REPO, builder.build()).build().toString();
}
Aggregations