mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-19 05:21:47 +03:00
dc9a86680c
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5977 GitOrigin-RevId: 1a6898d6416fff265a8add74d414c979f7fa3bc5
34 lines
1023 B
Haskell
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
|