jsonschema2pojo
jsonschema2pojo copied to clipboard
#1100 Legal characters are now not limited to [0-9a-zA-Z_]
@joelittlejohn please take a look.
Hi @asympro. Thanks for working on this. As per CONTRIBUTING.md we do need an integration test for this.
I don't actually understand why you've introduced a new approach to handling unsupported characters. Why is it that sometimes chars that can't be supported in the identifier are replaced with _ and other times chars that can't be supported are in the identifier are omitted?
Chars that are illegal (can't be supported) should always be replaced by underscores. When allowNonLatinNames = false, this will be any character outside [a-zA-Z0-9], when allowNonLatinNames = true, this will be any character where isJavaIdentifierPart returns false.
If isJavaIdentifierStart returns false for the first char, stick an underscore on the front of the name (prepend).
I'm finding the current logic hard to follow and complicated, I think it can be a lot simpler, and more consistent with how jsonschema2pojo currently works.
You are totally right. Will implement anew like you suggested. As for the coding style - I tried to optimize it (losing in readability though), possibly it is due to my "build is always taking too long" mental issue.
Thanks @asympro! Let me know when you want me to take another look at your changes and I'll review 👍
@joelittlejohn IT test written, reimplementation ready, please review
It's much better. I vote for this implementation.
@joelittlejohn eirnym and I both prefer new implementation. Please review if you have time.