cancel
Showing results for 
Search instead for 
Did you mean: 

Swagger model definitions are not being converted into code by codegen.

Highlighted
New Contributor

Swagger model definitions are not being converted into code by codegen.

Hi,

 

I can't figure out why my Java code from codegen is missing some of the models.

Such as HasMore, Limit, offset and count are not created, but Links is.

Does anyone know what the problem here could be?

 

3 REPLIES 3
Highlighted
Moderator

Re: Swagger model definitions are not being converted into code by codegen.

Hi,

 

I used the Client -> Java codegen and the model source files for HasMore, Limit, and Offset are being created in the src\main\java\io\swagger\client\model directory.  What specific codegen are you using which these are not getting created?

 

Regards,

Marcus

SmartBear Support



Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

Re: Swagger model definitions are not being converted into code by codegen.

Hi Marcus,

 

ok that's really weird, I have tried using https://editor.swagger.io/ and swagger-codegen-cli-2.2.3.

 

Here is the output from swagger-codegen-cli-2.2.3, and as you can see HasMore and the others are not created.

 

$ java -DapiTests=false -jar swagger-codegen-cli-2.2.3.jar generate -i swagger.json -l java
[main] INFO io.swagger.parser.Swagger20Parser - reading from swagger.json
[main] INFO io.swagger.codegen.ignore.CodegenIgnoreProcessor - No .swagger-codegen-ignore file found.
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\ItemsCodebase.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\ItemsCodebase.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\ItemsCodebaseDetails.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\ItemsCodebaseDetails.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\ItemsCodebaseDetailsInner.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\ItemsCodebaseDetailsInner.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\ItemsCodebaseInner.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\ItemsCodebaseInner.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\JsonObjCodebase.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\JsonObjCodebase.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\JsonObjCodebaseDetails.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\JsonObjCodebaseDetails.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\Links.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\Links.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\model\LinksInner.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\LinksInner.md
[main] WARN io.swagger.codegen.DefaultCodegen - Empty operationId found for path: get /. Renamed to auto-generated operationId: rootGet
[main] WARN io.swagger.codegen.DefaultCodegen - Empty operationId found for path: get /details/{codebase_id}. Renamed to auto-generated operationId: detailsCodebase_idGet
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java\io\swagger\client\api\CodebaseApi.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\docs\\CodebaseApi.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\pom.xml
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\README.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\build.gradle
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\build.sbt
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\settings.gradle
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\gradle.properties
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\AndroidManifest.xml
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\.travis.yml
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\ApiClient.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\StringUtil.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client/auth\HttpBasicAuth.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client/auth\ApiKeyAuth.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client/auth\OAuth.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client/auth\OAuthFlow.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\gradlew
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\gradlew.bat
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\gradle\wrapper\gradle-wrapper.properties
[main] INFO io.swagger.codegen.DefaultGenerator - writing file D:\git\dele\.\gradle\wrapper\gradle-wrapper.jar
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\git_push.sh
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\.gitignore
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\ApiException.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\Configuration.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\Pair.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client/auth\Authentication.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\ApiCallback.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\ApiResponse.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\JSON.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\ProgressRequestBody.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\ProgressResponseBody.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\src\main\java/io/swagger/client\GzipRequestInterceptor.java
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\.swagger-codegen-ignore
[main] INFO io.swagger.codegen.AbstractGenerator - writing file D:\git\dele\.\.swagger-codegen\VERSION

 

Highlighted
Moderator

Re: Swagger model definitions are not being converted into code by codegen.

Hi,

 

I generated the code from the models by using Swaggerhub.  I imported your API into Swaggerhub and used Client -> Java as the codegen.  Since you are using codegen-cli then you can report this issue in the codegen repository here https://github.com/swagger-api/swagger-codegen.

 

Regards,

Marcus

SmartBear Support



Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors