Option to add custom logic during Entity codegen

オープン
#248 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
kotlin
領域
tooling

調査の方向性

まず、JsonProperty がハードコードされている graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin/KotlinDataTypeGenerator.kt の116行目付近を読んでください。生成された Kotlin エンティティがアノテーションとコレクションをどのように扱っているかを確認してください。実装が完了すると、Spring Data JDBC アノテーション用の明確な拡張ポイントと、設定可能なコレクション型が提供されるはずです。

索引モデルが issue の本文から書いたものです。

説明

enhancement

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.

主要言語
Kotlin
スター
220
フォーク
123
平均マージ
1日 6時間
マージ済み PR(30日)
23

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Netflix/dgs-codegen のほかの issue

Netflix/dgs-codegen の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。