File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
unison-share-api/src/Unison/Server Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,15 @@ instance (ToJSON b, ToJSON a) => ToJSON (DisplayObject b a) where
155155 MissingObject sh -> object [" tag" Aeson. .= String " MissingObject" , " contents" Aeson. .= sh]
156156 UserObject a -> object [" tag" Aeson. .= String " UserObject" , " contents" Aeson. .= a]
157157
158+ instance (FromJSON a , FromJSON b ) => FromJSON (DisplayObject b a ) where
159+ parseJSON = withObject " DisplayObject" \ o -> do
160+ tag <- o .: " tag"
161+ case tag of
162+ " BuiltinObject" -> BuiltinObject <$> o .: " contents"
163+ " MissingObject" -> MissingObject <$> o .: " contents"
164+ " UserObject" -> UserObject <$> o .: " contents"
165+ _ -> fail $ " Invalid tag: " <> Text. unpack tag
166+
158167deriving instance (ToSchema b , ToSchema a ) => ToSchema (DisplayObject b a )
159168
160169-- [21/10/07] Hello, this is Mitchell. Name refactor in progress. Changing internal representation from a flat text to a
You can’t perform that action at this time.
0 commit comments