On 04/02/2015 14:49, Sergey Beryozkin wrote:
Hi Francesco,
Finally, not an issue but a praise for a WADL stylesheet shipped with
Syncope. I saw a recent presentation from Colm, and I thought, wow,
would it be great if CXF WADLGenerator could optionally reference such
a stylesheet via an XML processing instruction. In fact I've even
updated the generator to do it if it is configured with a reference to
a class path resource.
We've done in CXF some work for the optional Swagger integration and
Andriy Redko even did a demo. I think one of the reasons Swagger is so
popular because people can get UI auto-generated out of it.
Would it possible to get this style-sheet shipped in a self-contained
module? CXF users who need would add it to a classpath and then
configure CXF WADLGenerator with a class path reference to it...
Nice that you like our old-fashioned-technology XSLT :-)
When I built that I've also taken a look at Swagger, liked it but
had to
drop it out because of some heavy dependency (the Scala compiler).
I think WADL is very capable. I think Swagger is flying because it is
uses a JSON format (it is just more popular as opposed to more capable
than XML), has the option to add the extensions, and + UI.
WADL is more capable in describing REST services IMHO, the extensions
can be easily added, UI can be there. I'm not trying to say people have
to use WADL if they like Swagger :-), but WADL does deserve a bit more
'justice' I'd say, it was a very well designed spec from M.Hadley
If you want, and also provide some details and guidance about how to
fit
into there, I can contribute the XSL to a new CXF module and we can
have
also Syncope to depend on that. WDYT?
I'll try to create a CXF test with some basic copy/transform template
and then I'll share a link and we can discuss what might be done next
I prototyped some initial code where CXF WADLGenerator can be asked to
either add a processing instruction to a WADL DOM response or
transform it locally ([1], [2]).
I've seen your commits: the idea is to experiment with 3.0.4-SNAPSHOT,
right? (that would ease testing against Syncope, in case).
So the idea is that a developer would update WADLGenerator with a
template reference, and then the local or browser based transformation
will happen.
A template like the one at [3] is easy enough to use as it has no
extra parameters.
I've checked Syncope WADL templates, they are a bit more involved with
JQuery being used, etc, no wonder the result is so impressive :-)
I'm not sure if it really makes sense to try and do a browser-based
transformation with Syncope templates, the local one might do.
Agree: think that the transformation we currently do in Syncope [4] is a
Servlet depending on Cocoon 3.0 (which is not strictly necessary, in
this case).
Basically, the same WADL file is processed twice: for generating
index.html (via index.xsl) and for generating schema_X_Y.html (via
index.xsl) - where X is the position of the schema in the WADL file and
Y is the schema prefix.
With index.xsl links are generated to address references in the related
schema page.
This second aspect is particularly hard to implement with simple
browser-based transformation.
I'd like to experiment with the index.xsl first. It depends on JQuery
libraries being available at the web server. I think it is reasonable,
just a minor query here, can JQuery optionally tried first at CDN
first and if it is a local network only then do try a local web server ?
I'd say that we should give the opportunity to specify:
* a local CSS (currently index.xsl embeds something very basic)
* CDN or local references to jQuery / HighlightJS
The other question is what is the relationship between index.xsl and
schema.xsl. Can index.html import schema.xsl in principle ? Can using
index.xsl only would turn WADL to HTML ?
As explained above, index.xsl generates links to HTML pages that are
supposed to be generated via schema.xsl; this can be turned off,
naturally, but would result in a significant feature drop, to me.
I guess it makes sense to see if this model (configuring CXF
WADLGenerator with a reference to Syncope index.xsl only) works -
either with a local or in-browser transform.
Agree: how are you thinking to organize such PoC? Do you want me to
contribute / review something in particular?
Is there any issue at CXF for this?
Regards.
[1] http://git-wip-us.apache.org/repos/asf/cxf/commit/28379a02
[2] http://git-wip-us.apache.org/repos/asf/cxf/commit/ad8e4ddf
[3] https://github.com/ipcsystems/wadl-stylesheet/blob/master/wadl.xsl
[4]
https://github.com/apache/syncope/blob/1_2_X/core/src/main/java/org/apache/syncope/core/rest/WADLServlet.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/