Skip to content

Conversation

@mvriel
Copy link
Contributor

@mvriel mvriel commented Jun 19, 2015

In this PR I am writing a Proof of Concept for the new foundation of
Resourceful.

There is a decent chance that this will be deleted again but to get an idea
of the direction that we might take with Resourceful I have written this PoC.

The basic idea is that each action in a REST is a Command in the sense of a
Command Bus. When you issue a POST, PUT or DELETE then a Command with your
preferred name is issued (because it is linked to the route and method) and
when you issue a GET request you can provide a Projection that will assemble
the data that you need and return a representation specific to your wishes.

What is central in this design is that the relation between resources and
entities is fully decoupled (contrary to the previous design) so that you
can choose to, for example, return multiple representations of the same
entity. One for mobile, one for desktop, one for tablet for example.

The following is a list of stuff that I can now think of that needs to be
done:

  • Allow the selection of a Projection not only on basis of the URL
    but also on mimetype, or request parameter
  • Throw 406 if a series of mimetypes are provided but the request does not match that
  • Add another example including database entities to test how a
    simple crud operation would work
  • Add another layer over the current design if we see that we can
    improve on the simple CRUD scenario
  • Write a larger example that demonstrates how an API is actually
    based on commands and not on state transitions.
  • Write documentation
  • Write tests
  • Discuss with team
  • Add an admin interface for oAuth tokens and more
  • Add code generators to quickly generate a series of CRUD actions
  • Add an example without the central controller but with custom controllers
  • Add an API documentation module (can't use NelmioApiDocBundle because we don't have separate controllers that can have DocBlocks)
  • Test and fix exception 405 Exception
  • Test and fix exception 500 Exception
  • Test and fix exception 406 Exception
  • Errors are returned in HTML; switch them to JSON
  • Add JmsSerializer Projection to display a single entity, or a collection using Pagerfanta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants