Skip to content

Commit

Permalink
fix list option parse (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf committed Jun 11, 2024
1 parent 62b5e11 commit 3378a0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/config/optionmodels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,14 @@ class ListOption<T: Option & EmptyConstructible>: Option, ObservableObject {

static func decode(json: JSON) throws -> Self {
let defaultOptions = try [T.Storage].decode(json: json["DefaultValue"]).map {
return try T.decode(json: ["DefaultValue": $0, "Value": $0])
return try T.decode(json: [
"DefaultValue": $0.encodeValueJSON(), "Value": $0.encodeValueJSON(),
])
}
let options = try [T.Storage].decode(json: json["Value"]).map {
try T.decode(json: ["DefaultValue": $0, "Value": $0])
return try T.decode(json: [
"DefaultValue": $0.encodeValueJSON(), "Value": $0.encodeValueJSON(),
])
}
return Self(
defaultValue: defaultOptions,
Expand Down

0 comments on commit 3378a0e

Please sign in to comment.