You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to discuss the use of the plural form of a resource name, regardless of whether a single object or an array of objects is returned.
For example, a single post is to be returned as posts:
{
"posts": {
// an individual post document
}
}
Just like an array of resources:
{
"posts": [{
// an individual post document
}, {
// an individual post document
}]
}
I can see some advantages to this approach:
it ensures that a single record won't be included twice (e.g. as a post and as a member of posts)
it may reduce the needs for an inflector in the client (although model names are often singularized, in which case singular/plural translations are still needed)
it makes the client leaner by eliminating the need to check both singular/plural forms of the noun
The disadvantages I see:
it is arguably semantically incorrect to return a single object with a plural key
it breaks with the conventions in stock Rails, AMS and most REST APIs I've encountered
It would be good to discuss this further and clarify the rationale in the spec.
The text was updated successfully, but these errors were encountered:
I'd like to discuss the use of the plural form of a resource name, regardless of whether a single object or an array of objects is returned.
For example, a single
post
is to be returned asposts
:Just like an array of resources:
I can see some advantages to this approach:
post
and as a member ofposts
)The disadvantages I see:
It would be good to discuss this further and clarify the rationale in the spec.
The text was updated successfully, but these errors were encountered: