Closed ArtisanDejure closed 1 year ago
Hi
It looks like it would be possible if https://github.com/joelittlejohn/jsonschema2pojo/blob/80d827db93e4cc3848c4f297ebbfe4b3fd936272/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/JsonPointerUtils.java#L27-L32
would also have a mapping for ?
eg.:
put("?", "~4");
Thanks for replying. Is this something I need to override myself or something that will be done in the library?
It's a change required in the library I'm afraid. Very happy to accept a PR for this, with a change as per the suggestion from @unkish.
I'm consuming a schema JSON from a vendor I don't control. The JSON contains some fields ending with a question mark (property-name?). this is of course not viewed as legal by the plugin. When the field is named the same as another property, but just with the question mark added, I get a message "trying to create the same field twice:. If it is just a property ending in the question mark the IllegalArgumentException is "Path not present: ".
I have a ticket open with the vendor to get them to correct their schema api, but I have no hope that they will actually do it.
Even trying to manually use the question mark in a Java field name is not legal, so I can't think of a "good " way for the plugin to handle it. I think it would be sufficient to be able to tell the plugin to skip certain properties though, such as ones containing the question mark. Another option would be for me to be able to specify a different name for them to generate with. That would be better than erroring out in my case. The alternative is for me to manually alter the vendor's schema, or to tediously write Java code to remove/change the offending properties.