<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Can we use Swagger in Ivy Project?</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project</link><description>&lt;p&gt;Hi all&lt;/p&gt;
&lt;p&gt;Now i'm using Axon ivy 6.3. In my project, i have created an Restful API following the &lt;a href="https://swagger.io/docs/specification/about/"&gt;OpenAPI Specification&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now i want to use Swagger to generate YAML file from those API (follow this &lt;a href="https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5"&gt;guideline&lt;/a&gt; and this &lt;a href="https://stackoverflow.com/questions/34340330/generate-yaml-or-json-file-from-swagger-documentation"&gt;post&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;Here is my web.xml
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/Untitled_uG151Fy.png"&gt;&lt;/p&gt;
&lt;p&gt;and this is my Servlet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public class ApiScanner extends HttpServlet {
    private static final long serialVersionUID = -4192689550210212169L;

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);

        BeanConfig beanConfig = new BeanConfig();
        beanConfig.setVersion("1.0.0");
        beanConfig.setSchemes(new String[]{"http"});
        beanConfig.setHost("localhost:8081");
        beanConfig.setBasePath("/ivy/api/designer");
        beanConfig.setResourcePackage("ch.axonivy.fintech.mybank.website.dossier.api");
        beanConfig.setScan(true);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But nothing happen after i restart ivy. 
Has anybody tried it before?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 25 Jun 2019 09:47:08 -0400</lastBuildDate><item><title>Comment by peters on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#3866</link><description>&lt;p&gt;Is there also a way to retrieve the WADL for all resources at once, eg &lt;a href="http://localhost:9998/application.wadl?detail=true"&gt;http://localhost:9998/application.wadl?detail=true&lt;/a&gt; (like described in &lt;a href="https://jersey.github.io/documentation/latest/wadl.html)?"&gt;https://jersey.github.io/documentation/latest/wadl.html)?&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">peters</dc:creator><pubDate>Tue, 25 Jun 2019 09:47:08 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#3866</guid></item><item><title>Answer by trungdv</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project/3441</link><description>&lt;p&gt;I found solution here
&lt;a href="https://discourse.axonivy.io/t/how-to-apply-swagger-to-ivy-project/607"&gt;https://discourse.axonivy.io/t/how-to-apply-swagger-to-ivy-project/607&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Mon, 24 Sep 2018 23:09:50 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project/3441</guid></item><item><title>Comment by trungdv on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2897</link><description>&lt;p&gt;hi &lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;&lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;@Reguel&lt;/a&gt;&lt;/a&gt; Werme... ♦♦
i've sent you the pom file via email. Now i'm quite busy and the sharing still on queue :(. Sorry for that&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Tue, 03 Oct 2017 03:37:53 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2897</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2893</link><description>&lt;p&gt;&lt;a href="https://answers.axonivy.com/users/118/trungdv"&gt;&lt;a href="https://answers.axonivy.com/users/118/trungdv"&gt;@trungdv&lt;/a&gt;&lt;/a&gt; if you don't find the time to create the demo feel free to send my a link to the POM on your SCM so that I can build the demo on my own. but do it privateby mail   reguel[DOT]wermelinger[AT]axonivy[DOT]com&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 28 Sep 2017 03:45:45 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2893</guid></item><item><title>Comment by trungdv on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2859</link><description>&lt;p&gt;hi &lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;&lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;@Reguel&lt;/a&gt;&lt;/a&gt; Werme... ♦♦
yes, i'm gonna share this. i will send you link later. it work on my project now&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Fri, 08 Sep 2017 07:25:16 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2859</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2854</link><description>&lt;p&gt;If your setup works, even if just partly, I'd really love to see you sharing a complete example project. 
It would also give us in the core team an idea how we could better support or demonstrate the use of swagger out of the box.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 07 Sep 2017 03:10:39 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2854</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2853</link><description>&lt;p&gt;yes the ivy artifacts are not available with plain maven. because they are p2 bundles and there is no public maven repository that contains them. There are various workaround for it. You could for instance add them manually as POM.xml dependencies with scope 'system'. But that only could if you require just a few bundles - and not the whole engine.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 07 Sep 2017 03:09:03 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2853</guid></item><item><title>Comment by trungdv on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2851</link><description>&lt;p&gt;hi &lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;&lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;@Reguel&lt;/a&gt;&lt;/a&gt; Werme... ♦♦
yes i can make &lt;a href="https://github.com/kongchen/swagger-maven-plugin"&gt;it&lt;/a&gt; work  within ivy now.  It's because after ivy compile, all *.java will be put to &amp;lt;project&amp;gt;/classes, instead of &amp;lt;project&amp;gt;/target/classes. So what i have to do is copy it to rightplace and plugin can run. But somehow it's can't resolve dependency of icy modals. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Wed, 06 Sep 2017 03:41:08 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2851</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2849</link><description>&lt;p&gt;yep that is the current state. there are no details available how a complex payload (like the person) looks like. and I agree that a swagger service descriptor would be much more state of the art. but WADL is what we have now by default without any effort. 
But I'm pretty certain that it would be possible to configure the swagger maven plugin to do the job.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 05 Sep 2017 09:33:54 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2849</guid></item><item><title>Comment by trungdv on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2848</link><description>&lt;p&gt;hi &lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;&lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;@Reguel&lt;/a&gt;&lt;/a&gt; Werme... ♦♦
Thanks for your support, i can use WADL but somehow the specification from there it's not very in detail like Swagger can do. It just give me the overview of API but lack of data type for complex object, description of field,...Like in your example, i don't see how many field in object person. but swagger i can see it. Or i miss something?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Tue, 05 Sep 2017 05:23:35 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2848</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2847</link><description>&lt;p&gt;The trick is to send the correct accept media type. Postman implicitly sends accept(*) so that WADL is accepted as response. You can explicitly do that like this:  &lt;code&gt;Ivy.rest().client("myService").request().accept("application/vnd.sun.wadl+xml").options();&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 05 Sep 2017 04:19:16 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2847</guid></item><item><title>Comment by trungdv on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2846</link><description>&lt;p&gt;hi &lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;&lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;@Reguel&lt;/a&gt;&lt;/a&gt; Werme... ♦♦&lt;/p&gt;
&lt;p&gt;With second way, can i get WADL from webservice by URL (not use postman)? I've tried some example but it can work with ivy rest api.
thanks&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Tue, 05 Sep 2017 04:16:24 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2846</guid></item><item><title>Comment by trungdv on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2845</link><description>&lt;p&gt;hi &lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;&lt;a href="https://answers.axonivy.com/users/17/reguel-wermelinger"&gt;@Reguel&lt;/a&gt;&lt;/a&gt; Werme... ♦♦&lt;/p&gt;
&lt;p&gt;I've tried with maven plugon but it does not work. still got no clue.
May by i'll try with WSDL. 
Thanks a lot&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">trungdv</dc:creator><pubDate>Mon, 04 Sep 2017 23:41:30 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2845</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2844</link><description>&lt;p&gt;An alternative approach to document REST services, that work out of the box with Axon.ivy, is the WADL descriptor. Every resource can send an XML similiar to WSDL if you fire an 'OPTIONS' request against it. Here is a sample from our ConnectivityDemos:&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/restWadlDescriptor.png"&gt;&lt;/p&gt;
&lt;p&gt;Maybe you could convert the WADL automatically into a Swagger2 descriptor: &lt;a href="https://github.com/LucyBot-Inc/api-spec-converter"&gt;https://github.com/LucyBot-Inc/api-spec-converter&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Mon, 04 Sep 2017 03:50:35 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2844</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2843</link><description>&lt;p&gt;I think approaches that rely on classpath scanning will never work out of the box with ivyProjects. As the class hierarchy is not accessible as in standard webApplication-contexts.&lt;/p&gt;
&lt;p&gt;But I think you could reach your goal if you generate the swagger resources with the maven plugin: &lt;a href="https://github.com/kongchen/swagger-maven-plugin"&gt;https://github.com/kongchen/swagger-maven-plugin&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Mon, 04 Sep 2017 03:49:08 -0400</pubDate><guid>https://answers.axonivy.com/questions/2842/can-we-use-swagger-in-ivy-project#2843</guid></item></channel></rss>