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

readme.md doesn't agree with usage: -D either is or is not an allowed option #1828

Closed
leemeador opened this issue Jan 6, 2016 · 7 comments
Closed
Milestone

Comments

@leemeador
Copy link

Github is showing README.md on its main page. On that page in the SYNOPSIS section and OPTIONS below, it says I can use -D as an option. Further down the page it indicates properties (like the Java "models" option) can be set with -D.

I try it by using the following gradle task:

task genSwagger(type: JavaExec) {
    description "generate swagger doc or clients via codgen package and gradle"
    // has buildscript dependency  classpath "io:swagger-codegen:2.1.5"
    classpath = buildscript.configurations.classpath
    args  = ["generate",
             "-i", "http://localhost:25630/v1/mystuff/api-docs",
             "-o", "${buildDir}/docs/rest-api",
             "-l", "jaxrs",
            "-D", "models"
            ]
    main      = "io.swagger.codegen.Codegen"
}

and I get "usage" that does not show -D as an option. It does not say that -D is the offense causing usage to be shown but removing the -D actually generates .java files.

usage: Codegen
 -a,--auth <arg>           adds authorization headers when fetching the
                           swagger definitions remotely. Pass in a
                           URL-encoded string of name:header with a comma
                           separating multiple values
 -c,--config <arg>         location of the configuration file
 -d,--debug-info           prints additional info for debugging
 -h,--help                 shows this message
 -i,--input-spec <arg>     location of the swagger spec, as URL or file
 -l,--lang <arg>           client language to generate.
                           Available languages include:
                           [android, async-scala, csharp, dart, flash,
                           python-flask, java, javascript, jaxrs,
                           inflector, jmeter, nodejs, objc, perl, php,
                           python, qt5cpp, ruby, scala, scalatra,
                           silex-PHP, sinatra, slim, spring-mvc,
                           dynamic-html, html, swagger, swagger-yaml,
                           swift, tizen, typescript-angular,
                           typescript-node, akka-scala, CsharpDotNet2,
                           clojure]
 -o,--output <arg>         where to write the generated files
 -t,--template-dir <arg>   folder containing the template files

Version 2.1.5, 2.1.4

@fehguy
Copy link
Contributor

fehguy commented Jan 6, 2016

Try -Dmodels not -D models

@leemeador
Copy link
Author

Thank you fehguy for the suggestion. I will try that.

The issue I was trying to report is that the Github docs don't match what "usage" shows. A reasonable fix would have both show the same option list for "generate"

Perhaps there is another issue here in that Github looks like there is a space after the -D but you seem to be saying that is incorrect as well

@leemeador
Copy link
Author

This does not work either (though I tried it with 2.1.5 instead of 2.1.2) so leaving the space out isn't a way for me to get the output I want.

args  = ["generate",
         "-i", "http://localhost:25630/v1/mystuff/api-docs",
         "-o", "${projectDir}/",
         "-l", "java", "-Dmodels"
        ]

The result is the same "usage" message as in the original issue report.

@fehguy
Copy link
Contributor

fehguy commented Jan 7, 2016

OK from this command:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
   -i http://petstore.swagger.io/v2/swagger.json \
   -o foo \
   -l java \
   -Dmodels

It does appear that the empty -Dmodels does not generate "all models". It does work by specifying the models you want to generate specifically like -Dmodels=Pet,Order. So there's a bug here.

@wing328 wing328 added this to the v2.1.6 milestone Jan 8, 2016
@wing328
Copy link
Contributor

wing328 commented Jan 8, 2016

When I'm trying to fix this bug and tested with -Dmodels=Pet,Order. Only the model Pet is generated. I tested with -Dmodels="Pet,Order" but got the same result. It seems like everything after , is omitted. Am I the only one having this issue?

@wing328
Copy link
Contributor

wing328 commented Jan 28, 2016

@leemeador you need to add -Dmodels to the 1st command line argument like this:

java -Dmodels -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
   -i modules/swagger-codegen/src/test/resources/2_0/petstore.json \
   -l csharp \
   -o /var/tmp/csharp/assembly/

@wing328
Copy link
Contributor

wing328 commented Feb 4, 2016

@leemeador closing this as there's no update.

@wing328 wing328 closed this as completed Feb 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants