Mapping classes with conflicting naming in libraries fails
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 217
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
This issue seems to have been introduced after 5.1.9 somewhere.
I have a schema which roughly looks like this:
enum Currency {
USD, EUR
}
type Item {
amount: Amount
currency: Currency
}
I have type mappings like this:
Currency -> generated.Currency
Amount -> java.lang.Long
What happens is that I do not get the type mapping as part of the import statement in the generated class. I am generating Java. The issue seems to be that the codegen actually wants to find the type it maps to, as it works if I change the mapping to an existing class.
Is this a bug or a feature? I see no reason why I shouldnt be able to use my generated classes as part of the type mapping which exists in the first place to avoid naming clashes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the schema and mappings with Java generation, especially Currency -> generated.Currency and Amount -> java.lang.Long. Trace the type-mapping and import-resolution path in the code generator; done means the generated Item includes the mapping for generated.Currency without requiring that class to already exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100