Closed perNyfelt closed 7 months ago
Generating java classes from a sample json on https://www.jsonschema2pojo.org/ also works. I attach the sample here. example_report_sample.json
Hi
As a workaround you could try set refFragmentPathDelimiters
to #/
(default being #/.
)
jsonSchema2Pojo {
source = files("${sourceSets.main.output.resourcesDir}/falsstprv_schema.json")
targetDirectory = file("${project.buildDir}/generated/sources/js2p")
targetPackage = 'sample'
refFragmentPathDelimiters = '#/'
}
Thanks, i got further using refFragmentPathDelimiters. Generation completes but cannot compile due to lots of "duplicate class" errors e.g.
error: duplicate class: sample.Deposit
public class Deposit {
Is there a config i can do to address that?
I'm not sure if it has anything to do with jsonSchema2Pojo plugin. Please check if you have duplicate class definitions on compile classpath. Alternatively provide a SSCCE that is reproduces given issue.
OK thank you! In the process of creating a SSCCE i found an issue on my side and the problem with duplicate classes was resolved. The working SSCCE can be found here: https://github.com/perNyfelt/jsonSchema-path-not-present.
Using the attached schema: falsstprv_schema.json the jsonSchema2Pojo fails with the following error "Path not present: fals"
the gradle build script calls the plugin as follows
I noticed that it is possible to process and generate Java pojos at https://json2csharp.com/code-converters/json-to-pojo so I suspect the problem is due to some bug in the jsonschema2pojo plugin.