Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JAVA] Model import in JSON.java file using Swagger Codegen #7836

Open
nkesarwani7 opened this issue Mar 14, 2018 · 1 comment
Open

[JAVA] Model import in JSON.java file using Swagger Codegen #7836

nkesarwani7 opened this issue Mar 14, 2018 · 1 comment

Comments

@nkesarwani7
Copy link

Generating java client from editor.swagger.io

Using command mvn clean package to get swagger-java-client-1.0.0 library, but command prompt is showing this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) onproject swagger-java-client: Compilation failure
[ERROR] /C:/java-client/src/main/java/io
/swagger/client/JSON.java:[30,1] package io.swagger.client.model does not exist

Yesterday it was working fine.

Swagger generated code is importing a package in JSON.java class:

import io.swagger.client.model.*;

But somehow this package is not available in the autogenerated java-client.

I have tried removing this import and compiled the project again it compiled and build successfully, but while using the library file (swagger-java-client-1.0.0) API stopped working.

Then i tried with my earlier version of yaml file to generate code which was working fine yesterday but somehow it is showing the same error.

This model package was not generated in my project which I generated yesterday neither the import (import io.swagger.client.model.*;) was there in my JSON.java file.

expected result:
Should generate JAVA client code which is compilable with or without the model import.

Thank You
Neeraj

@nkesarwani7
Copy link
Author

may be related to:
#1837

@nkesarwani7 nkesarwani7 changed the title Model import in JSON.java file using Swagger Codegen for JAVA [JAVA] Model import in JSON.java file using Swagger Codegen Mar 16, 2018
eivinhb added a commit to eivinhb/swagger-codegen that referenced this issue May 2, 2018
…wagger-api#7836)

After fixes for swagger-api#6636 the gson based clients would not compile if the
swagger json did not have any model definitions. This can be the case
if the API only uses simple datastructures for input and output. (int,
String, List, Map etc.)
crumpf added a commit to crumpf/swagger-codegen that referenced this issue Jul 19, 2018
* master:
  Update README.md
  fixed NPE on `getHasQueryParams` method.
  Fix getHasQueryParams to take authMethods into account
  added null check.
  added pattern, mixLength, maxLength from "non object" model to a codegen property.
  updated dependencies versions on CI pom files.
  bump to released versions
  Fix getter methods for Java model with additionalProperties
  set required on response property when schema is not null.
  updated swagger core and swagger parser versions, also added tests to confirm that issue swagger-api#7980 is solved with these changes.
  fixed index out of bound exception for inline empty example field.
  Fix for uncompilable java client if no model definitions i specified (swagger-api#7836)
  Add option modelPropertyNaming to javascript generator
  Update PetStore sample
  Configuration option to disable HTML escaping when using Gson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant