Update REST API classes to remove extraneous wrapper classes
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ái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java, spring-boot
Hướng nghiên cứu
Bắt đầu với các lớp mô hình REST API, bao gồm Webhook và Product, rồi so sánh cách các chú thích wrapper của Jackson xử lý các đối tượng đơn lẻ so với các collection. Tái tạo các dạng response Product và products được ghi trong tài liệu, sau đó xác định liệu có thể loại bỏ các wrapper Root mà vẫn bảo toàn cả hai dạng deserialization hay không; issue không xác định các file hoặc test cụ thể.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Much of the REST API model has "Root" classes which are just wrappers to handle the name of a JSON node.
I think we can get rid of all of those, by defining the actual model classes with a couple JSON annotations. An example is the Webhook class:
@JsonTypeName(value = "webhook")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
Update:
This is trickier than expected. The main approach works fine for single item use, but causes issues when there's an array of items being mapped to a collection.
For example, for a single Product call, Shopify returns something like:
{
"product": {
"id": 632910392,
"title": "IPod Nano - 8GB",
"body_html": "
It's the small iPod......
Which is why we need the Product class to have the As.WRAPPER_OBJECT annotation (or the wrapper class).
However, when getting an array of products, Shopify sends in something like this:
{
"products": [
{
"id": 632910392,
"title": "IPod Nano - 8GB",
"body_html": "
It's the small iPo
Note the lack of "product" level nodes. That's what breaks here. So basically we want Product to wrap itself with a "product" node if it's a single Product, but to NOT wrap itself when its an array or collection. I can't find any easy way to do this. A custom de-serializer is an option, but I'm not sure that's a lot better/cleaner than these wrapper classes....
- Ngôn ngữ chính
- Java
- Star
- 55
- Fork
- 18
- Merge trung bình
- 11 giờ 19 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 devondragon/SpringShopifyAppFramework
-
documentation enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
devondragon/SpringShopifyAppFramework#32 · 10 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
-
Change ShopifyRestClient to use a clean BuilderCó thể làm lại được @devondragon đã nhận 1225 ngày trước và không có pull request nào đang mở. Đang mởenhancement
devondragon/SpringShopifyAppFramework#24 · 1 bình luận · 1 người được giao ·
-
Problem with isAuthenticated method after uninstalling the appCó thể làm lại được @devondragon đã nhận 1499 ngày trước và không có pull request nào đang mở. Đang mở
devondragon/SpringShopifyAppFramework#12 · 5 bình luận · 1 người được giao ·
Tất cả issue của devondragon/SpringShopifyAppFramework
Issue tương tự
-
`GET /v1/event/token/{uuid}` can report a BOM upload as done before policy evaluation and metrics have finishedCó thể đã có người làm @Zargath đã nhận hôm nay. Đang mởdefect in triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DependencyTrack/dependency-track#7646 ·
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 62/100
floci-io/floci#5425 · 1 bình luận ·
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 85/100
objectionary/eo-graphs#80 ·
-
WebMvcStreamableServerTransportProvider: idle-session eviction stops permanently after a NullPointerException when a session is deleted mid-sweepCó thể đã có người làm @lejuho đã nhận hôm nay. Đang mởstatus: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
spring-projects/spring-ai#7133 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
objectionary/jucs#141 ·
Maintainer thường phản hồi trong vòng 1 ngày