Error while compiling java petstore sdk
I am trying to generate a java API using swagger-codegen (3.0.0) I am using the swagger-codegen-cli-3.0.24.jar version of codegen jar. I ran the following command to generate the SDK for the sample petstore project:
java -jar swagger-codegen-cli.jar generate -i code/swagger-codegen/modules/swagger-codegen/src/test/resources/3_0_0/petstore.json -l java -o out/pet-java
When I am compiling the generated sdk project: cd out/pet-java mvn clean package
I am getting the below error:
Compilation failure [ERROR] out/pet-java/src/main/java/io/swagger/client/model/Pet.java:[87,34] cannot find symbol [ERROR] symbol: method nextObject() [ERROR] location: variable jsonReader of type com.google.gson.stream.JsonReader
it is using
Any ideas on how to fix this?
I am seeing the same issue with swagger-codegen creating jsonReader.nextObject() calls when there does not seem to be a method nextObject in the JsonReader within com.google.gson.stream.JsonReader. Similarly the codegen also makes calls to jsonReader.next() which is another method that doesn't exist.
I am using java -jar swagger-codegen-cli.jar generate -i https://developers.strava.com/swagger/swagger.json -l java -o generated/java
I'm on Windows with swagger-codegen version 2.4.18 obtained via wget.
Hey guys, i'm working on a fix to that. It will be ready soon.
@HugoMario any news about this issue? Thanks a lot for your contribution :)
@HugoMario any news about this issue? Thanks a lot for your contribution :)
I'm facing the same issue and waiting for the fix :)
hey @marcoshslima @Halayem I fixed the errors on these commits https://github.com/swagger-api/swagger-codegen-generators/commit/8f23a89ce4c75597b8deb82e010fa1e8037168d8 https://github.com/swagger-api/swagger-codegen-generators/commit/6d2b275d8e268d877b84b53c143443e7dfb66184
I expect to have changes done today or tomorrow and get the next release done this week.
Any news regarding this issue?
Sorry for pushing but I'd love to know if there're any news regarding that.
Do we know when the new version with this fix will be rolled out?
hey @marcoshslima @Halayem I fixed the errors on these commits swagger-api/swagger-codegen-generators@8f23a89 swagger-api/swagger-codegen-generators@6d2b275
I expect to have changes done today or tomorrow and get the next release done this week.
Hey @HugoMario can you inform us about the fix?
hey @sahindagdelen, sure. I'm working on tasks to get a release soon, i hope for next week, but unfortunately i can not guarantee it.
Hi, I'm now struggling to build my project for the same reason, thank you for contributing to this @HugoMario
I'm wondering: is there any temporary workaround before it gets released?
Can it be changed to Object value = jsonReader.nextString(); instead?
hey @rodikno, that's implemented on this commit
This might help. I had to work around the issues for my side project:
https://stackoverflow.com/questions/65843067/error-while-compiling-swagger-codegen-java-petstore-sdk/65986105#65986105
On Thu, Feb 25, 2021 at 5:33 PM Rodion Baronov [email protected] wrote:
Hi, I'm now struggling to build my project for the same reason, thank you for contributing to this @HugoMario https://github.com/HugoMario
I'm wondering: is there any temporary workaround before it gets released? Can it be changed to Object value = jsonReader.nextString(); instead?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/swagger-api/swagger-codegen/issues/10871#issuecomment-786303492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPA25YNTFO5SOFYSXC6QV3TA3M4ZANCNFSM4WOHVDBQ .
hey @sahindagdelen, sure. I'm working on tasks to get a release soon, i hope for next week, but unfortunately i can not guarantee it.
Any news?
What would be an earlier release that does not contain this bug?