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

Handling class name clashes when generating POJOs from examples. #1541

Open
Selaron opened this issue Jul 11, 2023 · 0 comments
Open

Handling class name clashes when generating POJOs from examples. #1541

Selaron opened this issue Jul 11, 2023 · 0 comments

Comments

@Selaron
Copy link

Selaron commented Jul 11, 2023

I'd like to suggest another solution for handling conflicting class names when generating POJOs from example JSON files.

Looking at this example BaseData.json:

{
  "office": {
    "contact": {
      "street": "Some Street",
      "houseNumber": "42",
      "town": "Some Town",
      "phoneNumber": "0118 0",
      "email": "office@somebusiness.tld"
    }
  },
  "emergency": {
    "contact": {
      "phoneNumber": "0118 999 881 999 119 7253"
    }
  },
  "press": {
    "contact": {
      "phoneNumber": "0118 1",
      "email": "press@somebusiness.tld"
    }
  }
}

I end up getting classes named BaseData, Emergency, Office, Press, Contact, Contact_1 and Contact_2.

I'd better prefer to have the latter three classes named OfficeContact, EmergencyContact and PressContact.

In order not to break existing projects this should be an option like combineClassNamesOnCollusion (default false)

Implementation might be more lightweight than #125 I guess.

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

No branches or pull requests

1 participant