我试图在命令提示符下执行此命令,为python生成代码:
java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar \
generate \
-i http://localhost/test/swagger-docs/api-docs.json \
-l python -o c:\temp\python_testapi_client
它向我显示了这个错误:
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:89)
at io.swagger.codegen.cmd.Generate.run(Generate.java:223)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
当我在浏览器中打开此文件时,它包含:
{
"swaggerVersion": "1.2",
"apis": [{
"path": "\/v1-machinetags",
"description": "Deletes machine tags by they titles."
}, {
"path": "\/v1-photos",
"description": "Uploads photo with tags."
}, {
"path": "\/v1-photos-bymachinetags",
"description": "List of photos with possibility filtering by Machine tags."
}, {
"path": "\/v1-photos-bytags",
"description": "List of photos with possibility filtering by tags."
}, {
"path": "\/v1-photos-user-bymachinetags",
"description": "List of photos of a specific user with possibility filtering by machine tags."
}, {
"path": "\/v1-photos-user-bytags",
"description": "List of photos of a specific user with possibility filtering by tags."
}, {
"path": "\/v1-photos",
"description": "Deletes photo."
}, {
"path": "\/v1-photos-machinetags",
"description": "Associate photo with machine tags."
}, {
"path": "\/v1-photos-tags",
"description": "Associate photo with tags."
}, {
"path": "\/v1-resources",
"description": "Add a new RDF resource ."
}, {
"path": "\/v1-tags",
"description": "Deletes tags by they titles."
}, {
"path": "\/v1-triplets",
"description": "Get All triplets."
}, {
"path": "\/v1-triplets-bylanguages",
"description": "Get Resources by a given language."
}, {
"path": "\/v1-triplets-bytypes",
"description": "Get Resources by a given type."
}],
"apiVersion": "0.1",
"info": {
"title": "Symfony2",
"description": "My awesome Symfony2 app!",
"TermsOfServiceUrl": null,
"contact": null,
"license": null,
"licenseUrl": null
},
"authorizations": []
}