tfredrich / RestApiTutorial.com

HTML Source code for www.RestApiTutorial.com

Home Page:http://www.RestApiTutorial.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some limitations of pluralization

opened this issue · comments

Hey

I've found at least two limitations in the pluralization of nouns in web services:

  • When the singular form and the plural form are the same (for example "species"), there is no mean of indicating whether the resource is a singleton
  • When a program or a human being only knows the singular forms of your entities, the plural forms must be found or guessed. The guessing isn't trivial to implement (I partially did it). Think about "watch -> whatches", "entity -> entities", "index -> indices or indexes", "status -> statuses", "appendix -> appendices", ...

Singularization wouldn't help. Moreover, using a plural form or a singular form doesn't tell you whether your collections allow duplicate elements. That's why I prefer using this kind of perfectible solution:
GET http://www.example.com/customerSet/33245/orderSet/8769/lineitemSet/1

Note that the second limitation can harm when designing automatic test procedures to ensure that all web services work except if the plural forms are used everywhere in your code, both in your database tables and in your classes. Would you really create a class named "Customers with an object oriented programming language?