on master help sign in
Remove to/from json instances for Volume

We only provide instances for a list of Volumes and the interface for adding those to createOpts is via the addVolume function. Everything else will be caught at compile time whereas the fromJson instance for a single Volume was flawed (if nothing then because it was using head and not checking for an empty list, or enforcing only one element in the list).

commit7097c09545addaef49ce7ca62f533e3a788ddcce authorDeni Bertovic <deni@denibertovic.com> dateFri 2 Sep 2016, 12:53 (10 years ago) parentfe96d40
1 file changed−7
src/Docker/Client/Types.hs−7
src/Docker/Client/Types.hs−7
@@ -738,13 +738,6 @@ instance FromJSON VolumePermission where
738738-- @
739739newtype Volume = Volume FilePath deriving (Eq, Show)
740740
741−instance ToJSON Volume where
742− toJSON (Volume fp) = JSON.Object $ HM.insert (T.pack fp) (JSON.Object HM.empty) HM.empty
743−
744−instance FromJSON Volume where
745− parseJSON (JSON.Object o) = return $ Volume $ T.unpack $ head $ HM.keys o
746− parseJSON _ = fail "Volume is not an object"
747−
748741instance ToJSON [Volume] where
749742 toJSON [] = JSON.Object HM.empty
750743 toJSON (v:vs) = JSON.Object $ foldl f HM.empty (v:vs)