Juan Hernandez has posted comments on this change. Change subject: restapi: Calculate singulars correctly ......................................................................
Patch Set 1: (1 comment) http://gerrit.ovirt.org/#/c/37517/1/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java File backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlBuilder.java: Line 591: //might need to truncate the plural 's', for example: Line 592: //for "{api}/hosts/{host:id}/nics" return "nic" Line 593: //but for "{api}/hosts/{host:id}/storage" return "storage" (don't truncate last character) Line 594: private String getSingleForm(String prefix) { Line 595: int startIndex = prefix.lastIndexOf('/')+1; > would you prefer extracting the patterns into a separate class/enum, so thi I don't think this enum is required. Going forward what we should do is avoid completely calculating singulars/plurals, as the information of what is the relationship between collection and entity names can be extracted from the XML schema. That will require a large refactoring, which we aren't doing now. So I prefer to not introduce additional infrastructure at the moment. Line 596: prefix = prefix.substring(startIndex); Line 597: if (prefix.endsWith("ies")) { Line 598: return prefix.replaceAll("ies$", "y"); Line 599: } -- To view, visit http://gerrit.ovirt.org/37517 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ifbd00642de18637e2620433395b3065a062a4ee9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> Gerrit-Reviewer: Juan Hernandez <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
