git clone https://github.com/networknt/light-codegen.git mvn package -DskipTests -f light-codegen/pom.xml git clone https://github.com/networknt/model-config.git java -jar light-codegen/codegen-cli/target/codegen-cli.jar -f openapi -o petstore -m model-config/rest/openapi/petstore/1.0.0/openapi.json -c model-config/rest/openapi/petstore/1.0.0/config.json cd petstore # 生成的项目为petstore mvn package dependency:copy-dependencies -DskipTests -DoutputDirectory=target mvn exec:exec # netstat -ano|findstr 8443,taskkill -pid {pid} -f curl --insecure https://127.0.0.1:8443/v1/pets git clone https://github.com/networknt/light-example-4j # 也可以从示例项目开始
java -jar light-codegen/codegen-cli/target/codegen-cli.jar --config,-c:配置文件,指定groupId、httpPort、supportDb等 --framework,-f:框架,openapi、swagger、openapi-spec、openapikotlin、light-graphql-4j等 --model,-m:模型文件,支持json、yaml格式 --output,-o:输出目录,官方示例为-o light-example-4j/rest/openapi/petstore
初始生成项目时需要熟悉OpenAPI规范,建议从light-example-4j添加需要的特性。