Created attachment 14 [details] Errors from the command line tool Hi, When I try to generate spring JAVA openApi annotations for ETSI NFV SOL003 LifecycleManagement API json file, it results in errors. Attached both the command line conversion dump with errors and also the json input file I used. Command I used for conversion is as below: swagger-codegen generate -i build/SOL-003/json/SOL003-VNFLifecycleManagement-API.json -l spring -o springCodeSamples/ -c myOptions.json
Created attachment 15 [details] SOL003-VNFLifecycleManagement-API.json
Also, when I tried to access json file from NFV Solutions wiki, its null. https://forge.etsi.org/jenkins/job/NFV%20-%20Network%20Functions%20Virtualisation/job/sol002-sol003-master/lastSuccessfulBuild/artifact/build/SOL003-VNFLifecycleManagement-API.json/*view*/ Could you please share the working version of SOL003-VNFLifecycleManagement-API.json, the file thats present in the https://forge.etsi.org/rep/nfv/SOL002-SOL003/tree/master seems to have errors.
I also tried generating json files as suggested in https://forge.etsi.org/rep/nfv/SOL002-SOL003/tree/master with the command - "sudo bash .jenkins.sh", which is also resulting in some errors. Attached jenkins script dump to the bug. yaml file is empty cat SOL003-VNFLifecycleManagement-API.yaml JSON file generated is null cat SOL003-VNFIndicator-API.json
Created attachment 16 [details] Jenkins script dump
(In reply to sivaprasath busa from comment #0) Are you sure you're using the codegen for Swagger 2.0? It seems from the logs you're using the one for OpenAPI 3.0 > Created attachment 14 [details] > Errors from the command line tool > > Hi, > > When I try to generate spring JAVA openApi annotations for ETSI NFV SOL003 > LifecycleManagement API json file, it results in errors. > > Attached both the command line conversion dump with errors and also the json > input file I used. > > Command I used for conversion is as below: > > swagger-codegen generate -i > build/SOL-003/json/SOL003-VNFLifecycleManagement-API.json -l spring -o > springCodeSamples/ -c myOptions.json
(In reply to sivaprasath busa from comment #2) The full list of available OpenAPI representations for the different SOL specs versions is available here: https://nfvwiki.etsi.org/index.php?title=SOL_OpenAPI_Representations Please mind that for v2.5.1 there are few issues to be fixed with the hyperlinks. The v2.6.1 draft should anyway be already stable. > Also, when I tried to access json file from NFV Solutions wiki, its null. > > https://forge.etsi.org/jenkins/job/NFV%20- > %20Network%20Functions%20Virtualisation/job/sol002-sol003-master/ > lastSuccessfulBuild/artifact/build/SOL003-VNFLifecycleManagement-API.json/ > *view*/ > > > Could you please share the working version of > SOL003-VNFLifecycleManagement-API.json, the file thats present in the > https://forge.etsi.org/rep/nfv/SOL002-SOL003/tree/master seems to have > errors.
Yes, thanks for the observation. swagger-codegen I'm on is the published version which I installed through brew in my mac. It's pointing to 3.0 as below. $ swagger-codegen version 11:01:34.631 [main] DEBUG io.swagger.codegen.v3.cli.SwaggerCodegen - there are not options for command 'langs' 11:01:34.633 [main] DEBUG io.swagger.codegen.v3.cli.SwaggerCodegen - there are not options for command 'version' 3.0.10 I moved to swagger-codegen@2 just now with brew. When I run this command as below: $ swagger-codegen generate -i src/SOL003/VNFLifecycleManagement/VNFLifecycleManagement.yaml -l spring -o sol003-codegen-autogeneratedSpringBootSwaggerCode/ -c myOptions.json [main] INFO io.swagger.parser.Swagger20Parser - reading from src/SOL003/VNFLifecycleManagement/VNFLifecycleManagement.yaml Exception in thread "main" java.lang.RuntimeException: Unable to load RELATIVE ref: ../definitions/SOL002SOL003_def.yaml path: /Users/sbusa/workspace/SOL002-SOL003-master-swagger-autogen/src/SOL003/VNFLifecycleManagement at io.swagger.parser.util.RefUtils.readExternalRef(RefUtils.java:162) at io.swagger.parser.ResolverCache.loadRef(ResolverCache.java:118) at io.swagger.parser.processors.ExternalRefProcessor.processRefToExternalDefinition(ExternalRefProcessor.java:47) at io.swagger.parser.processors.ModelProcessor.processRefModel(ModelProcessor.java:95) at io.swagger.parser.processors.ModelProcessor.processModel(ModelProcessor.java:34) at io.swagger.parser.processors.ResponseProcessor.processResponse(ResponseProcessor.java:34) at io.swagger.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:47) at io.swagger.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:102) at io.swagger.parser.SwaggerResolver.resolve(SwaggerResolver.java:66) at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:72) at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:431) at io.swagger.codegen.cmd.Generate.run(Generate.java:283) at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35) Caused by: java.lang.RuntimeException: Could not find ../definitions/SOL002SOL003_def.yaml on the classpath at io.swagger.parser.util.ClasspathHelper.loadFileFromClasspath(ClasspathHelper.java:31) at io.swagger.parser.util.RefUtils.readExternalRef(RefUtils.java:156) ... 12 more I'm hitting relative path issues, could you please suggest how to run codegen on lifecylemanagement module, for other interfaces, it worked fine with just using the json file itself.
Thanks, I will try the openApi yaml file from here for vnf lifecycle managment: https://nfvwiki.etsi.org/index.php?title=SOL_OpenAPI_Representations
Hi, Thanks for link, it works fine, I could autogenerate specs for all the openApi yaml files shared in the v2.6.1 draft version
Please resolve and close this bug as it works fine for me. Thanks for the help.
After sharing the link with the full list of available OpenAPI representations for the different SOL specs versions (v2.5.1, v2.6.1) and the confirmation of the usage of the swagger-codegen tool utilities for OpenAPI v2.0 the issue was solved, as can be checked in the previous comments.