Interface desarialization doesn't work

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java, kotlin

調査の方向性

この issue には schema と生成された ValidationRule および MinimumCharacterRule クラスが示されていますが、repository のファイルも test も指定されていません。まず MinimumCharacterRule のデシリアライズを再現し、生成された Jackson アノテーションが __typename をどのように扱うかを調査してください。生成された型が、報告された type-id missing エラーなしでデシリアライズでき、関連する test 領域が見つかった場合に回帰テストのカバレッジがあれば完了です。

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

説明

I have the following schema:

union ValidationRule = MinimumCharacterRule

type MinimumCharacterRule {
    value: Int!
}

It will generate the following classes:

@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "__typename"
)
@JsonSubTypes(@JsonSubTypes.Type(value = MinimumCharacterRule.class, name = "MinimumCharacterRule"))
public interface ValidationRule {
}
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NONE
)
public class MinimumCharacterRule implements ValidationRule {
...
}

If I try to deserialize the MinimumCharacterRule class I will get the following error:

Could not resolve subtype of [simple type, class com.example.ValidationRule ]: missing type id property '__typename'
主要言語
Kotlin
スター
220
フォーク
123
平均マージ
1日 6時間
マージ済み PR(30日)
23

環境構築

はじめの一歩

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

Netflix/dgs-codegen のほかの issue

Netflix/dgs-codegen の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

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

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