Fork me on GitHub
#ring-swagger
<
2016-05-15
>
josh.freckleton14:05:56

is it possible to have a "polymorphic" endpoint? For example, imagine I have a schema for a User that contains a BasicInfo schema, a MediaOwned schema, and a BooksOwned schema, and these update to a MongoDB. Example User:

{:_id <Mongo's ObjectID>
:name "joe"
:address "123 sesame st."
{:books ["harry potter", "lord of the flies", "the tipping point"]
:videos []}}
Imagine I want to update the User, but I only want to submit an User ID and some books at PUT "/api/user". It would be cool if that endpoint could accept Books, or an entire Media, or the whole shebang, a User, and update only the relevant parts. Does that make sense? So the body of a request on this endpoint could be one of a few different schemas. Possible? Or should I just make a few different endpoints? (this sounds a little like the small amount I understand about datomic, just updating relevant parts of objects...)