Property to define handler or custom data


Hello everybody,

I am considering using RAML also as a configuration file for my PHP based API controller.
I was thinking it would be nice if I can add a string to the resource description, that my controller will then read and be able to determine which class or function to use for serving the request.

For example:

    handler: BooksClass.list

So my API controller will read and parse the RAML, extract the “handler” attribute, and decide to call the “list” method in the BooksClass passing it whatever parameters it deems necessary.

I realize that defining a handler syntax that may be appropriate for different languages and backend configurations may be difficult, but perhaps allowing a custom “meta data” properties could solve this?

I am completely new to RAML, so if there is a more appropriate way to approach this problem, I would love to be enlightened.


Yea I just read the Spec… and was looking for the “custom”, or “handler” …etc and ended up here…

Its strange that there isnt a technique to add a Handler… in my case for golang/revel


Hi @Peter_mash_Morgan and @dannyb, not sure if that is still something you both look at, but RAML 1.0 introduced annotation that exactly do what you need here. Let me show you an example:

#%RAML 1.0
title: Handler Showcase

      value: string

    (handler): BooksClass.list

Hope that helps!


Thanks Christian,

I have since moved away from RAML, but its good to see such a feature has become a part of the specs.


Shocked - :smiley:

Hope you are coming back :stuck_out_tongue:



The truth is I like Raml a lot. More than “the other one”.
But the ecosystem and adoption around the alternative tools left me with little free choice.


Let me know if you need something to convince people :smiley: