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, 25 Aug 2016 11:55:25 GMT
Linking schema elements to non representation parameters is not going to 
work for sure.
It overloads the idea that the schema elements represent the in/out 
payloads.

Adding @Valid to method returning the payload beans or to a method 
parameter representing the in payload may be reasonable if a JAXB 
compiler can be made to generate Bean Val validations inside the 
generated bean classes - I'll have a look at adding a switch.

Sergey

On 25/08/16 12:38, Vjacheslav V. Borisov wrote:
> 2016-08-24 21:56 GMT+04:00 J. Fiala <modsec@fwd.at>:
>
>> Sergey,
>>
>> Exactly, this plugin provides the beanvalidation annotations for
>> complextypes at the client + server side, making BeanValidation possible on
>> both sides.
>>
>> What is missing so far:
>>
>> 1.) Necessary: Add a switch to wadl2java to allow adding @Valid to the
>> method + parameters for generated methods, to enable automatic validation
>>
>> 2.) Nice to have: Add BeanValidation annotation support to
>> wadl2java/SourceGenerator.java for the query parameters
>> These are currently not covered by the krasa-jaxb-tools, as they seem to
>> be handled completely separate from the JAXB processing.
>> see  https://github.com/apache/cxf/pull/146/files, SourceGenerator.java
>> where I added @NotNull support;
>> Adding support for the others would require access to the complextypes of
>> the schema.
>> If you give me a hint how to access these effectively I can add the other
>> ones as well.
>>
>> However, I'll try the schema validation approach as well, but I think it
>> would be nice to have both options available and leave it up to the
>> developer.
>>
>>
> about 2) , it would be great, if, in example we have
> <param name="uid" type="core:UUIDType" style="template">
>
> (
> https://github.com/ilb/jparestresource/blob/master/jparestresource-api/src/main/resources/schemas/jparestresource/jparestresource.wadl
> )
>
> where  core:UUIDType is
>     <xsd:simpleType name="UUIDType">
>         <xsd:annotation>
>             <xsd:documentation>Universally Unique
> Identifier</xsd:documentation>
>         </xsd:annotation>
>         <xsd:restriction base="xsd:string">
>             <xsd:length value="36"/>
>             <xsd:pattern
> value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
>         </xsd:restriction>
>     </xsd:simpleType>
>
> Then annotations like
> @Valid
> @Size(min = 36,max = 36)
> @NotNull
> @Pattern(regexp = "
> [\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}")
>
> would be generated on param in interface method
>


-- 
Sergey Beryozkin

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

Mime
View raw message