Open Thomasator opened 10 months ago
"Boolean" is not a valid type, use "boolean" instead."Boolean" will be treated as a customized type, and lead to creating a new java class.
The answer here probably depends on how you are referencing those other types. If you want to refer to something on the classpath, you can use "existingJavaType"
to refer to an existing class, so that nothing new is generated. Does that help?
@joelittlejohn For example in the jsonschema the reference looks like this "person" : { "$ref" : "external_jsongen.json#/definitions/Person" }.
@abramsz The custum Boolean is needed for my app to work, there are more complex types too.
I've tried some solutions manually, and all it needs is to add include of the java classes for Example 'include com.example.external_module.Person'.
Are you able to edit the schema like this:
{ "existingJavaType" : "com.example.external_module.Person" }
?
@joelittlejohn Thanks for the response. It works, that is true, but its not the best solution and it will be a lot of work to rewrite my code to support this.
I also still need to have the external.json in the same directory. Is there a work around that?
@joelittlejohn
I've encountred another problem. The solution u mentioned above works for non basic types (enums ...), but if I have "$ref" : "external.json#/definitions/myString" reference to string or int for example, it does not work, because the basic types aren't generated into java classes. Is there some solution for that?
Hello,
I am trying to convert jsonschema to pojo via maven plugin.
I've encountered a problem. My generated jsonschema has references to some other module to other json schema. When I try to generate from json schema to POJO, this references are included in the class file and they are not refered to. For example, I have my own type (enum) 'Boolean', this type is generated into POJO in other module, but when I generate my class, this enum is included at the back of the file. I'd like to refer to the Boolean.java in the other module and not include it in the same file. Is it possible? Also, this file needs to be in the same directory for some reason. I've tried