Skip to content
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

Elements with similar names are overwritten #93

Closed
joelittlejohn opened this issue Jun 23, 2013 · 4 comments
Closed

Elements with similar names are overwritten #93

joelittlejohn opened this issue Jun 23, 2013 · 4 comments
Milestone

Comments

@joelittlejohn
Copy link
Owner

Original author: [email protected] (March 06, 2013 12:33:06)

Please consider the example below, PriceDetails is creating a bean class PriceDetail and overwriting the inner PriceDetail Bean class file

{
"priceDetails": [
{
"description" : "TEST",
"PriceDetail" : {"amount" : 300, "code" : "USD"}
}
{......}
}

I am using the Command Line
jsonschema2pojo -a JACKSON2 --source sourceJson -t output -T JSON -E -S -p com.T.retail -P

I am Using the Latest Version of the Lib (0.3.5)

Kindly mail me if you need more details.

Thank you,
Ravi.
(Its really nice piece of tool).

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=93

@joelittlejohn
Copy link
Owner Author

From [email protected] on March 17, 2013 08:13:02
Fixed r2b985c7d25c4.

@joelittlejohn
Copy link
Owner Author

From [email protected] on March 18, 2013 15:29:37
Hi,

Thank you for the effort, but the issue is not resolved and it still persists. I might have not given a proper description before.

Please consider the example below, PriceDetails is creating a bean class PriceDetail and overwriting the inner PriceDetail Bean class file

{
"priceDetails": [
{
"description" : "TEST",
"PriceDetail" : {"amount" : 300, "code" : "USD"}
},
{
"description" : "TEST2",
"PriceDetail" : {"amount" : 600, "code" : "GBP"}
}]
}

In the above example PriceDetail bean gets replaced by the Bean PriceDetails.
If you rename the Json(inner) PriceDetail to Price_Details(or anything else) you will notice the difference.

Thank you for assisting, kindly comment if you need more info.

I am using the Command Line
jsonschema2pojo -a JACKSON2 --source sourceJson -t output -T JSON -E -S -p com.T.retail -P

I am Using the Latest Version of the Lib (0.3.5)

Thanks,
Ravi.

@joelittlejohn
Copy link
Owner Author

From [email protected] on March 18, 2013 19:00:05
Ravi, sorry if the above comment wasn't clear. I've made some code changes to fix this problem, and they will be released in version 0.3.6.

If you want to try this sooner, you could build a snapshot version from the current master.

@joelittlejohn
Copy link
Owner Author

From [email protected] on March 26, 2013 15:58:51
Hi Joe,

Thanks for your efforts, I took the latest code and it works like a charm.
You are Awesome :).

Thank you,
Ravi.

Tested the below Json and it generated the following POJOS.

com\T\retail\Links.java
com\T\retail\Links_.java
com\T\retail\PriceDetail.java
com\T\retail\PriceDetail_.java
com\T\retail\Test.java

{
"links":{"TEST":0},
"priceDetail": [
{
"description" : "TEST",
"PriceDetail" : {"amount" : 300, "code" : "USD"},
"links":{"HOME":123,"WWW":1}
},
{
"description" : "TEST2",
"PriceDetail" : {"amount" : 600, "code" : "GBP"},
"links":{"HOME":0,"WWW":7}
}]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant