joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.24k stars 1.66k forks source link

Generate Method Names in "$ref" Properties Using a "javaName" #1609

Open erikvanderwerf opened 6 months ago

erikvanderwerf commented 6 months ago

This is my first PR here, please help me out with anything else that might be required.

This is my attempt at addressing #678. It works by injecting the javaName value from a parent node that uses $ref into a copy of the referenced node.

As a weirdness, without the changes to PropertyRule.java the updated test fails on line 69 hasProperty("javaReference"), which is confusing to me. A property with the name javaReference does exist on the actual object if you enter a debugger, but for some reason hamcrest.beans.PropertyUtil sees a different set of property names. I'm not sure why that is.