Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Update REST API classes to remove extraneous wrapper classes

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java, spring-boot
領域
api, backend

調査の方向性

Webhook と Product を含む REST API のモデルクラスから始め、Jackson のラッパーアノテーションが単一オブジェクトとコレクションをどのように扱うかを比較します。文書化されている Product と products のレスポンス形式を再現し、そのうえで両方のデシリアライズ形式を維持したまま Root ラッパーを削除できるかを判断します。この issue では具体的なファイルやテストは特定されていません。

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

説明

enhancement good first issue

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....

主要言語
Java
スター
55
フォーク
18
平均マージ
7時間 14分
マージ済み PR(30日)
4

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

devondragon/SpringShopifyAppFramework のほかの issue

devondragon/SpringShopifyAppFramework の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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