graphql-engine/server/src-dc-api/Hasura/Backends/DataConnector/API/V0/Schema.hs
Daniel Chambers dc9a86680c Gardening: Clean up Data Connector API types
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5977
GitOrigin-RevId: 1a6898d6416fff265a8add74d414c979f7fa3bc5
2022-09-21 05:13:03 +00:00

34 lines
1023 B
Haskell

{-# LANGUAGE DeriveAnyClass #-}
module Hasura.Backends.DataConnector.API.V0.Schema
( SchemaResponse (..),
)
where
import Autodocodec
import Control.DeepSeq (NFData)
import Data.Aeson (FromJSON, ToJSON)
import Data.Data (Data)
import Data.Hashable (Hashable)
import Data.OpenApi (ToSchema)
import GHC.Generics (Generic)
import Hasura.Backends.DataConnector.API.V0.Table qualified as API.V0
import Prelude
--------------------------------------------------------------------------------
-- Schema Response
-- | The Schema Response provides the schemas for tracked tables and
-- 'Capabilities' supported by the service.
newtype SchemaResponse = SchemaResponse
{ _srTables :: [API.V0.TableInfo]
}
deriving stock (Eq, Ord, Show, Generic, Data)
deriving anyclass (NFData, Hashable)
deriving (FromJSON, ToJSON, ToSchema) via Autodocodec SchemaResponse
instance HasCodec SchemaResponse where
codec =
object "SchemaResponse" $
SchemaResponse <$> requiredField "tables" "Available tables" .= _srTables