syncope-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: [PROPOSAL] Get rid of JAXB
Date Tue, 05 Jul 2016 12:25:54 GMT
Hi Francesco

Here are some thoughts/comments.

The question is and I guess this is something the team will need to 
decide upon is how important having a WADL representation for Syncope 
is. Having WADL without a schema is probably not worth it - the UI View 
is incomplete as a result and if someone tries to generate a client from 
this WADL it won't work either. But then if no-one is working with WADL 
on the client or really depending on Syncope WADL UI View then may be it 
is a feature that can be let go easily enough.

So, suppose you have decided to let it go.

Then it all looks nice, indeed, having a uniform set of annotations is 
advantageous.

But the absence of a schema can be a bit problematic if the 
interoperability with the non Java XML clients is required. May be 
everyone uses Syncope clients, but if not, then without a schema it can 
be tricky for such clients to get the beans generated, etc. Perhaps it 
is not going to be a problem because as far as I know only WADL has a 
schema and I'm not sure if anyone in the Syncope community has ever 
tried this schema to get the non-Java POJOs generated.

By the way, I believe you may be able to use JAXB without the 
annotations, with the help of JAXBElement. Perhaps might be worth doing 
a quick try with Moxy JAXB - it might be able to deal better with some 
of the JAXB issues.

So I suppose if you are happy with Jackson XML and dropping WADL is 
acceptable then do give it a try :-) You can always revert back to JAXB 
without affecting the clients too much.

Oh yes, re WADL and manually supporting the schemas. May be it can be 
somehow done such that if a new property is added to one of the Syncope 
POJOs then a 'red flag' is raised at the build time if the schema 
document has not been synced. That would solve the issue of maintaining 
the schema without depending on JAXB all the time, but it is porbably 
impossible to implement

Thanks, Sergey

On 05/07/16 11:02, Francesco Chicchiriccò wrote:
> Hi all,
> Syncope core is currently enabled with REST services which are available
> to work with both JSON and XML payloads; JSON support is provided via
> Jackson, XML via JAXB.
>
> The recent SYNCOPE-884 brought again to my attention how difficult is to
> keep supporting both formats, especially considering that often JAXB
> does not provide anything special out-of-the-box (take the fix for
> SYNCOPE-884 [1] as an example of such troubles).
>
> Hence, I went forward and provided a feature branch [2] where JAXB is
> compltely removed and XML payloads are instead managed via Jackson [3].
> At present all tests are running fine, both with application/json and
> application/xml and the Swagger UI extension is working as well.
>
> The benefits to me are: (1) manageability (no need to maintain two
> different sets of annotations) and possibly (2) performance - even
> though I realize that probably the vast majority is using application/json.
>
> The only problem I can see, instead, is related to WADL: CXF's generator
> relies on JAXB for providing the <grammars> section, so currently no
> grammar is available and, as a consequence, there are no links to
> payload objects definition in the REST services documentation, as
> instead shown at [4].
> To given an idea, when you go to [4], click on "numbers", then "GET
> (numbers)", you will see a modal window with a table under "Response"
> which shows a "syncope1:numbersInfo" link, bringing to the XSD reference
> of such object.
> In [2], no link is shown.
>
> There is the possibility of passing an existing XSD file to the WADL
> generator, but then the problem of generating such XSD file via Jackson
> arises, which is something I couldn't find a way to.
>
> Questions:
>
> 1. how do you see this feature (e.g. removing JAXB) in general?
> 2. do you think that missing XSD from WADL is grave, considering that
>     Swagger provides much more and is still working fine?
> 3. any clever idea about pre-generating the XSD file from a bunch of
>     Jackson-annotated POJOs?
>
> Regards.
>
> [1] https://git-wip-us.apache.org/repos/asf?p=syncope.git;h=4f6818b
> [2]
> https://git-wip-us.apache.org/repos/asf?p=syncope.git;a=tree;h=refs/heads/2_0_NO_JAXB
>
> [3] https://github.com/FasterXML/jackson-dataformat-xml
> [4] http://syncope.apache.org/rest/2.0/index.html
>


-- 
Sergey Beryozkin

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

Mime
View raw message