cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: CXF3 BeanValidation - wadl2java @Valid
Date Thu, 08 Sep 2016 08:43:16 GMT
On 08/09/16 07:02, Vjacheslav V. Borisov wrote:
>>
>>>> To be precise, wadl grammar already overloaded in wadl2java
>>> Becouse i can write <param style="query" name="name" type="tns:SomeType"/>
>>> and see in generated interface param with type of SomeType - enum  class
>>> generated from xsd
>>>
>>
>> I'm only aware of param/option
>> https://www.w3.org/Submission/wadl/#x3-280002.12.3
>>
>> being optionally used to generate an enum.
>> I guess SourceGenerator code does not enforce that a query param should
>> not refer to WADL grammar as opposed to having any specific support for it.
>>
>>
>>
>>> So i think if someone   finds  work enabling beand validtion annotations
>>> worth, i will gladly use this work also.
>>> But, again, param validation is not "deal breaker" for wadl2java
>>>
>>> As I said, doing a gigantic effort so that a query parameter can be bean
>> validated seems a bit overboard to me - I definitely have no time to do it.
>>
>> However, if SourceGenerator does allow refer to WADL grammar types - then
>> it means JAX-RS ParamConverterProvider needs to be available to create such
>> type at runtime. This generated JAXB bean will have bean validation
>> properties. ParamConverter will create a bean and then use
>> for ex CXF BeanValidationProvider to call its validateBean
>>
>> That should work ?
>>
>>
> As I know, only xsd:enumeration types are projected to custom class by
> default, all other simpleTypes projected to java.lang.String,
> hower, if we map some xsd type to java class, then i think this should
> work, but there is no such jaxb generator, to do such class generation
> automatically, so this is also gigantic effort :)
>
If the parameters can refer to the complex types (as opposed to simple 
types) then, with a BeanValidation aware JAXB plugin (the one linked to 
before), then a Java class with BeanVal annotations can be produced, 
this is what led to updating wadl-to-java adding @Valid annotations if 
"-beanValidation" option is set.
Am I missing something ?

Sergey




-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Mime
View raw message