-
-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adding JSON to Java transformation feature #345
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@ritz078 also I would like to mention that I have added getters, setters but haven't added a constructor to every class. I can do that too if you would like, please let me know |
You should add it too other users will see it as a bug. |
@ritz078 added the constructor generation logic |
@ritz078 I tested for a number of samples, did all fixes and added constructor generation logic. Can you please review and let me know if it looks good? Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job.
Thank you for your contribution 🎉
@all-contributors please add @Pooja444 for code contribution |
I've put up a pull request to add @Pooja444! 🎉 |
Github issue
#335
PR explanation
@ritz078 I am adding a JSON to Java transformation feature. I couldn't find any npm libraries that already do this so I used JSON to Kotlin transformation and applied rules to output Java class models.
I applied the below rules -
data class <className>(
topublic class <className> {
val <variableName>: <variableType>,
convert it toprivate <variableType> <variableName>;
typealias Root = List<Root2>
it will create a class root with just one list property and its getters, settersI tested this locally with a variety of JSON samples and its working perfectly. Some of the samples I tried were from this StackOverflow answer, in case anyone would like to test this locally
Please review and let me know if any changes are required.