Interface code generation breaks serialization for nested objects
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi trong bài kiểm thử DgsQueryExecutor được nêu trong issue, sử dụng schema ShipmentRating và ShipmentRatingCartonEntity. Truy vết interface được sinh ra và quá trình tuần tự hóa lồng nhau của ShipmentRatingCarton cho projection amountInsured. Hoàn thành khi đối tượng lồng nhau được tuần tự hóa thành công và bài kiểm thử có thể trích xuất shipment rating cùng dữ liệu carton của nó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
generateInterfaces = true
with a schema type like:
extend type Query {
"""
Returns a `ShipmentRating` resource by ID.
"""
shipmentRating(input: ID!): ShipmentRating
"""
Returns a list of `ShipmentRating` resources with the given filters.
"""
shipmentRatings(input: ShipmentRatingsInput): [ShipmentRating]
}
extend type Mutation {
"""
Allows an API consumer to create a `shipmentRating`.
"""
createShipmentRating(input: CreateShipmentRatingInput!): ShipmentRating
"""
Allows an API consumer to calculate possible shipment ratings based on the organization's configured settings.
"""
calculateShipmentRatings(input: CalculateShipmentRatingsInput!): [ShipmentRating]
}
enum ShipmentAmountType {
BUFFER
DISCOUNT
FUEL_SURCHARGE
INSURANCE
PUBLISHED_RATE
SURCHARGE
}
"""
A Shipment rating quote that can be displayed to
"""
type ShipmentRating implements Node {
"ShipmentRating ID, prefixed with `shipmentRating_`"
id: ID!
"The quoted amount for the `ShipmentRating`"
amount: Decimal!
"Subtotal amounts of how the `ShipmentRating` amount was calculated"
amountSubtotals: ShipmentRatingSubtotals!
"The currencyCode of the amount fields."
currencyCode: CurrencyCode!
"When this `ShipmentRating` was created"
createdAt: DateTime!
"The user who created the `ShipmentRating`"
createdBy: ID!
"Breakdown of the details returned from the carrier."
details: [ShipmentRatingDetail!]
"The customer facing display name of the `ShipmentRating`."
displayName: String!
"The ISO-8601 timestamp of when the delivery could first be delivered"
minTransitAt: DateTime
"The ISO-8601 timestamp of when the delivery will be delivered"
maxTransitAt: DateTime
"""
For shipments that contain multiple fulfillment warehouses the multipleShipFromRatings will contain the individual `ShipmentRating` calculations.
The aggregated totals will be reflected on the parent object. In these cases the shipFrom location will be null.
"""
multipleShipFromRatings: [ShipmentRating]
"The `organization` associated with the `ShipmentRating`"
organization: ID!
"A carrier service level code to identify how to fulfill the shipment"
serviceLevelCode: String!
"The `location` associated with the origin of the shipment."
shipFrom: Location
"The destination `location` used to generate the shipment Quote"
shipTo: Location!
"The Carton data included in the `ShipmentRating`"
shipmentRatingCartons: [ShipmentRatingCarton!]!
"The `ShippingProfile` associated with the `ShipmentRating`"
shippingProfile: ShippingProfile!
"When this `ShipmentRating` was most recently updated."
updatedAt: DateTime!
"The user who most recently updated the `ShipmentRating`."
updatedBy: ID!
}
"""
The Carton details containing the package dimensions and items included in the `ShipmentRating`
"""
type ShipmentRatingCarton {
"The total amount that the package is insured based in the currencyCode from the `ShipmentRating`."
amountInsured: Decimal!
"The Carton associated with the `ShipmentRatingCarton`."
carton: Carton!
"The weight the carrier is charging for this carton. This could be actual or dimensional weight of the carton."
chargeableWeight: Decimal
"The Dimensional weight factor used to determine the dimensionalWeight."
dimensionalFactor: Int
"The calculated dimensionalWeight of the carton."
dimensionalWeight: Decimal
}
"""
A surcharge or discount breakdown provided by the carrier.
"""
type ShipmentRatingDetail {
"Amount for each charge as defined by the `carrier`."
amount: Decimal!
"Unique identifier that will be tied to each fee that is charged by the carrier for the `shipmentRating`."
carrierCode: String!
"The type of fee that is being broken down as part of the `shipmentRating`."
type: ShipmentAmountType!
}
"""
Subtotal amounts of how the `ShipmentRating` amount was calculated
"""
type ShipmentRatingSubtotals {
"Amount charged for the fuel surcharge by the `carrier`."
fuelSurcharge: Decimal
"Cost to insure items that is charged by the `carrier`."
insuranceCost: Decimal
"The sum of any other surcharges that are not individually broken down by the `carrier` (residential falls into this bucked)."
otherSurcharge: Decimal
"Cost of shipping as defined by the `carrier`."
shipping: Decimal!
}
"""
Input to create a non-calculated shipmentRating.
"""
input CreateShipmentRatingInput {
amount: Decimal
cartons: [ID!]!
serviceLevelCode: String!
}
"""
Input to calculate a `shipmentRating` for the given Order.
"""
input CalculateShipmentRatingsInput {
order: ID!
}
input ShipmentRatingsInput {
countryCode: CountryCode
organization: ID
serviceLevel: ID
}
type Root @key(fields: "id") @extends {
id: ID! @external
shipmentRatings: [ShipmentRating]
}
type Location @key(fields: "id") @extends {
id: ID! @external
}
type Carton @key(fields: "id")
@extends
{
id: ID! @external
}
and a hibernate entity like this:
package com.zonos.shipmentrating.shipmentRating.model;
import com.zonos.shipmentratingclient.types.IShipmentRatingCarton;
import lombok.*;
import javax.persistence.Entity;
import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder(toBuilder = true)
public class ShipmentRatingCartonEntity {
private BigDecimal amountInsured;
private CartonEntity carton;
private BigDecimal chargeableWeight;
private Integer dimensionalFactor;
private BigDecimal dimensionalWeight;
}
fails to serialize with a DgsQueryExecutor call like this:
@Test
void getShipmentRatingTest() throws InvocationTargetException, IllegalAccessException {
// test retrieving a shipment rating by ID
ShipmentRating shipmentRating = createShipmentRating();
var projection = new ShipmentRatingProjectionRoot();
projection.id()
.amount()
.serviceLevelCode()
.shipmentRatingCartons()
.amountInsured();
GraphQLQueryRequest request = new GraphQLQueryRequest(
new ShipmentRatingGraphQLQuery.Builder()
.input(shipmentRating.getId())
.build(),
projection,
getZonosScalars()
);
ShipmentRating retrievedShipmentRating = dgsQueryExecutor.executeAndExtractJsonPathAsObject(request.serialize(),
"data." + new ShipmentRatingGraphQLQuery().getOperationName(),
new TypeRef<List<ItemEntity>>() {
});
assertNotNull(retrievedShipmentRating);
assertTrue(retrievedShipmentRating.getId().equals(shipmentRating.getId()));
assertTrue(retrievedShipmentRating.getShipmentRatingCartons().size() == 1);
}
- 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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Netflix/dgs-codegen
-
Integer default values on `Float` input fields generate code that does not compile (Java and Kotlin)Có thể đã có người làm @0z5a đã nhận 9 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Netflix/dgs-codegen#1015 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
Netflix/dgs-codegen#1002 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Object literal default value on a custom scalar fails with NoSuchElementExceptionCó thể đã có người làm @nboisnea đã nhận 49 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Netflix/dgs-codegen#982 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HV000271: Using @Valid on a container (java.util.List) is deprecated. You should apply the annotation on the type argument(s).Có thể đã có người làm @jiholee17 đã nhận 73 ngày trước. Đang mởenhancement
Netflix/dgs-codegen#954 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support Immutable java Data TypesCó thể làm lại được @jiholee17 đã nhận 184 ngày trước và không có pull request nào đang mở. Đang mởenhancement
Netflix/dgs-codegen#944 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Netflix/dgs-codegen
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
DojoCodingLabs/hermit#23 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
signalapp/Signal-Android#15148 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
PranshulGG/WeatherMaster#1266 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày