I have a swagger.yaml and just installed the swagger-codegen on my Mac. I want to generate a Node.js server including the models described in the swagger.yaml from the command line. I tried:
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i swagger.yaml -l nodejs -o export/nodejs -Dmodels
and
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i swagger.yaml -l nodejs -o export/nodejs -Dmodels -DsupportingFiles
But the output is always the same WITHOUT the models:
What is wrong?
As opposed to previous versions of swagger-node (fka swagger-node-express), the swagger definition is used as the source of truth. There is no model file generated for each model in the application. So the -Dmodels will have no effect.
You can generate the response payload and send it back, and even configure the framework to validate that it follows the definition.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.