More work

This commit is contained in:
2020-01-17 23:29:16 +01:00
parent 9d3631b20b
commit d3072a88b8
6 changed files with 296 additions and 92 deletions

View File

@@ -59,11 +59,11 @@ instance FromJSONKey Versioning where
instance ToJSONKey (Maybe Versioning) where
toJSONKey = toJSONKeyText $ \case
Just x -> prettyV x
Nothing -> T.pack "unknown"
Nothing -> T.pack "unknown_version"
instance FromJSONKey (Maybe Versioning) where
fromJSONKey = FromJSONKeyTextParser
$ \t -> if t == T.pack "unknown" then pure Nothing else pure $ just t
$ \t -> if t == T.pack "unknown_version" then pure Nothing else pure $ just t
where
just t = case versioning t of
Right x -> pure x