我试图从提供的示例 petstore openapi.json 生成项目。我使用light-codegen来生成端点和模型。
我确实安装了 light-codegen:
git clone https://github.com/networknt/light-codegen.git
cd light-codegen
mvn clean install
然后我从我的项目文件夹中运行 codegen:
java -jar ../../networknt/light-codegen/codegen-cli/target/codegen-cli.jar -f openapi -o /tmp/petstore -m openapi.json -c config.json
我在输出中看到以下错误:
openapi openapi.json config.json /tmp/petstore
19:16:00.766 [main] INFO com.networknt.config.Config - daily config cache refresh
19:16:00.772 [main] INFO com.networknt.config.Config - Unable to load config from externalized folder for service.yml in
19:16:00.772 [main] INFO com.networknt.config.Config - Trying to load config from classpath directory for file service.yml
19:16:00.774 [main] INFO com.networknt.config.Config - Config loaded from default folder for service.yml
19:16:04.799 [main] INFO com.fizzed.rocker.runtime.RockerRuntime - Rocker version 0.22.0
19:16:04.801 [main] INFO com.fizzed.rocker.runtime.RockerRuntime - Rocker template reloading not activated
java.nio.file.NoSuchFileException: /tmp/petstore/src/test/resources/config/client.keystore
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
at java.nio.file.Files.newOutputStream(Files.java:216)
at java.nio.file.Files.copy(Files.java:3016)
at com.networknt.codegen.rest.OpenApiGenerator.generate(OpenApiGenerator.java:367)
at com.networknt.codegen.Cli.run(Cli.java:98)
at com.networknt.codegen.Cli.main(Cli.java:50)
我需要以某种方式提供 client.keystore 吗?
配置文件
{
"name": "petstore",
"version": "3.0.1",
"groupId": "com.networknt",
"artifactId": "petstore",
"rootPackage": "com.networknt.petstore",
"handlerPackage":"com.networknt.petstore.handler",
"modelPackage":"com.networknt.petstore.model",
"overwriteHandler": true,
"overwriteHandlerTest": true,
"overwriteModel": true,
"httpPort": 8080,
"enableHttp": false,
"httpsPort": 8443,
"enableHttps": true,
"enableHttp2": true,
"enableRegistry": false,
"supportDb": false,
"supportH2ForTest": false,
"supportClient": false,
"specChangeCodeReGenOnly": true,
"dockerOrganization": "networknt"
}