Import swagger into an existing project in Android Studio

Hello, I want to add the created swagger zip to my project with Android gradle projector in Android studio. What is the best way to constantly import it every time the swagger file changes?

Now i am doing

mvn package 

in the unpacked directory from the swagger user interface generator, then I copy the mvn-generated jar to libs in the android project. I also copied the dependencies from the generated gradle file.

I am sure that someone knows a more elegant way to deal with swagger in Android studio.

Thanks for any help.

+5
source share
2 answers

You have several options. The easiest way is to copy the files from the downloaded client to your project and add the dependencies from the pom.xml or gradle assembly file that are generated when using the java target in the online codec. >

+1
source

My solution was to create a gradle module for loading, unpacking and placing swagger files in my project.

I created an example on github :

All you have to do is add a URL for your swagger and possibly change the path. I just posted it as an example and did not test whether it will work in different applications, so I'm not 100% sure to drag it.

+2
source

Source: https://habr.com/ru/post/1240088/


All Articles