Skip to content

Commit

Permalink
Relax JSON parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ngua committed Sep 23, 2024
1 parent a4f9f7d commit 311cd21
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions inferno-ml-server-types/src/Inferno/ML/Server/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,13 @@ instance
Model
-- If a new model is being created, its ID will not be present
<$> o .:? "id"
<*> (ensureNotNull =<< o .: "name")
<*> o .: "name"
<*> o .: "gid"
<*> o .: "visibility"
<*> o .:? "updated"
-- If a new model is being serialized, it does not really make
-- sense to require a `"terminated": null` field
<*> o .:? "terminated"
where
ensureNotNull :: Text -> Parser Text
ensureNotNull
t
| Text.null t = fail "Field cannot be empty"
| otherwise = pure t
{- ORMOLU_ENABLE -}

instance ToJSON gid => ToJSON (Model gid) where
Expand Down

0 comments on commit 311cd21

Please sign in to comment.