You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Francesco Chicchiriccò <il...@apache.org> on 2015/07/14 11:46:53 UTC

WADL generation: split resources for the same path

Hi all,
any obvious reason why two distinct resources with path "/{key}" [1] are 
generated from [2]?

TIA
Regards.

[1] https://paste.apache.org/lQbF
[2] 
https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/


Re: WADL generation: split resources for the same path

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
See https://issues.apache.org/jira/browse/CXF-6499
I've added a "usePathParamsToCompareOperations" property, could not 
think of a better name :-), enabled by default, try to set it to false 
and you should see all 3 operations sharing the same parent resource.
I thought nay be it should be disabled by default but I'm not sure about 
the reverse generation issue side-effects, so for now I set to true by 
default

Thanks, Sergey

On 15/07/15 12:04, Francesco Chicchiriccò wrote:
> On 15/07/2015 10:26, Sergey Beryozkin wrote:
>> Hi,
>> On 15/07/15 11:05, Francesco Chicchiriccò wrote:
>>> On 14/07/2015 16:34, Sergey Beryozkin wrote:
>>>> Hi Francesco,
>>>>
>>>> The generator checks which operations are the same path operations,
>>>> I've checked the code and it also compares a number of path and matrix
>>>> parameters, so PUT was also sharing the same root resource, before it
>>>> had a keyId method parameter.
>>>>
>>>> If PUT where inside a keyId resource then the reverse generation would
>>>> produce a put method with a PathParam.
>>>>
>>>> We can add a configuration option to make sure PUT ends up in the same
>>>> block with GET/DELETE, but as I mentioned that would imply a generated
>>>> Java PUT method would end up with PathParam - that can be done if you
>>>> prefer it
>>>
>>> So basically the "problem" is the usage of @BeanParam for the PUT
>>> method; I can probably improve our WADL2HTML to group together such
>>> split resources.
>>>
>> I'm not seeing @BeanParam at
>>
>> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
>>
>
> You're right! Since I could not remember why, I've just tested it again:
> when using @BeanParam there - and in all similar methods from all other
> services - I experiment that the actual payload is not sent by client at
> all.
>
>> I think it is because no @PathParam is available in the signature (I
>> recall we discussed the idea so that the client does not have to put
>> null...) and this is why PUT is not sharing the same root, because if
>> it does share the same root then it would imply, at the generation
>> time that the method signature does need to have @PathParam.
>>
>> To be honest I think the fact WADL requires template parameters being
>> defined at the resource but not method level is not very flexible
>> because it implies the inheritance for all the immediate method children.
>>
>> It is very easy to update WADLGenerator to make sure it shares the
>> same root - if the reverse generation issue is not a real issue (which
>> can actually be the case), let me add the configuration option...
>
> This would be nice indeed, thanks.
>
> Regards.
>
>>>> On 14/07/15 10:46, Francesco Chicchiriccò wrote:
>>>>> Hi all,
>>>>> any obvious reason why two distinct resources with path "/{key}"
>>>>> [1] are
>>>>> generated from [2]?
>>>>>
>>>>> TIA
>>>>> Regards.
>>>>>
>>>>> [1] https://paste.apache.org/lQbF
>>>>> [2]
>>>>> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
>>>>>
>


Re: WADL generation: split resources for the same path

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 15/07/2015 10:26, Sergey Beryozkin wrote:
> Hi,
> On 15/07/15 11:05, Francesco Chicchiriccò wrote:
>> On 14/07/2015 16:34, Sergey Beryozkin wrote:
>>> Hi Francesco,
>>>
>>> The generator checks which operations are the same path operations,
>>> I've checked the code and it also compares a number of path and matrix
>>> parameters, so PUT was also sharing the same root resource, before it
>>> had a keyId method parameter.
>>>
>>> If PUT where inside a keyId resource then the reverse generation would
>>> produce a put method with a PathParam.
>>>
>>> We can add a configuration option to make sure PUT ends up in the same
>>> block with GET/DELETE, but as I mentioned that would imply a generated
>>> Java PUT method would end up with PathParam - that can be done if you
>>> prefer it
>>
>> So basically the "problem" is the usage of @BeanParam for the PUT
>> method; I can probably improve our WADL2HTML to group together such
>> split resources.
>>
> I'm not seeing @BeanParam at
>
> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java 
>

You're right! Since I could not remember why, I've just tested it again: 
when using @BeanParam there - and in all similar methods from all other 
services - I experiment that the actual payload is not sent by client at 
all.

> I think it is because no @PathParam is available in the signature (I 
> recall we discussed the idea so that the client does not have to put 
> null...) and this is why PUT is not sharing the same root, because if 
> it does share the same root then it would imply, at the generation 
> time that the method signature does need to have @PathParam.
>
> To be honest I think the fact WADL requires template parameters being 
> defined at the resource but not method level is not very flexible 
> because it implies the inheritance for all the immediate method children.
>
> It is very easy to update WADLGenerator to make sure it shares the 
> same root - if the reverse generation issue is not a real issue (which 
> can actually be the case), let me add the configuration option...

This would be nice indeed, thanks.

Regards.

>>> On 14/07/15 10:46, Francesco Chicchiriccò wrote:
>>>> Hi all,
>>>> any obvious reason why two distinct resources with path "/{key}" 
>>>> [1] are
>>>> generated from [2]?
>>>>
>>>> TIA
>>>> Regards.
>>>>
>>>> [1] https://paste.apache.org/lQbF
>>>> [2] 
>>>> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java 
>>>>

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/


Re: WADL generation: split resources for the same path

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
On 15/07/15 11:05, Francesco Chicchiriccò wrote:
> On 14/07/2015 16:34, Sergey Beryozkin wrote:
>> Hi Francesco,
>>
>> The generator checks which operations are the same path operations,
>> I've checked the code and it also compares a number of path and matrix
>> parameters, so PUT was also sharing the same root resource, before it
>> had a keyId method parameter.
>>
>> If PUT where inside a keyId resource then the reverse generation would
>> produce a put method with a PathParam.
>>
>> We can add a configuration option to make sure PUT ends up in the same
>> block with GET/DELETE, but as I mentioned that would imply a generated
>> Java PUT method would end up with PathParam - that can be done if you
>> prefer it
>
> So basically the "problem" is the usage of @BeanParam for the PUT
> method; I can probably improve our WADL2HTML to group together such
> split resources.
>
I'm not seeing @BeanParam at

https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java

I think it is because no @PathParam is available in the signature (I 
recall we discussed the idea so that the client does not have to put 
null...) and this is why PUT is not sharing the same root, because if it 
does share the same root then it would imply, at the generation time 
that the method signature does need to have @PathParam.

To be honest I think the fact WADL requires template parameters being 
defined at the resource but not method level is not very flexible 
because it implies the inheritance for all the immediate method children.

It is very easy to update WADLGenerator to make sure it shares the same 
root - if the reverse generation issue is not a real issue (which can 
actually be the case), let me add the configuration option...

Sergey



> Thanks.
> Regards.
>
>> On 14/07/15 10:46, Francesco Chicchiriccò wrote:
>>> Hi all,
>>> any obvious reason why two distinct resources with path "/{key}" [1] are
>>> generated from [2]?
>>>
>>> TIA
>>> Regards.
>>>
>>> [1] https://paste.apache.org/lQbF
>>> [2]
>>> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
>>>
>


Re: WADL generation: split resources for the same path

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 14/07/2015 16:34, Sergey Beryozkin wrote:
> Hi Francesco,
>
> The generator checks which operations are the same path operations, 
> I've checked the code and it also compares a number of path and matrix 
> parameters, so PUT was also sharing the same root resource, before it 
> had a keyId method parameter.
>
> If PUT where inside a keyId resource then the reverse generation would 
> produce a put method with a PathParam.
>
> We can add a configuration option to make sure PUT ends up in the same 
> block with GET/DELETE, but as I mentioned that would imply a generated 
> Java PUT method would end up with PathParam - that can be done if you 
> prefer it

So basically the "problem" is the usage of @BeanParam for the PUT 
method; I can probably improve our WADL2HTML to group together such 
split resources.

Thanks.
Regards.

> On 14/07/15 10:46, Francesco Chicchiriccò wrote:
>> Hi all,
>> any obvious reason why two distinct resources with path "/{key}" [1] are
>> generated from [2]?
>>
>> TIA
>> Regards.
>>
>> [1] https://paste.apache.org/lQbF
>> [2] 
>> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java 
>>

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/



Re: WADL generation: split resources for the same path

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Francesco,

The generator checks which operations are the same path operations, I've 
checked the code and it also compares a number of path and matrix 
parameters, so PUT was also sharing the same root resource, before it 
had a keyId method parameter.

If PUT where inside a keyId resource then the reverse generation would 
produce a put method with a PathParam.

We can add a configuration option to make sure PUT ends up in the same 
block with GET/DELETE, but as I mentioned that would imply a generated 
Java PUT method would end up with PathParam - that can be done if you 
prefer it

Thanks, Sergey
On 14/07/15 10:46, Francesco Chicchiriccò wrote:
> Hi all,
> any obvious reason why two distinct resources with path "/{key}" [1] are
> generated from [2]?
>
> TIA
> Regards.
>
> [1] https://paste.apache.org/lQbF
> [2]
> https://github.com/apache/syncope/blob/master/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyTypeService.java
>
>