Skip to content

Commit

Permalink
Fix serialization of Nut model
Browse files Browse the repository at this point in the history
A serialization unit test was failing with
```
Unexpected JSON token at offset 170: Expected start of the array '[', but had '[' instead at path: $.nuts['4'].methods[0]
```

because response structure is different from the one used by `Nut`.

Fix by introducing a `Method` model type as part of a `Nul` type matching actual json response structure.
  • Loading branch information
kirillzh authored and thunderbiscuit committed Jun 25, 2024
1 parent 634ad60 commit 3fbd53d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/src/main/kotlin/me/tb/cashuclient/types/InfoResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ public data class InfoResponse(
val nuts: Map<String, Nut>,
)

@Serializable
public data class Method(
val method: String,
val unit: String
)

@Serializable
public data class Nut(
val methods: List<List<String>>? = null,
val methods: List<Method>? = null,
val disabled: Boolean? = null,
val supported: Boolean? = null
)

0 comments on commit 3fbd53d

Please sign in to comment.