Skip to content

Commit

Permalink
fix list option parse
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf committed Jun 10, 2024
1 parent 5949229 commit ee311f2
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 ee311f2

Please sign in to comment.