Kotlin2 codegen implementation is eager

Đang mở
#428 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
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
graphql, kotlin
Lĩnh vực
tooling

Hướng nghiên cứu

Payload nêu GraphQLQueryRequest, DgsClient.buildQuery và phần triển khai projection của Kotlin2 là các điểm vào liên quan; trước tiên, hãy lần theo cách các projection được tạo và tuần tự hóa trong những đường dẫn này. So sánh hành vi của field-map trong Java với Kotlin2, sau đó xác minh rằng các field được chọn lặp lại được loại bỏ trùng lặp trong khi vẫn giữ nguyên sự phân tách giữa Query và Projection.

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

Mô tả

Hey all,

Thanks for this amazing library. In our current setup I ran into the following. When building the query with Kotlin projections (love the feature) it's eager. When you select a field or create a projection, the string is build eagerly.

Compared to the Java implementation the fields are stored to a map and serialised when you call the .serialize() function. The result is, when you are selecting the same field multiple times it's only included once.

We try to split our projection selection which might result in duplication of selecting a field (for example a name or id property) and this is now included in the query. GraphQL does accept it but it adds extra noise to the query which is not needed.

Proposed solution

Instead of moving to the DgsClient.buildQuery still support the split between Query and Projection which is done by using the GraphQLQueryRequest. This then can use the same underlying builder pattern that is now for the Projections but instead of calling functions it's done with the same solution that is being used for the Kotlin2 implementation.

Example

Current java result

  public XProjectionRoot y() {
    getFields().put("y", null);
    return this;
  }

Current kotlin2 implementation

  public val y: XProjection
    get() {
      field("y")
      return this
    }

Proposed kotlin2 implementation

  public val y: XProjection
    get() {
      getFields().put("y", null);
      return this
    }

And instead of using the DgsClient.buildQuery function we can provide the projection to the current GraphQLQueryRequest

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.