springdoc / springdoc-openapi-maven-plugin

Library for OpenAPI 3 with spring-boot
https://springdoc.org
Apache License 2.0
141 stars 37 forks source link

Multiple Output directories #7

Closed randyhbh closed 4 years ago

randyhbh commented 4 years ago

Hi @bnasslahsen, I would like to create a PR for this repo in which I will be including the availability to generate the openapi.json to one, two, or more output directories.

Please could you point me to the guidelines for contributing to this project?

Thanks

bnasslahsen commented 4 years ago

Hi @RandyHBH,

The contribution guidelines are available here:

patpatpat123 commented 4 years ago

Hello @RandyHBH

Thank you for this initiative. Our team is having the same requirement. We just want to have two outputs, (one is a directory under target that will be generated and one in a dedicated folder for history tracking). Could you please show some example on how to do this?

Maybe some kind of comma separated? /../../docs/openapi3,${project.build.directory}

Thank you for your help

randyhbh commented 4 years ago

Hi @patpatpat123, sure I could re-open this PR or create a new one with these changes if this is a useful feature for the community. The reason why I closed it in the first place was that usually, this is is a rare use case.

@bnasslahsen What do you think?

bnasslahsen commented 4 years ago

@RandyHBH,

You can propose a PR ofc, if its useful for the community.

patpatpat123 commented 4 years ago

Many thanks @RandyHBH @bnasslahsen, looking forward to seeing this!

anthropaedic commented 4 years ago

@patpatpat123 @RandyHBH @bnasslahsen

Instead of comma separated values wouldn't we want something like this?

<configuration>
    <outputFileName>myapi.json</outputFileName>
    <outputDirs>
        <outputDir>${project.build.directory}</outputDir>
        <outputDir>${project.build.directory}/testDir</outputDir>
    </outputDirs>
</configuration>
bnasslahsen commented 4 years ago

@anthropaedic,

You can just use maven-antrun-plugin after springdoc-openapi-maven-plugin, to copy the generated resources in your desired output directories.

patpatpat123 commented 4 years ago

@bnasslahsen @anthropaedic Would it be possible not to close?

<configuration>
    <outputFileName>myapi.json</outputFileName>
    <outputDirs>
        <outputDir>${project.build.directory}</outputDir>
        <outputDir>${project.build.directory}/testDir</outputDir>
    </outputDirs>
</configuration>

This looks very clean, instead of having to "just use maven-antrun-plugin after springdoc-openapi-maven-plugin"

patpatpat123 commented 4 years ago

@bnasslahsen But it is achieving it in a rather unfriendly manner.

"maven-antrun-plugin after springdoc-openapi-maven-plugin", Well, I also have a shell job that does a CP command, "it does the job" (and faster than ant) Would it be possible to have a more objective judgement on your close? While it is true there are many ways to achieve the same result, having more descriptive, self explanatory, proper configuration directly on the maven plugin block without extra steps during or after generation might be worth considering.

Thank you

bnasslahsen commented 4 years ago

@patpatpat123 ,

The maven-antrun-plugin exists for decades and is very stable. Not sure you will find a much cleaner that it. But for the moment, it doesn't seem relevant, to keep track of this ticket for several months, especially that there are other existing solutions for this kind of functionalities.

Anyway, if you come up with a much cleaner solution, please feel free to propose a PR, and the ticket can be reopened.

patpatpat123 commented 4 years ago

@bnasslahsen Still believe (personal opinion)

<outputDirs>
        <outputDir>${project.build.directory}</outputDir>
        <outputDir>${project.build.directory}/testDir</outputDir>
    </outputDirs>

is a bit nicer. But maybe you and I shouldn't take the whole decision.

Meanwhile, I will stick with the shell cp command, much older than ant and "does the job" that can be done from the plugin.