swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.8k stars 6.02k forks source link

Java Client Generator ignores 'sourceFolder' option #1917

Open kungfoo opened 8 years ago

kungfoo commented 8 years ago

I just started using 2.1.6-SNAPSHOT in one project and it seems that the java client generator ignores the sourceFolder option in config.json.

It simply generates the files into the current dir.

Config to reproduce:

{
        "library": "jersey2",
        "sourceFolder" : "src/generated/java",
        "apiPackage":"ch.sample.snap.api",
        "modelPackage":"ch.sample.snap.model",
        "invokerPackage":"ch.sample.snap.api.invoker"
}

I then go on to compile the source in src/generated/java using a customized gradle build (not the one generated).

kungfoo commented 8 years ago

If this is intentional, it should probably be mentioned in the README that this option was dropped and replaced with -o outputFolder for all generators.

kungfoo commented 8 years ago

At least the config help of the java generator still claims that sourceFolder is in fact an option:

CONFIG OPTIONS
(...)
    sourceFolder
        source folder for generated code
fehguy commented 8 years ago

I believe source folder and output folder have different intentions. outputFolder should be the root for all output files. sourceFolder should be where, inside the outputFolder, the generated files go. Is that what you're saying doesn't work correctly?

kungfoo commented 8 years ago

To me it seems as if the srouceFolder option is simply ignored and only the -o option has an effect. I will try to do a minimal sample project that shows this.