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

Merging data classes of the same structure #390

Closed
EikoocS opened this issue Apr 29, 2022 · 5 comments · Fixed by #393
Closed

Merging data classes of the same structure #390

EikoocS opened this issue Apr 29, 2022 · 5 comments · Fixed by #393
Assignees
Labels
enhancement L3 Difficulty level 3 (Maximum is 9)

Comments

@EikoocS
Copy link

EikoocS commented Apr 29, 2022

If I try to convert the following example

{
    "data1":{
        "name":"name1",
        "value":"value1"
    },
    "data2":{
        "name":"name2",
        "value":"value2"
    }
}

Then two data classes with identical structure will be obtained (Data1,Data2)
When the number of such structures increases, a large number of data classes with the same structure will be generated
I would like to have the opportunity to choose whether to combine the two data classes into one in this case

@wuseal
Copy link
Owner

wuseal commented Apr 29, 2022

HI, Do you want to generate only one class like this?

data class Test(
    val data1: Data1,
    val data2: Data1
)
data class Data1(
    val name: String,
    val value: String
)

@EikoocS
Copy link
Author

EikoocS commented Apr 29, 2022

Yes
When I try to get this result I get several classes with the same structure but different names

@wuseal
Copy link
Owner

wuseal commented May 11, 2022

@Yummy-Cookie-S Thank you for your feedback, will fix it next version

@wuseal wuseal added enhancement L3 Difficulty level 3 (Maximum is 9) labels May 11, 2022
@wuseal wuseal self-assigned this May 11, 2022
wuseal added a commit that referenced this issue May 15, 2022
fix #375
fix #390
@wuseal wuseal mentioned this issue May 15, 2022
@ptsiogas
Copy link

Hi, I have the 3.7.4 version and I still see the same behaviour. Should I enable a setting in order to fix it?

@wuseal
Copy link
Owner

wuseal commented Jul 29, 2022

I think No need settings additional Can you paste the demo json reproduce the behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement L3 Difficulty level 3 (Maximum is 9)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants