Hi

Can you explain please what exactly the purpose of it can be ?
WADL generator simply reports the model info by using a JAXB compiler to generate XML schema, I'm trying to figure out how does the bean validation can help here or what it can change

Sergey
On 17/08/16 18:18, J. Fiala wrote:
I added this PR for bean-validation-support for query parameters:
https://github.com/apache/cxf/pull/146

This also adds the required-flag for params by supporting @NotNull (see
related question here:
http://stackoverflow.com/questions/13968261/required-queryparam-in-jax-rs-and-what-to-do-in-their-absence).


Additionally the PR adds support for @Size, @Min/@Max and @Pattern to
the query parameters and will add the proper restrictions inline:

* @NotNull - minOccurs="1"

* @Size - "<xs:minLengthvalue = " + size.min() + "/>",
"<xs:maxLengthvalue = " + size.max() + "/>"

* @Min - "<xs:minInclusive value = " + min.value() + "/>"

* @Min - "<xs:maxInclusive value = " + max.value() + "/>"

* @Pattern - <xs:pattern value=" + pattern.regexp() + " />"

For adding bean-validation-support to the complex types the JAXB
processing / schema has to be parsed/filtered.

The Java to schema mappings seems to be done here in WadlGenerator.java,
line 1541:
 for (DOMResult r : JAXBUtils.generateJaxbSchemas(context,
CastUtils.cast(Collections.emptyMap(),
String.class,
DOMResult.class))) {

Am I correct in assuming we need a JAXB adapter which picks up the
beanvalidation-annotations?
https://docs.oracle.com/cd/E19316-01/819-3669/bnbdf/index.html

So it seems we need to prepare the proper XmlAdapters
(https://docs.oracle.com/javase/7/docs/api/javax/xml/bind/annotation/adapters/XmlAdapter.html)
to generate the necessary restrictions in the schema.

However, it would also be nice to also add proper SimpleTypes and
reference them from the complexTypes (e.g. simpleType string_50 for a
string with a maximum of 50).

Best regards,

Johannes




--
Sergey Beryozkin

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

Reply via email to