{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/elide/issues/449","repository_url":"https://api.github.com/repos/yahoo/elide","labels_url":"https://api.github.com/repos/yahoo/elide/issues/449/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/elide/issues/449/comments","events_url":"https://api.github.com/repos/yahoo/elide/issues/449/events","html_url":"https://github.com/yahoo/elide/issues/449","id":222812146,"number":449,"title":"Add ability to auto-pluralize root collections","user":{"login":"cdeszaq","id":612084,"avatar_url":"https://avatars3.githubusercontent.com/u/612084?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeszaq","html_url":"https://github.com/cdeszaq","followers_url":"https://api.github.com/users/cdeszaq/followers","following_url":"https://api.github.com/users/cdeszaq/following{/other_user}","gists_url":"https://api.github.com/users/cdeszaq/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeszaq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeszaq/subscriptions","organizations_url":"https://api.github.com/users/cdeszaq/orgs","repos_url":"https://api.github.com/users/cdeszaq/repos","events_url":"https://api.github.com/users/cdeszaq/events{/privacy}","received_events_url":"https://api.github.com/users/cdeszaq/received_events","type":"User","site_admin":false},"labels":[{"id":705731739,"url":"https://api.github.com/repos/yahoo/elide/labels/Hacktoberfest","name":"Hacktoberfest","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-04-19T17:28:26Z","updated_at":"2018-03-07T19:49:38Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Many clients, like Ember, expect pluralized root-level collections, and a number of other APIs / frameworks do this by default (ie. Ruby on Rails). Elide supports changing the by manually setting the `type` parameter on the `@Include` annotation, but this is the sort of thing that automation and defaults are well suited to handle. Here's how this looks today:\r\n\r\n```java\r\n// Assume you have a class titled Report\r\n@Include(rootLevel = true, type = \"reports\")\r\n```\r\n\r\nInstead of having to do this for every root-level object, it would be _amazing_ if Elide had a property to turn on auto-pluralization of root-level collections by default. \r\n\r\nThe  `EntityDictionary` likely holds most everything needed, and Apache Commons may even provide a pluralizer that can be used for this. At first glance, the `EntityDictionary::getJsonAliasFor(Class<?> entityClass)` method seems like the place to add this new capability, though there's concern that that method calls into an entity binding. If so, this would require modifying the entity binding to bind the right thing or else types could get confused. \r\n\r\nAnother oddity of this approach is that the type for all instances would always be plural, which is likely undesired, so it might be better to be smarter and pluralize / unpluralize where relevant. This would let the type be singular, while having it's root-level json alias be plural.\r\n\r\nTo accomplish this extra set of smarts, this may need to happen in the state machine, with `StartState.java` being the only piece that would care about this.\r\n\r\nEither way, the general guidance for this feature would be to follow what Ember expects by default. An Ember app is usually backed by a JSON-API, often served by a Ruby on Rails web service, and that is likely a common-enough pattern that other plural-expecting clients will be very similar or even the same with what they expect."},"comment":{"url":"https://api.github.com/repos/yahoo/elide/issues/comments/371262204","html_url":"https://github.com/yahoo/elide/issues/449#issuecomment-371262204","issue_url":"https://api.github.com/repos/yahoo/elide/issues/449","id":371262204,"user":{"login":"clayreimann","id":930039,"avatar_url":"https://avatars3.githubusercontent.com/u/930039?v=4","gravatar_id":"","url":"https://api.github.com/users/clayreimann","html_url":"https://github.com/clayreimann","followers_url":"https://api.github.com/users/clayreimann/followers","following_url":"https://api.github.com/users/clayreimann/following{/other_user}","gists_url":"https://api.github.com/users/clayreimann/gists{/gist_id}","starred_url":"https://api.github.com/users/clayreimann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clayreimann/subscriptions","organizations_url":"https://api.github.com/users/clayreimann/orgs","repos_url":"https://api.github.com/users/clayreimann/repos","events_url":"https://api.github.com/users/clayreimann/events{/privacy}","received_events_url":"https://api.github.com/users/clayreimann/received_events","type":"User","site_admin":false},"created_at":"2018-03-07T19:49:38Z","updated_at":"2018-03-07T19:49:38Z","author_association":"CONTRIBUTOR","body":"Unfortunately not. You can use `@Include` to rename the entity to the plural form to make the URLs pretty but that has the side effect of changing the `type` field to the plural form"}}
{"actor":{"display_login":"clayreimann"}}