Option to add custom logic during Entity codegen
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 217
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
I'm looking for ability to add Spring Data Jdbc annotations (@Id, @MappedCollection) for generated GraphQL entities.
Such option allow to reuse existing Pojos for DAO layer and eliminate tons of redundant LOC.
I see that JsonProperty is hardcoded in
graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin/KotlinDataTypeGenerator.kt:116.
Can you please provide some API for users, exposing some pluggable Kotlinpoet functions or something like that...
Without this option it's a disaster to duplicate Entities / Classes, then using some sort of Mappers and other annoying stuff to reach database.
EDIT
Also, all collections are mapped to List, although handwritten Set works. Most ORM / ORM-like frameworks require Set collection over List for relationships. Usually, List servers more rare cases in database mapping.
Ability to set Collection type also falls into "must have" zone.
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 reading graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin/KotlinDataTypeGenerator.kt around line 116, where JsonProperty is hardcoded. Review how generated Kotlin entities handle annotations and collections; done should provide a defined extension point for Spring Data JDBC annotations and a configurable collection type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100