-
Notifications
You must be signed in to change notification settings - Fork 30
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
Generated java code does not compile #100
Comments
@dickerpulli ,with generating .net code I've been using openapi-generator v4.3.0 and it compiled well. I guess @alamers also has used same version for Java generation. Seems like you are using 4.2.3, so at least you could try to update generator. I would recommend to avoid (at least for now) using latest version of openapi-generation (v4.3.1) as it contains some breaking changes for handling discriminators in schemes. |
Hi, I think I did something similar to you when testing this (see #84) and did not run into this problem. I used the default OkHttp generation instead of JAX-RS but I don't think that should completely change the generated code. Also I did use the latest version. Unfortunately, I seem to have done a bit of spring cleaning on my laptop so I don't have the workspace anymore. Let me know if 4.3.1 fixes it for you, otherwise I'll try and reconstruct my previous setup. |
I can confirm that currently 4.3.1 does not work at all. But with 4.3.0, 4.2.3, 4.2.2 (that's what i've tested so far) the code is generated but no compileable java code. When I execute
|
When I remove the following block from
As I understand What do you think? Does this work with your .NET code? @ahokkonen |
I agree @dickerpulli @ahokkonen the member property of icarResourceCollection was principally added for documentation of the intent for derived classes. The documentation could be retained in the Wiki while the definition in the JSON Schema could be removed to improve code generation. |
@dickerpulli I was about to suggest same solution you have already found (removing "member" from base class). In .NET sub-class just override "member" property from parent and compiles well. I agree that we can remove this property in parent as a quick and simple solution. Maybe later we can see if this is somehow solvable as a generic/abstract parent-property. (probably requires generator improvements etc.) |
@cookeac I will do this correction today and will send a PR. Also minor fix for empty inline schema which cases errors in 4.3.1 generator release. |
I just checked @ahokkonen's pull request with Java and this version works fine for me. I generated a spring client: Not sure what I did last time; I notice that there is now an LocationsApi instead of the other API's I had. So I guess I mixed up different generators and/or versions. :( Anyway, this seems to work, and should be backwards compatible so I'll confirm the pull request. |
@dickerpulli Can you confirm that it also works for you? Then we can close this ticket :) |
Hi @alamers I expected the fix to be done on branch ADE-1 so that it is fixed for version 1 also. ... currently it's only fixed on DEVELOP |
Sorry, I missed your hint, that it's only in DEVELOP :-) I testet the DEVELOP and it works. But only with "spring" as generator language. It also works with openapi-generator-4.3.1 |
Ok, I just tested with |
@alamers when will it be merged into ADE-1 branch? |
I just now merged it into ADE-1 and released v1.0.1. |
When I generate java code with
java -jar openapi-generator-cli-4.2.3.jar generate -g jaxrs-resteasy -i ../src/main/resources/git-icar/url-schemes/exampleUrlScheme.json -o output
the resulting code does not compile.The Collections (i.e. IcarAnimalCoreCollection) extends IcarResourceCollection that has a
member
of type List, but i.e. has the same fieldmember
of type List.This does not compile
Do I missed a parameter? Is it a problem of the OpenAPI-Generator? What tool do you use to generate compilable java code (> Java 8)?
The text was updated successfully, but these errors were encountered: