swagger-api / swagger-api/swagger-codegen

[python]: swagger v3 fails to generate client

Open
#7,425 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Trying out the swagger v3 to generate a python client but i am hitting basic issue while executing codegen. Can someone please help?

Swagger-codegen version

java -jar swagger-codegen-cli-3.0.0-20180112.231857-20.jar version
3.0.0-SNAPSHOT

Swagger declaration file content or url

On first attempt i hit a missing .swagger-codegen-ignore file. Had never faced this issue with v2 so am not sure of the need of this file. I tried to just create a dummy ignore file but then i see missing swagger input of config even though i had the config file mentioned with -c option.

$ java -jar swagger-codegen-cli-3.0.0-20180112.231857-20.jar generate -i restapi-v3-3.yaml -DapiTests=false,apiDocs=false,modelTests=false,modelDocs=false -c config.json -l python -o v3-client1
usage: swagger-codegen generate [-h] [-v []] [-l] [-o] [-i] [-t] [-a] [-c] [-s] [--api-package] [--model-package] [--model-name-prefix] [--model-name-suffix] [--instantiation-types [ [ ...]]]
[--type-mappings [ [ ...]]] [--additional-properties [ [ ...]]] [--import-mappings [ [ ...]]] [--invoker-package] [--group-id] [--artifact-id] [--artifact-version]
[--library] [--git-user-id] [--git-repo-id] [--release-note] [--http-user-agent] [--reserved-words-mappings [ [ ...]]] [--ignore-file-override] [--remove-operation-id-prefix]
[-u]
swagger-codegen: error: unrecognized arguments: '-DapiTests=false,apiDocs=false,modelTests=false,modelDocs=false'

$ java -jar swagger-codegen-cli-3.0.0-20180112.231857-20.jar generate -i restapi-v3-3.yaml -c config.json -l python -o v3-client1
[Thread-1] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codegen-ignore file found.
Exception in thread "Thread-1" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:713)
at io.swagger.codegen.cmd.Generate.run(Generate.java:312)
at java.lang.Thread.run(Thread.java:745)

$ java -jar swagger-codegen-cli-3.0.0-20180112.231857-20.jar generate -i restapi-v3-3.yaml -c config.json -l python -o v3-client1
[Thread-1] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codegen-ignore file found.
Exception in thread "Thread-1" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:713)
at io.swagger.codegen.cmd.Generate.run(Generate.java:312)
at java.lang.Thread.run(Thread.java:745)

$ java -jar swagger-codegen-cli-3.0.0-20180112.231857-20.jar generate -i restapi-v3-3.yaml -c config.json -l python -o v3-client1
Exception in thread "Thread-1" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:713)
at io.swagger.codegen.cmd.Generate.run(Generate.java:312)
at java.lang.Thread.run(Thread.java:745)

$ cat config.json
{
"packageName" : "xyz",
"packageVersion" : "1.0.0"
}

Command line used for generation

see above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported command, restapi-v3-3.yaml, config.json, and the stack trace in io.swagger.codegen.cmd.Generate.run and io.swagger.codegen.DefaultGenerator.generate. Reproduce the missing swagger input or config error with the listed CLI invocation, then confirm that a Python client can be generated using the supplied files and options.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.