Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for war files #21

Closed
anders4work opened this issue Nov 29, 2021 · 7 comments
Closed

Add support for war files #21

anders4work opened this issue Nov 29, 2021 · 7 comments
Labels

Comments

@anders4work
Copy link

Hi,

thanks for a great plugin!

In my case I have the need to use it for a war file. It currently isn't working and I suspect it is because the swagger-brake project is hardcodet to search for a jar file.

See line 42 of https://github.com/redskap/swagger-brake/blob/176a43475b85b7ceff28c253168fb5a600baa685/swagger-brake/src/main/java/io/redskap/swagger/brake/maven/maven2/Maven2UrlFactory.java

I would like to suggest that the packaging type is made optional and that the change is propagated to this project as a configurable option.

Best,
Anders

@galovics
Copy link
Member

Hi @anders4work,

Sure thing, we can fix anything. :))

Before jumping into coding, do you might sharing your workflow? I just wanna make sure the right thing gets implemented.

@anders4work
Copy link
Author

anders4work commented Nov 30, 2021

Yes, of course.

I am creating a meta-plugin that tries to simplify everything swagger related.
Adding the plugin to a server application will:

  1. generate a swagger.json file compile time
  2. generate a jax-rs annotated class for exposing the swagger.json
  3. test for breaking changes (by calling your plugin programmatically from my meta-plugin)
  4. generate various swagger-ui files and endpoints
  5. generate and deploy (to binary repo) a (java)-client for the server.

It is a meta plugin so a lot of the heavy lifting of each step is done by programmatically calling a plugin capable of handling the given step. I am currently working on step 3 - and my reference project (for which I would like to use my meta-plugin) happens to be packaged as a war file. So it is a WAR file with a swagger.json file in it.

Best, Anders
PS: Strictly speaking it is not necessary to add any configurable option in the plugin for this, since the swagger-brake-maven-plugin could just inspect the pom file to find out if the packaging is war or jar and then feed that information to a refactored version of the swagger-brake project. I haven't tested it, but I would guess that the following command would give you the information needed:
String packaging = project.getPackaging();
(where project is an instance of org.apache.maven.project.MavenProject)

@anders4work
Copy link
Author

Do you need more info from me?
Best, Anders

@galovics
Copy link
Member

galovics commented Dec 6, 2021

Hi @anders4work,

Thanks, that'll be enough to start playing with it.

I'll try to do my best and implement it during the week.

Best,
Arnold

@galovics
Copy link
Member

galovics commented Dec 9, 2021

Hi @anders4work.
I've just released version 2.3.0. Give it a try, looks good to me.

Let me know if you have any issues with it.

@anders4work
Copy link
Author

Works great, thanks a lot!

@galovics
Copy link
Member

@anders4work awesome. Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants