swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Error while compiling java petstore sdk

Open AmanSin opened this issue 5 years ago • 14 comments

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 2.8.1 as dependency.

Any ideas on how to fix this?

AmanSin avatar Jan 22 '21 10:01 AmanSin

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.

rhvonlehe avatar Jan 24 '21 19:01 rhvonlehe

Hey guys, i'm working on a fix to that. It will be ready soon.

HugoMario avatar Jan 25 '21 14:01 HugoMario

@HugoMario any news about this issue? Thanks a lot for your contribution :)

marcoshslima avatar Jan 29 '21 23:01 marcoshslima

@HugoMario any news about this issue? Thanks a lot for your contribution :)

I'm facing the same issue and waiting for the fix :)

Halayem avatar Jan 30 '21 07:01 Halayem

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.

HugoMario avatar Feb 01 '21 04:02 HugoMario

Any news regarding this issue?

jsimomaa avatar Feb 09 '21 09:02 jsimomaa

Sorry for pushing but I'd love to know if there're any news regarding that.

bbudzynski avatar Feb 15 '21 11:02 bbudzynski

Do we know when the new version with this fix will be rolled out?

ghost avatar Feb 20 '21 21:02 ghost

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?

sahindagdelen avatar Feb 24 '21 11:02 sahindagdelen

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.

HugoMario avatar Feb 24 '21 12:02 HugoMario

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?

rodikno avatar Feb 25 '21 23:02 rodikno

hey @rodikno, that's implemented on this commit

HugoMario avatar Feb 26 '21 00:02 HugoMario

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 .

rhvonlehe avatar Feb 26 '21 00:02 rhvonlehe

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?

jsimomaa avatar Apr 06 '21 10:04 jsimomaa