Option to add custom logic during Entity codegen

Đang mở
#248 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
kotlin
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu bằng cách đọc graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/generators/kotlin/KotlinDataTypeGenerator.kt quanh dòng 116, nơi JsonProperty được hardcode. Xem lại cách các entity Kotlin được tạo ra xử lý annotation và collection; phần hoàn tất nên cung cấp một điểm mở rộng được định nghĩa cho các annotation của Spring Data JDBC và một kiểu collection có thể cấu hình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Kotlin
Star
220
Fork
123
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Netflix/dgs-codegen

Tất cả issue của Netflix/dgs-codegen

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.