Forum Discussion
hello qiandj, can you try with latest release? this should have been addressed, in case it's still present, please let me know and i work on it asap.
Hi hugomario .
Sorry, I might have missed your previous update to this ticket, otherwise I would have tested this long ago.
I have tried the following (same YAML as in the OP):
1) java -jar openapi-generator-cli-4.3.0.jar generate -i openapi.yaml -g jaxrs-spec && mvn clean install
Result: COMPILATION ERROR.
Besides, when looking at the generated models the module org.openapitools.model.OneOfDogCat is imported but doesn't seem to be generated (at all).
2) -g jaxrs-resteasy-eap
Same problem.
3) -g java-undertow-server
Same problem. The models are not referenced from the controller, however they reference each other and OneOfDogCat is still missing
4) -g java-inflector
Same problem.
5) -g java
This is a client build (all the previous were server ones) and it demonstrates the same problem - OneOfDogCat is used but is not generated.
----------------- UPDATE ----------------
I have re-read my original post in this thread and it seems that there is another file that is not generated now: AllPetsResponse.
Sorry, I'm taking this back. The file is indeed not generated, but it is also not used so that's fine.
- AlexeyNezhdanov5 years agoOccasional Contributor
(re-posting because my previous post seems to be gone).
Looking further at the generated files I notice that this does not seem to be solved in the extensible way.Original state (at the time of opening this ticket):
public class SinglePetResponse { private @Valid Object pet = null; }
Current state (ignoring the fact the OneOfDogCat is not generated):
public class SinglePetResponse { private @Valid OneOfDogCat pet = null; }
Desired state:
public abstract class Pet { } public class SinglePetResponse { private @Valid Pet pet = null; }
We can argue about the Pet class being abstract, of course, but the pet field being of type Pet and not something else is crucial. Otherwise if I extend my API later by adding a type Turtle, my existing code will break because some classes would be renamed.
- hugomario5 years agoStaff
Thanks AlexeyNezhdanov
For reply, i'll work on the issues you got, hopefully i expect to have an update this friday
- hugomario5 years agoStaff
I have not noticed but, you are using a file from a different project, try with swagger-codegen
and let me know if the issue you mentioned is present.
About adding properties to an Array subclass. I'm not sure about this, it's soemthing we can certainly add. Would be good to discuss with community.
Related Content
- 6 months agonado
Recent Discussions
- 7 days agokj20nt
- 15 days agoprogrammer_j
- 20 days agotobyclements