On 04/02/2016 14:05, Vjacheslav V. Borisov wrote:
Hi
Thanks for you work and examples!
I am looking at
https://github.com/apache/syncope/blob/master/ext/swagger-ui/pom.xml
At
<id>copy-swagger-resources-in-place</id>
You are copying resources to
<outputDirectory>${project.build.directory}/classes/META-INF/resources/swagger</outputDirectory>
But how do you made static resources located in classes/META-INF availiable
from web ?
http://syncopecore2-tirasa.rhcloud.com/swagger/ ?
First of all, consider that we're doing so because we need to extend the
default Swagger UI features with matrix parameter support and Basic
Authentication, which are not provided OOTB.
About the logic of such pom.xml:
* [1] will unpack the vanilla Swagger UI artifacts
* [2] will copy the unpacked directory under
${project.build.directory}/classes/META-INF/resources/swagger, skipping
index.html and swagger-ui.min.js
* [3] will patch the standard swagger-ui.js and add matrix parameter
support
* index.html is instead picked up from [4]
As a result, we will end up having, in
${project.build.directory}/classes/META-INF/resources/swagger
all the files in place ready to be packaged again.
The "magic" that allows accessing such resources via HTTP under /swagger
is simply because it gets treated as Servlet Fragment.
HTH
Regards.
2016-01-21 16:28 GMT+04:00 Francesco Chicchiriccò <[email protected]>:
On 21/01/2016 13:13, Sergey Beryozkin wrote:
Hi
wadl-to-java generates a Java code and optionally converts WADL docs into
JavaDocs too - and with the latest improvements to the feature done by
Francesco the source (+ docs) will be converted into Swagger JSON, without
necessarily adding Swagger annotations...
As a side note, if the only reason you'd like to do Swagger is to get
some UI then note WADLGenerator can be configured with and XSLT source
reference, an XSLT conversion (like the one done in Syncope :-)) can make a
great difference :-)
FYI, this is the result of such XSLT transformation, starting from the
CXF-generated, Javadocs-enabled, WADL
http://syncope.apache.org/rest/2.0/index.html
and this is the Swagger obtained from the same source, generated by
Swagger2Feature:
http://syncopecore2-tirasa.rhcloud.com/swagger/
[1]
https://github.com/apache/syncope/blob/master/ext/swagger-ui/pom.xml#L63-L87
[2]
https://github.com/apache/syncope/blob/master/ext/swagger-ui/pom.xml#L89-L114
[3]
https://github.com/apache/syncope/blob/master/ext/swagger-ui/pom.xml#L116-L134
[4]
https://github.com/apache/syncope/blob/master/ext/swagger-ui/src/main/resources/META-INF/resources/swagger/index.html
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC, CXF committer
http://home.apache.org/~ilgrosso/