xp-framework/xp-framework — pull request #152 by mihaighigea (2012-04-20 15:42:05+00:00)
Title: Fix optional params for rest server

Hi,

We have the following scenario: a web-method which handle requests for a collection with filtering possibilities.

````php
/**
* Handle products collection with filtering possibilities
*
* @param string color
* @param string size
* @param string weight
* @return fqdn.ProductCollection
*/
#[@webmethod(verb= 'GET', path= "/products?color={color}&size={size}&weight={weight}")]
public function handleProductsForFilters($color= NULL, $size= NULL, $weight= NULL) {
// Your code..
}
````

In the current implementation you can't have optional parameters (all are mandatory). In this case, for each combination of filters you must define a new web-method. My fix allow you to define only one handler for all possible combinations of filters. Each missing param is replaced by his default value.

Also, the API doc display which arguments are optional or not.

Cheers,
Mihai