pass through manifest as raw json value

This commit is contained in:
Lucy Cifferello
2021-07-20 18:58:32 -04:00
committed by Keagan McClelland
parent d0504bc616
commit 9f4a344c04
2 changed files with 6 additions and 6 deletions

View File

@@ -47,13 +47,13 @@ instance ToTypedContent CategoryRes where
toTypedContent = toTypedContent . toJSON toTypedContent = toTypedContent . toJSON
data ServiceRes = ServiceRes data ServiceRes = ServiceRes
{ serviceResIcon :: Text { serviceResIcon :: Text
, serviceResManifest :: ServiceManifest , serviceResManifest :: Maybe Data.Aeson.Value -- ServiceManifest
, serviceResCategories :: [CategoryTitle] , serviceResCategories :: [CategoryTitle]
, serviceResInstructions :: Text , serviceResInstructions :: Text
, serviceResLicense :: Text , serviceResLicense :: Text
, serviceResVersions :: [Version] , serviceResVersions :: [Version]
, serviceResDependencyInfo :: HM.HashMap AppIdentifier DependencyInfo , serviceResDependencyInfo :: HM.HashMap AppIdentifier DependencyInfo
} deriving (Show, Generic) } deriving (Generic)
newtype ReleaseNotes = ReleaseNotes { unReleaseNotes :: HM.HashMap Version Text } newtype ReleaseNotes = ReleaseNotes { unReleaseNotes :: HM.HashMap Version Text }
deriving (Eq, Show) deriving (Eq, Show)
@@ -118,7 +118,7 @@ instance ToTypedContent ServiceAvailable where
toTypedContent = toTypedContent . toJSON toTypedContent = toTypedContent . toJSON
newtype ServiceAvailableRes = ServiceAvailableRes [ServiceRes] newtype ServiceAvailableRes = ServiceAvailableRes [ServiceRes]
deriving (Show, Generic) deriving (Generic)
instance ToJSON ServiceAvailableRes instance ToJSON ServiceAvailableRes
instance ToContent ServiceAvailableRes where instance ToContent ServiceAvailableRes where
toContent = toContent . toJSON toContent = toContent . toJSON
@@ -310,7 +310,7 @@ getServiceDetails maybeVersion service = do
$logError "could not parse service manifest!" $logError "could not parse service manifest!"
$logError (show e) $logError (show e)
sendResponseStatus status500 ("Internal Server Error" :: Text) sendResponseStatus status500 ("Internal Server Error" :: Text)
Right (a :: ServiceManifest) -> pure a Right a -> pure a
d <- traverse (mapDependencyMetadata appsDir appMgrDir domain) (HM.toList $ serviceManifestDependencies manifest) d <- traverse (mapDependencyMetadata appsDir appMgrDir domain) (HM.toList $ serviceManifestDependencies manifest)
-- @TODO uncomment when sdk icon working -- @TODO uncomment when sdk icon working
-- icon <- decodeIcon appMgrDir appDir appExt -- icon <- decodeIcon appMgrDir appDir appExt
@@ -319,7 +319,7 @@ getServiceDetails maybeVersion service = do
license <- decodeLicense appMgrDir appDir appExt license <- decodeLicense appMgrDir appDir appExt
pure $ ServiceRes pure $ ServiceRes
{ serviceResIcon = icon { serviceResIcon = icon
, serviceResManifest = manifest -- TypedContent "application/json" (toContent manifest) , serviceResManifest = decode $ BS.fromStrict manifest' -- pass through raw JSON Value
, serviceResCategories = serviceCategoryCategoryName . entityVal <$> categories , serviceResCategories = serviceCategoryCategoryName . entityVal <$> categories
, serviceResInstructions = instructions , serviceResInstructions = instructions
, serviceResLicense = license , serviceResLicense = license